Repaints Trend Reversal for ThinkorSwim

Repaints
Status
Not open for further replies.
Your share explains a lot. TOS secrets for your scan,.....Look at my changes,.....last, is the last price,....I added a Momentum filter of strength, beta for me not important, and the strong momentum creates the beginning of stocks under 4 for those long trends...."Buy Low, sell High" thingy, and I dropped the volume to catch the beginning of a daily move, otherwise stocks must generate 3Mil before they show in scanner and the move may have taken place already. Look at my changes, try it or delete it.......http://tos.mx/0kFQ7Iv
 

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

Thanks, that’s the trend pivots, it doesn’t plot the pivot back on the 9:42am candle though
Not understanding your "Candle," problem, try a picture......it should look like this....in the beginning.....
qFlijCo.png
 
Your share explains a lot. TOS secrets for your scan,.....Look at my changes,.....last, is the last price,....I added a Momentum filter of strength, beta for me not important, and the strong momentum creates the beginning of stocks under 4 for those long trends...."Buy Low, sell High" thingy, and I dropped the volume to catch the beginning of a daily move, otherwise stocks must generate 3Mil before they show in scanner and the move may have taken place already. Look at my changes, try it or delete it.......http://tos.mx/0kFQ7Iv
Thanks for your share...It will be interesting to see what generates, although I do not look at low priced stocks and need more volume than 100k so with a few tweaks for me I'll look at it against mine.
 
It is not plotting for me though

Here is the code I have

Code:
# Plot areas of potential support / resistance based on major peaks and valleys.
# Changing "magnitude" determines the granularity of detected peaks or valleys.
# A low magnitude value will plot minor price swings, while a high magnitude value
# will only plot major price swings.
# A magnitude value of 2 means that a high must be greater than the 2 candles 
# before and after it to be considered a peak.  Likewise for the lows to be a valley.
# 
# Robert Payne


input magnitude = 9;

# define and plot the most recent peak
def peak = high >= Highest(high[1], magnitude) and high >= Highest(high[-magnitude], magnitude);
def peakvalue = if BarNumber() < magnitude then Double.NaN else if peak then high else peakvalue[1];
plot peakline = peakvalue;
     peakline.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
     peakline.SetDefaultColor(Color.GREEN);

# extend the current peak line to the right edge of the chart
def countp = if IsNaN(peak) and !IsNaN(peak[1]) then 1 else countp[1] + 1;
plot peakext = if IsNaN(peak) then GetValue(peakline, countp) else Double.NaN;
     peakext.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
     peakext.SetDefaultColor(Color.GREEN);

# continue the previous peak as a dashed line
def oldpeak = if BarNumber() < magnitude then Double.NaN else if peak then peakvalue[1] else oldpeak[1];
plot oldpeakline = oldpeak;
     oldpeakline.SetPaintingStrategy(PaintingStrategy.DASHES);
     oldpeakline.SetDefaultColor(Color.GREEN);

# define and plot the most recent valley
def valley = low <= Lowest(low[1], magnitude) and low <= Lowest(low[-magnitude], magnitude);
def valleyValue = if BarNumber() < magnitude then Double.NaN else if valley then low else valleyValue[1];
plot valleyline = valleyValue;
     valleyline.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
     valleyline.SetDefaultColor(Color.PINK);

# extend the current valley line to the right edge of the chart
def countt = if IsNaN(valley) and !IsNaN(valley[1]) then 1 else countt[1] + 1;
plot valleyext = if IsNaN(valley) then GetValue(valleyline, countt) else Double.NaN;
     valleyext.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
     valleyext.SetDefaultColor(Color.PINK);

# continue the previous valley as a dashed line
def oldvalley = if BarNumber() < magnitude then Double.NaN else if valley then valleyValue[1] else oldvalley[1];
plot oldvalleyline = oldvalley;
     oldvalleyline.SetPaintingStrategy(PaintingStrategy.DASHES);
     oldvalleyline.SetDefaultColor(Color.PINK);
 
ok im going to play this week and place an order as soon as the arrow/alert happens and then sell on the other arrow and see what happens.

I trade high momentum, low float stocks in the $2-25 range with a beta over 0.25. I believe there is a way to get close on the conditional orders i just need to keep working it to refine.
 
ok im going to play this week and place an order as soon as the arrow/alert happens and then sell on the other arrow and see what happens.

I trade high momentum, low float stocks in the $2-25 range with a beta over 0.25. I believe there is a way to get close on the conditional orders i just need to keep working it to refine.
does this mean you are just basing the trades of the trend reversal or using the TMO in conjunction?
 
Really cool that @Newbie_789456 simplified the code a few pages back. This should make it much easier to improve the indicator.

