Support Board
Date/Time: Mon, 10 Mar 2025 22:05:53 +0000
[Programming Help] - Two Legged Pullback Indicator
View Count: 1896
[2022-04-09 20:43:11] |
User871209 - Posts: 91 |
Hello, Is there an indicator or an alert condition that counts the legs for a Two-Legged Pullback? Any information appreciated, Thanks |
[2022-04-11 15:29:38] |
John - SC Support - Posts: 38547 |
There is not a built-in method for counting the pullbacks. But you should be able to put together an Alert or a collection of studies that does what you need. Refer to the following: Study/Chart Alerts And Scanning For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2022-04-11 16:16:40] |
User871209 - Posts: 91 |
John, Good afternoon, Appreciate the reply, Unfortunately, I would not be able to render it after looking at the page but thanks for sending me the link. Regards, |
[2022-04-11 17:12:27] |
John - SC Support - Posts: 38547 |
Programming Help, including Alerts, is beyond the level of support that we give. But, we have set this as a User Discussion, as sometimes other users are willing to give help in terms of setting up Alerts or studies. For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2022-04-12 23:34:13] |
Ticks - Posts: 204 |
@User871209 if you can find the code from another charting software such as ninja or TradeStation, etc. Someone here may be able to convert it to SC.
|
[2022-04-13 05:33:01] |
User871209 - Posts: 91 |
Ticks, Hello, That would be great, the first link is the code and the second link not completely sure if it is or not but I post it. https://usethinkscript.com/threads/two-legged-pullback-indicator-for-thinkorswim.2846/ https://github.com/joostbr/NLegPullback/commit/fd91fe43863d651703772c7ea6d1a0646566c020 Please let me know, Regards, |
[2022-04-17 12:11:36] |
User871209 - Posts: 91 |
# "Normal" PullBack Zone # Attempting to define a typical pullback area using imp_volatility() # v.01 7.31.18 # Nube input AcceptableBarsToEntry = 7; input HeadroomTicks = 1; input Fixins = no; def c = close; def na = Double.NaN; def bn = BarNumber(); def tick = TickSize(); def firstThing = Average(c,20); def secondThing = Average(c,100); def upCross = c > secondThing && firstThing crosses above secondThing; def upStop = c crosses below secondThing; def downCross = c < secondThing && firstThing crosses below secondThing; def downStop = c crosses above firstThing; def iv = if !IsNaN(imp_volatility()) then imp_volatility() else iv[1]; def SD1 = c * iv * Sqrt((AcceptableBarsToEntry/(AggregationPeriod.DAY/GetAggregationPeriod())) / 365); def SD2 = SD1 * 2; def buyBar = if upCross then bn else buyBar[1]; def buyStop = if bn == buyBar then c - SD2 - tick * HeadroomTicks else if upStop then na else buyStop[1]; def buyPrice = if bn == buyBar then c else buyPrice[1]; def buyRetrace = if bn == buyBar then c - SD1 else if upStop then na else buyRetrace[1]; def buyRiskOff = if bn == buyBar then c + SD1 else if upStop then na else buyRiskOff[1]; def sellBar = if downCross then bn else sellBar[1]; def sellPrice = if bn == sellBar then c else sellPrice[1]; def sellStop = if bn == sellBar then c + SD2 + tick * HeadroomTicks else if downStop then na else sellStop[1]; def sellRetrace = if bn == sellBar then c + SD1 else if downStop then na else sellRetrace[1]; def sellRiskOff = if bn == sellBar then c - SD1 else if downStop then na else sellRiskOff[1]; plot LongEntry; LongEntry. SetDefaultColor(CreateColor(100,200,100)); LongEntry. SetPaintingStrategy(PaintingStrategy.Arrow_Up); LongEntry = if bn == buyBar then low - tick * HeadroomTicks else na; plot LongRetrace = Round(buyRetrace,2); LongRetrace. SetStyle(Curve.Short_Dash); LongRetrace. SetDefaultColor(CreateColor(100,200,100)); plot LongStop = Round(buyStop,2); LongStop. SetDefaultColor(CreateColor(200,100,100)); LongStop. SetStyle(Curve.Firm); plot LongRiskOff = Round(buyRiskOff,2); LongRiskOff. SetDefaultColor(Color.Pink); LongRiskOff. SetStyle(Curve.Medium_Dash); plot ShortEntry; ShortEntry. SetDefaultColor(CreateColor(200,100,100)); ShortEntry. SetPaintingStrategy(PaintingStrategy.Arrow_Down); ShortEntry = if bn == sellBar then high + tick * HeadroomTicks else na; plot ShortRetrace = Round(sellRetrace,2); ShortRetrace. SetStyle(Curve.Short_Dash); ShortRetrace. SetDefaultColor(CreateColor(200,100,100)); plot ShortStop = Round(sellStop,2); ShortStop. SetDefaultColor(CreateColor(100,200,100)); ShortStop. SetStyle(Curve.Firm); plot ShortRiskOff = Round(sellRiskOff,2); ShortRiskOff. SetDefaultColor(CreateColor(155,225,155)); ShortRiskOff. SetStyle(Curve.Medium_Dash); AddChartBubble(Fixins && LongEntry, LongStop, "Long Stop \n" +LongStop, Color.Red,0); AddChartBubble(Fixins && LongEntry, LongRiskOff, "Long Risk Off: " +LongRiskOff+ "\n 1 SD: "+ Round(SD1,2), Color.Pink); AddChartBubble(Fixins && ShortEntry, ShortStop, "Short Stop \n" +ShortStop, Color.Green); AddChartBubble(Fixins && ShortEntry, ShortRiskOff, "Short Risk Off: " +ShortRiskOff+ "\n 1 SD: "+ Round(SD1,2), CreateColor(155,225,155), 0); def LE = if !IsNaN(c) then buyPrice else na; def SE = if !IsNaN(c) then sellPrice else na; AddCloud(if (Fixins, LE, na), LongRetrace, CreateColor(155,225,155)); AddCloud(if (Fixins, ShortRetrace, na), SE, Color.Pink); # f/ "Normal" PullBack Zone |
To post a message in this thread, you need to log in with your Sierra Chart account: