Repaints Trend Reversal for ThinkorSwim

Repaints
Status
Not open for further replies.
I believe that is what it is.
Ok... I've played with those but didn't see any benefit, personally... Perhaps I was just drawing them on the wrong equities because the spirals were far too big to provide any predictions... I never tried playing with the settings though... YMMV...
 

New Indicator: Buy the Dip

Check out our Buy the Dip indicator and see how it can help you find profitable swing trading ideas. Scanner, watchlist columns, and add-ons are included.

Download the indicator

Hi, new to this forum. Does the trend reversal script send alerts when triggered? Thanks for clarifying.
 
Hi, new to this forum. Does the trend reversal script send alerts when triggered? Thanks for clarifying.
You have to setup a scan for that and limit the scan to a watchlist otherwise the scan returns an error of being too complex or something to that effect. You can also do a watchlist column for it. Where a 1 would indicate a reversal and a zero would indicate no reversal. It can take some time for it to load, but I only do it for a daily chart.
 
You have to setup a scan for that and limit the scan to a watchlist otherwise the scan returns an error of being too complex or something to that effect. You can also do a watchlist column for it. Where a 1 would indicate a reversal and a zero would indicate no reversal. It can take some time for it to load, but I only do it for a daily chart.
Thank you, much appreciated. Is there a link here that shows the steps to do this, including the script?
 
Thank you, much appreciated. Is there a link here that shows the steps to do this, including the script?
I specified a small watchlist but still keep getting "too complex" error message. Anyone have ideas to help resolve? Thks
 
I specified a small watchlist but still keep getting "too complex" error message. Anyone have ideas to help resolve? Thks

"Too complex" is study related, not related to the size of your watchlists... "Custom expression subscription limit exceeded" errors are watchlist length related...

This Study IS NOT a good candidate for use in scans or watchlists, as has been covered multiple times here in the forums... The reason being the inclusion of the ZigZagHighLow Study being referenced within the script...
 
"Too complex" is study related, not related to the size of your watchlists... "Custom expression subscription limit exceeded" errors are watchlist length related...

This Study IS NOT a good candidate for use in scans or watchlists, as has been covered multiple times here in the forums... The reason being the inclusion of the ZigZagHighLow Study being referenced within the script...
Thank you rad14733. Is there another study/script that I can use as scanner in TOS that works better?
 
Hello folks

Annoying question but can't work out how to answer without staring at a screen for several hours, so hoping someone can save me from that!