I have been using the Trend Reversals for a long time now on mid-larger time frames purely to confirm day trade entries on the 5/3/1 minute charts . I don't take a position on those smaller time frames unless there is Trend Reversal bubble on a higher time frame confirming direction. Obviously will miss out on some moves this way, but I am really trying to move away from scalping smaller moves. Not a surprise that the higher aggregation, the more accurate the signals are.

Here is my 30m chart. I took out the price values on the bubbles to have less clutter. The problem with using the swing hi/lows to confirm is that they are also a highly repainting indicator on smaller time frames. However if you use non repainting/ more stable indicators to confirm the trend reversal, they mostly come well after the trend reversal so the benefit of it's early timing is negated.

vzmV10J.png
 
Hello Everyone, after about 12-15 hours of back testing, I have finally finished reviewing the outcomes and results of the Trend Reversal indicator. Before I get started, I’m going to let you all know what the process was for back testing this indicator.
  • Trade on the 10m chart for the stock AMD between the dates 3/2 – 3/31 (intraday only)
  • Long Up Arrows and Short Down Arrows
  • Every time a Reversal Arrow disappears or hits my stop loss, I flatten my position and place a highlighted mark where the candle was
  • Every time the TR indicator was successful in predicting a reversal, I “reverse” my position which is essentially flattening my current position and taking a new position in the opposite direction, whether long or short
  • If an arrow did not hit my stop loss, disappear, or indicate a new reversal arrow before 16:00:00, I flatten my position at 15:59:30
At first, I was going to play with a 1:2 RR, but I did not want to mess with the efficiency or results of the data, so I based my trades solely off the indications when a reversal was due.

Now that I explained how the experiment worked, it’s time to talk about the results. Below the following paragraphs, I pasted a link to a file where anyone can review my results from the back test. You will find the amount of trades, the fake outs, the successful reversals, my risk to reward, where my SL (stop loss) was placed, my % gain per trade, the amount of money I made, etc. I did this for each day, each week and the total for the month. It’s all there so please take a look.

Moreover, you will find screenshots of my charts marking where the reversal arrows disappeared, where the reversal arrows were successful, and all of my trades. FYI, when you see an arrow that is highlighted, that simply shows a reversal arrow that hit my stop loss but did not repaint for some reason: that’s considered a loss.

Let’s get to the results. These are the TOTAL results from trading the Trend Reversal indicator in the month of March from the ticker AMD.

AMD Back Testing Trend Reversal Indicator for March Totals:
  • Total Reversals: 68
  • Total Up Arrows: 31
  • Total Down Arrows: 37
  • Failed Up Arrows: 12
  • Failed Down Arrows: 20
  • Successful Reversal Rate: 53%
AMD Back Testing Trend Reversal Trades for March Totals: +$2106.80
  • Total Trades: 66
  • Successful Trades: 44%
  • Average Risk to Reward: 1 to 1.90
  • Average $ per share per losing trade: $0.49
  • Average $ per share per winning trade: $0.93
Now as you can see, the successful TR indicator rate is basically every other arrow is correct. That’s not a bad success rate, but a success rate over 60% would have made me able to say, “one can rely solely on this indicator”. You can also see that even though there were 53% successful trend reversals, only 44% of my trades were profitable. This is because when a new trend reversal arrow appeared after the previous reversal arrow, a few times the new entry price was just a couple of cents away from my previous entry point. If you don’t understand what I’m saying take a look at this picture:

BLJ7Bzm.png


As you can see, the down arrow around 09:50:00 shows to short. Even though my down arrow didn’t disappear and didn’t hit my SL, the new up arrow, which appeared around 10:40:00, showed me to go long above the entry price where I shorted before. This resulted in a loss. A way around this would be just to take profit when I hit a specific target, but for the sake of the back test, I solely reversed my positions when I was indicated to do so.

Back to the results; In total, I took 66 trades, was successful 44% of the time, and had a risk to reward of about 1 to 1.9. I was profitable because even though I was wrong more than half of the time, my risk to reward was tremendous. With this RR, the way I would’ve broke even in the long run was only if my success rate was roughly 35%; however, since my success rate was 45%, I stayed profitable throughout the whole time. What really helped me was knowing where to place my stop loss. On average, I gained around 2.20% per winning trade and lost around 1.10% per losing trade. Each trade I took a position size of around $10,000 worth of shares. So, in plain English, my average profit per trade was around $220 and my average loss per trade was around $110. Basic RR math shows me that if I keep making more money that what I lose, as long as my success rate is greater than my RR ratio, I would be in the green. And that’s what happened here.

Here is the link to the folder, please take a look and ask me questions if you have any:

https://drive.google.com/drive/folders/177i8h-r7IErj-e-DypmfrawsczqAGueH?usp=sharing

