Repaints Trend Reversal for ThinkorSwim

Repaints
Status
Not open for further replies.
@JabronLames I've not attempted to do so. This indicator work is very different from other indicators, not to mention it's also a repainting indicator.
 

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

@BenTen,

I'm sure that you know better than I would, but I believe the issue is with the the amount of lookups with these definitions.

#####
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);
#####

It's a great indicator, and even if another version of the study didn't have (red/signal down || green/signal up) capability it would still be great to see which equities in my watchlist triggered this at a glance. Even if it didn't repaint/remove old bubbles, it's just nice to quickly react to what could be a reversal that is forming on a longer term chart.

....Just something to think about, I know you are busy.

Anyway, I'll be tinkering with this a bit, if I discover something interesting I'll let you know!
 
Hi All,

First of all a big thanks to Ben and all others for their contributions and comments.

N.B. I have generally followed this thread, but after 40+ pages of comments, I cannot guarantee that every single nugget of information mentioned so far is incorporated in this comment so apologies in advance if I missed something.

The original code is very long and complex and contains many lines which are actually not used, so I took a stab at reducing the code to its minimal components so as to get the same outcome with much fewer lines and in a code that is more digest for anyone trying to dissect it (CAVEAT: actually almost the same, the new code does not differentiate between neutral and reversal signals, so what would have been neutral signals in the old code are now regular reversal signals to go long or short depending on the previous position. I didn't bother trying to "fix" this as I found that using these as reversal signals is still profitable). I also transformed it into a strategy rather than an indicator, which allows to get the floating P&L and report on it in ToS.

Indicator: https://tos.mx/wZwrmkK

Strategy: https://tos.mx/HoecfTy

So that was the "good" news, the bad news is that the strategy, because it is based on the zigzaghighlow indicator, still repaints, making system based backtesting in ToS impossible and forcing me to backtest manually so far. Needless to say that this is not a sustainable or efficient solution and I really want to be able to backtest over different timeframes/instruments/various settings, etc..

So here is my question to this forum:

Has anyone managed to backtest or re-code this in a way that does not repaint? (Whether it is in ToS or, as I was thinking, perhaps in Excel?) I am happy to provide historical price data in Excel if needed.

Many thanks in advance for any help with this.

Kind regards,
Newbie
 
@Newbie_789456 Thank you for taking the initiative to re-optimize the codebase. We appreciate it.

You're correct in saying that this indicator uses the ZigZagHighLo component and so it will repaint. As a result, backtesting this script will likely be impossible.
 
so i use 20 days 10 minute when you get a signal make sure you look at macd candle if it red candle and the signal say call or green whatever you want to call it i enter it because that mean the stock is about to up but thats just an early signal and than just wait about 15-hour you will come out with big profit. and if the signal is red and the macd candle is green i enter it just telling that the is about go down and just wait about 15-hour and you will come out with big profit.
but if the signal are the same color dont enter it because either high-risk or the stock is already up or down
 
@camitos thought you might want to see how I have used the trend reversal. I find that using it in conjunction with the swing h-l works nicely and yes it does repaint but once in the trade the risk is low.

dzGo5zw.png
i saw trend line in your chart its great is it script based or you did manually?
 
New here, I want to thank everyone for their discussion and contribution! QUESTION on this TR indicator: Has anyone used it successfully intraday on 2-5 minute charts? I was using it to trade JNUG today and it gave some great buy/sell signals. I know @BenTen mentioned to use it on 15 min chart but I've been using it OnDemand and live, and it seems to be working well. Is that just luck? Maybe just working well with JNUG? Thanks in advance, sorry if this question has been asked already.
 
New here, I want to thank everyone for their discussion and contribution! QUESTION on this TR indicator: Has anyone used it successfully intraday on 2-5 minute charts? I was using it to trade JNUG today and it gave some great buy/sell signals. I know @BenTen mentioned to use it on 15 min chart but I've been using it OnDemand and live, and it seems to be working well. Is that just luck? Maybe just working well with JNUG? Thanks in advance, sorry if this question has been asked already.
I use it on a 2m as part of my indicator set. Works nicely for me
 
Hello,

I downloaded this indicator from the provided link to my think or swim so I could scan for signals. But that did not work, tough, the indicator was able to get to my indicators list. However, I cannot use it for scanning. Can someone tell me how to proceed so I could use this icator as a scan tool? Thank you!

Pl
 
Hello,

I downloaded this indicator from the provided link to my think or swim so I could scan for signals. But that did not work, tough, the indicator was able to get to my indicators list. However, I cannot use it for scanning. Can someone tell me how to proceed so I could use this icator as a scan tool? Thank you!

Pl
Are you looking to use this on your charts, or for use in scans...??? I run a modified version on my charts...

Edited to add: I just downloaded the scanner, via the link, and received the following error when I added the study to a scan... Error: Trying to self-assign a non-initialized rec: state. displays in the Search Results line of the scanner... So, yeah, there is an issue with the code as provided... I'll try to debug...
 
Last edited:
I am no coder and certainly respect what you guys can do. I have a question about the trend reversal indicator. Is it possible to add and audible alert to the indicator when the reversal occurs from one side to the other side? Thanks, Bob
 
I am no coder and certainly respect what you guys can do. I have a question about the trend reversal indicator. Is it possible to add and audible alert to the indicator when the reversal occurs from one side to the other side? Thanks, Bob
Yes, my copy actually has the code for alerts in it but I have alerts disabled because they get annoying quick when day trading... Not sure if they were in it originally or if I added the code to the script myself... I'll check and let you know...
 
Yes, my copy actually has the code for alerts in it but I have alerts disabled because they get annoying quick when day trading... Not sure if they were in it originally or if I added the code to the script myself... I'll check and let you know...
That would be great if you would get back to me. I was hoping to use the indicator on a 15 minute chart and notice they only get 2 signals a day if that. Thanks and I'm looking forward to hearing back
 
That would be great if you would get back to me. I was hoping to use the indicator on a 15 minute chart and notice they only get 2 signals a day if that. Thanks and I'm looking forward to hearing back
I thought I had already replied but I'm not seeing my post... Yes, the script code in the initial post has alerts but they are commented out... I un-commented them in my copy and added code so I can turn alerts on or off from the scripts settings panel... Just look at the code for the alert() lines and remove the leading # characters...
 
@Newbie_789456
@BenTen

Has anyone managed to backtest or re-code this in a way that does not repaint? (Whether it is in ToS or, as I was thinking, perhaps in Excel?)

First time poster. I came across this thread while researching the Trend Reversal code. I am also interested in finding a way to see the erased alerts. I understand that it is not possible to see the repainted alerts on chart bubbles, but would it be possible to create a lower study to show historical repaints using dots? Let me explain my idea...

When the indicator alerts for a Reversal on the uptick (Green), it Prints a Green dot. We could even offset this Green dot to lets say -5
When the indicator alerts for a Reversal on the downtick (Red), it Prints a Red dot. We could even offset this Red dot to lets say +5

These dots would line up with each candle using the crosshair. If no alert from the indicator, no dot (or a black dot if needed at 0). If you have a Green dot with no chart bubble, that candle had a repainted uptick alert. If it has a Red dot, then that candle had a repainted downtick alert. This obviously would not help any with system based backtesting, but seeing these repainted alerts visually would come in handy for me.

Could something like this be created to show us which candles had a repainted alert?
 
Last edited:
Status
Not open for further replies.

Volatility Trading Range

VTR is a momentum indicator that shows if a stock is overbought or oversold based on its Weekly and Monthly average volatility trading range.

Download the indicator

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
182 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