Does this indicator repaint its up and down arrows once the candle closes? I know the TR Studies all repaint (I've watched the signal candle move constantly) but can't see that the arrow alerts ever change once they appear. Am I making it up?

Code:
def price = close;
def superfast_length = 9;
def fast_length = 14;
def slow_length = 21;
def displace = 0;

def mov_avg9 = ExpAverage(price[-displace], superfast_length);
def mov_avg14 = ExpAverage(price[-displace], fast_length);
def mov_avg21 = ExpAverage(price[-displace], slow_length);

#moving averages
def Superfast = mov_avg9;
def Fast = mov_avg14;
def Slow = mov_avg21;

def buy = mov_avg9 > mov_avg14 and mov_avg14 > mov_avg21 and low > mov_avg9;
def stopbuy = mov_avg9 <= mov_avg14;
def buynow = !buy[1] and buy;
def buysignal = CompoundValue(1, if buynow and !stopbuy then 1 else if buysignal[1] == 1 and stopbuy then 0 else buysignal[1], 0);

def Buy_Signal = buysignal[1] == 0 and buysignal == 1;

#Alert(condition = buysignal[1] == 0 and buysignal == 1, text = "Buy Signal", sound = Sound.Bell, "alert type" = Alert.BAR);

def Momentum_Down = buysignal[1] == 1 and buysignal == 0;

#Alert(condition = buysignal[1] == 1 and buysignal == 0, text = "Momentum_Down", sound = Sound.Bell, "alert type" = Alert.BAR);

def sell = mov_avg9 < mov_avg14 and mov_avg14 < mov_avg21 and high < mov_avg9;
def stopsell = mov_avg9 >= mov_avg14;
def sellnow = !sell[1] and sell;
def sellsignal = CompoundValue(1, if sellnow and !stopsell then 1 else if sellsignal[1] == 1 and stopsell then 0 else sellsignal[1], 0);

def Sell_Signal = sellsignal[1] == 0 and sellsignal;

#Alert(condition = sellsignal[1] == 0 and sellsignal == 1, text = "Sell Signal", sound = Sound.Bell, "alert type" = Alert.BAR);

def Momentum_Up = sellsignal[1] == 1 and sellsignal == 0;

#Alert(condition = sellsignal[1] == 1 and sellSignal == 0, text = "Momentum_Up", sound = Sound.Bell, "alert type" = Alert.BAR);

plot Colorbars = if buysignal == 1 then 1 else if sellsignal == 1 then 2 else if buysignal == 0 or sellsignal == 0 then 3 else 0;
Colorbars.Hide();
Colorbars.DefineColor("Buy_Signal_Bars", Color.GREEN);
Colorbars.DefineColor("Sell_Signal_Bars", Color.RED);
Colorbars.DefineColor("Neutral", Color.PLUM);
#___________________________________________________________________________

input method = {default average, high_low};
def bubbleoffset = .0005;
def percentamount = .01;
def revAmount = .05;
def atrreversal = 2.0;
def atrlength = 5;
def pricehigh = high;
def pricelow = low;
def averagelength = 5;
def averagetype = AverageType.EXPONENTIAL;
def mah = MovingAverage(averagetype, pricehigh, averagelength);
def mal = MovingAverage(averagetype, pricelow, averagelength);
def priceh = if method == method.high_low then pricehigh else mah;
def pricel = if method == method.high_low then pricelow else mal;
def EI = ZigZagHighLow("price h" = priceh, "price l" = pricel, "percentage reversal" = percentamount, "absolute reversal" = revAmount, "atr length" = atrlength, "atr reversal" = atrreversal);
def reversalAmount = if (close * percentamount / 100) > Max(revAmount < atrreversal * reference ATR(atrlength), revAmount) then (close * percentamount / 100) else if revAmount < atrreversal * reference ATR(atrlength) then atrreversal * reference ATR(atrlength) else revAmount;
rec EISave = if !IsNaN(EI) then EI else GetValue(EISave, 1);
def chg = (if EISave == priceh then priceh else pricel) - GetValue(EISave, 1);
def isUp = chg >= 0;
rec isConf = AbsValue(chg) >= reversalAmount or (IsNaN(GetValue(EI, 1)) and GetValue(isConf, 1));
def EId = if isUp then 1 else 0;

#Arrows
def EIL = if !IsNaN(EI) and !isUp then pricel else GetValue(EIL, 1);
def EIH = if !IsNaN(EI) and isUp then priceh else GetValue(EIH, 1);
def dir = CompoundValue(1, if EIL != EIL[1] or pricel == EIL[1] and pricel == EISave then 1 else if EIH != EIH[1] or priceh == EIH[1] and priceh == EISave then -1 else dir[1], 0);
def signal = CompoundValue(1, if dir > 0 and pricel > EIL then if signal[1] <= 0 then 1 else signal[1] else if dir < 0 and priceh < EIH then if signal[1] >= 0 then -1 else signal[1] else signal[1], 0);
def showarrows = yes;
def U1 = showarrows and signal > 0 and signal[1] <= 0;
#U1.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
#U1.SetDefaultColor(Color.GREEN);
#U1.SetLineWeight(4);
def D1 = showarrows and signal < 0 and signal[1] >= 0;
#D1.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
#D1.SetDefaultColor(Color.RED);
#D1.SetLineWeight(4);
def barnumber = BarNumber()[10];

def bullish2 = signal > 0 and signal[1] <= 0;
plot upArrow = bullish2;
upArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
upArrow.SetDefaultColor(CreateColor(145, 210, 144));

def bearish2 = signal < 0 and signal[1] >= 0;
plot downArrow = bearish2;
downArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
downArrow.SetDefaultColor(CreateColor(255, 15, 10));

def revLineTop;
def revLineBot;

if barnumber and D1 {
    revLineBot = Double.NaN;
    revLineTop = high[1];
} else if barnumber and U1 {
    revLineTop = Double.NaN;
    revLineBot = low[1];
} else if !IsNaN(revLineBot[1]) and (Colorbars[2] == 2 or Colorbars[1] == 2) {
    revLineBot = revLineBot[1];
    revLineTop = Double.NaN;
} else if !IsNaN(revLineTop[1]) and (Colorbars[2] == 1 or Colorbars[1] == 1) {
    revLineTop = revLineTop[1];
    revLineBot = Double.NaN;
} else {
    revLineTop = Double.NaN;
    revLineBot = Double.NaN;
}

plot botLine = revLineBot[-1];
botLine.SetDefaultColor(Color.LIGHT_GREEN);
plot topLine = revLineTop[-1];
topLine.SetDefaultColor(Color.LIGHT_RED);

#Alerts

Alert(downArrow, " ", Alert.BAR, Sound.Chimes);
Alert(upArrow, " ", Alert.BAR, Sound.Bell);
 
@BBDPDC That code will most likely repaint because it makes use of the ZigZagHighLow indicator which in itself repaints... Moving Averages, in and of themselves do not repaint after a candle/bar closes but when tied to the aforementioned ZigZagHighLow indicator the results will most likely repaint... You can verify by monitoring a very active symbol on a low tick count Chart... That would eliminate the need to stare at a Chart for hours...

Edited to add: Well, it took less than two minutes to prove that it repaints as expected... I setup a Chart of the SPY symbol and set it to 1 Tick... It painted a line and red down arrow at14:27 and they disappeared by 14:29, after close to 60 candles/bars...
 
Last edited:
Anyone know how to have this in Multi-Agg i wanted to put a 4 hour reversal on a daily chart. is this possible?

I doubt it would be worth the effort as this is a repainting indicator cobbled together from several indicators, including the ZigZagHighLow which is the main culprit... You can probably find better candidates for your MTF needs which already exist...
 
I doubt it would be worth the effort as this is a repainting indicator cobbled together from several indicators, including the ZigZagHighLow which is the main culprit... You can probably find better candidates for your MTF needs which already exist...
It def is worth the effort this indicator works as a great scan tool.
 
Thank you, much appreciated. Is there a link here that shows the steps to do this, including the script?
Go to the link where you download it, make sure you remember what name it is saved under. Then you will add it as a study to your scan you create, then you will select "is true" then within 3 bars. I used within 3 bars rather than 1 so it gives you a few more stocks. Set the aggregation to "D" "WK" or whatever time frame. I only use it for "D" and "WK" because I find on the smaller time frames it doesn't always do as well. If you aren't sure how to edit the conditions, go to your scan, then "create scan query", then you will see that icon that looks like a pen, click that so you can edit the conditions. Delete any existing condition.

Step 1: Go to scan tab
Step 2: Go to "add filter" this will bring up options for "stock", "study", "option" "fundamental" or "pattern"
Step 3: select study
Step 4: click the "edit" pen when the study shows "ADXCrossver"
Step 5: hit delete
Step 6: click add condition, in the select a condition box, choose the study, then what you saved IE Reversal Indicator or whatever
Step 7: select "is true"
Step 8: select "within 3 bars"
Step 9: Save study under the name you want to use.
 
Hi Ben I would like to have this strategy to work both way, going long and short, could you correct it please. it is not working when i want to short.
thanks
 
@alexR Are you talking about a backtesting strategy? If so, check out this link.

Sorry to burst your bubble; because this is a repainting indicator, the P/L report will show a 100% win rate (in reality, it's not that accurate).
 
Status
Not open for further replies.

BenTen's Watchlist + Setup + Trade Recaps

Get access to Ben's watchlist, swing trading strategy, ThinkorSwim setup, and trade examples.

Learn more

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
218 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top