Now, this is how I found to maximize the success rate of the indicator. Credit is definitely due, because there is an indicator called the TMO that has been on this forum but was brought to my attention thanks to @tenacity11. I went back and tested how I could combine the two together since they both indicate reversals. Here’s what I found:

In this study, I had a system, it goes like this:
  • When the TR Arrow Appears AND the TMO changes direction/color at the same time, you enter your position (step a)
  • When TMO changes direction (color: red to green or green to red) and THEN the TR Arrow Appears, you enter your position (this is called step b, but it's an alternative if step a does not happen)
  • You FLATTEN your position when the TMO indicator reaches the opposite zone and the candle which entered it closes: e.g. if you short, you wait for TMO to reach the red zone and for the candle to close; if you long, you wait for the TMO to reach the green zone and for the candle to close (step c)
  • If process a or b has repeated at step c, you should reverse your position rather than flatten it
Here’s a picture with using the TMO and TR being used together maximize accuracy:

kQp6KiN.jpg


After back testing this new strategy, the total scenarios that qualified for steps a-c from the original TR reversal back testing (66 total trades) was now only 34 trades. My success rate in this situation was now 53%, which is 9% more than my original back testing. However, we need to look at the RR as well.

As we know, the TR indicator gives us a success rate of 47% and RR of 1 to 1.90. The success rate of the new criteria I indicated (combining the TMO with the TR indicator) was 53% and a RR of 1 to 2.24. Now this…... is something we’ve all been looking for. We are correct over half of the time and have an amazing Risk to Reward ratio. With the new strategy, on average I lost $0.50 per losing trade, compared to the $0.49 per losing trade when only using the TR indicator; however, with the new strategy, I gained an average $1.12 per winning trade, compared to the $0.93 per winning trade when only using the TR indicator.

Here is the link to my back testing for this new strategy:

https://drive.google.com/file/d/1ovvVO2UmA9toN9AuIL7YoxPomzyDg_wc/view?usp=sharing

And this is the exact script I used from the TMO provided by usethinkscript:

http://tos.mx/Z859Hxn

This is what my back test consisted of and I hope I helped anyone that still uses this indicator. @BenTen , I know this might be a lot to ask of, but do you think it would be possible to write a script or something that I can back test to test out my new strategy without having to eyeball it? I’d just like a script that plots:
  • The TR indicator plotting red and green arrows, signaling a reversal (how it currently is)
  • The TMO indicator plotting cyan and yellow arrows, signaling a change in direction (from red to green: cyan and when green to red: yellow)
  • An arrow colored bright purple when both the TMO and TR indicator line up perfectly, signaling a reversal
I would really appreciate if someone can do this; I will back test TSLA over a period of 3 months if I can receive this type of indicator. It would be much easier having this rather than just eyeballing it.

Thank you!

P.S. I do not want to get anyone excited, but I also found a way of creating a 74% success rate combining the two indicators. Once I finish that back test, I will post the results and explain how it works. Most likely tonight or tomorrow.
 
Last edited:
Excellent review and i find that the buy signals are more accurate it looks like the sell indicators fall behind and would trigger the stop loss which is good. What stop loss scenario are you using?
 
Excellent review and i find that the buy signals are more accurate it looks like the sell indicators fall behind and would trigger the stop loss which is good. What stop loss scenario are you using?

Yes, I noticed that too. When I saw that only 12 up arrows failed compared to the 20 failed down arrows, I thought the same thing. In regards to the stop loss scenario, to keep the results as accurate as possible, I just placed a stop loss at the high or low, depending if I'm shorting or buying, of the candle before the candle which shows a reversal arrow.
 
@Gabrielx77 You can create a backtesting script for any indicators as long as they don't repaint.
Yeah I get that! Just that since the TR indicator repaints, it would be impossible for me to back test. That's why I was wondering if there was a way just to alter the TMO script to use arrows on my charts when a direction change were to occur. Is there already something like this on the TMO thread? The only thing I saw that could be used as indication were these buy/sell lines, but they were placed on the TMO indicator rather than on the charts with my candles.
 
@Gabrielx77 Really enjoyed reading your write up and analysis. Great work backtesting. I have been anecdotally seeing some success trying to use both indicators myself, but didn't manually backtest it. Quick question -- what was your strategy around using the 10m chart instead of perhaps the 5m?
 
Yes, I noticed that too. When I saw that only 12 up arrows failed compared to the 20 failed down arrows, I thought the same thing. In regards to the stop loss scenario, to keep the results as accurate as possible, I just placed a stop loss at the high or low, depending if I'm shorting or buying, of the candle before the candle which shows a reversal arrow.

What time frame are you using again? I trade on a 3 or 5 min candle. I would be happy to have the assistance for the buys now what i am trying to code is the conditional order that aligns with the buy signal... any thoughts????
 
Status
Not open for further replies.

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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