Trend Reversal Indicator with Signals for ThinkorSwim

T

Trading51

Active member
2019 Donor
Warehouse
@markos

Made a few changes to the RSIlg. May be easier to understand and use. "C" = FE_Consolidation and "E" = FE_Exhaustion for the gamma line.





Rich (BB code):
RSI.DefineColor("Up", CreateColor( 0,  220, 0));
RSI.DefineColor("Down",  Color.MAGENTA);
RSI.SetLineWeight(4);
RSI.AssignValueColor(if RSI > RSI[1] and RSI[1] > RSI [2] then RSI.Color("Up") else if RSI < RSI[1] and RSI[1] < RSI [2] then RSI.Color("Down") else color.YELLOW);

#Gamma Line Color
gamma.DefineColor("Con", CreateColor( 153,  153, 153));
gamma.DefineColor("EX",  CreateColor( 153,  153, 153));
gamma.AssignValueColor(if gamma > .62 then gamma.Color("Con") else if gamma < .38 then gamma.Color("EX") else color.LIME);

AddCloud(gamma, .62, Color.GRAY, Color.Current);
AddCloud(gamma, .38, Color.Current, Color.GRAY);
Hello is there a conversation that explains how to use the RSI L or its concept it seems like traders like It would like to understand it more thanks
 
N

nassau35

New member
Ben I appreciate your patience but I duplicated this and still getting the same error message so I give up.
Would have been nice to scan for them.
I found a solution and is very simple.

1. You need to obtain the SCAN (if you have already the indicator only take the scan otherwise you will need to download both) from the First Page(Original Thread) : https://usethinkscript.com/threads/trend-reversal-indicator-with-signals-for-thinkorswim.183/

2. If you impor the indicator or scan via TOS link, TOS will automatically save the scan or indicator to "Studies" then you need to go
Scan > add study filter > modify in edit and when you get here(Picture 1) please take note that there should be one and only one INPUT (in the picture i change the of the scan but you get the idea). If you have more that one input that is the first error. Other error please see the size of the ThinkScript code. Scan should be shorter then the indicator. At the end if get to the Picture 1 added here you will be fine and TOS will let you save the scan.

I hope you can get it done, Sorry if I am not very well explaning things you can answer me to this if you have any trouble.
 
N

nassau35

New member
Hello Ben, I read te 14 pages. I have the indicator and the scan already in my TOS, now i know about the false, repainting things. I am trying to do swing trading, my questions would be....
how I can test this Indicator if i am using 1 day interval in the on demand section in TOS?

Do you think the false signals would be less in the 1 day interval? and with this I mean like, the bigger the internal is the less false signals will be... do think this would be possible?

I saw another post that you were working with this indicator and the advance market move indicator, I think, did you find something? and were i can
find that post? maybe I can help or try to give something.

Thank you in advance.
 
BenTen

BenTen

Administrative
Staff
VIP
@nassau35 I'm no longer using this indicator to trade. I used to but not anymore. I recommend playing around with it in ThinkorSwim, especially during market hours, so you can watch how the signals get repainted. You can also use onDemand as well. How often does it repaint? Will there be less repainting on the 1min? Those are some of the questions I can't say for sure. Again, you would have to explore it yourself.

I wouldn't recommend this to anyone new to trading. If you don't know what you're doing, the last thing you want to do is play around with an indicator that give repainting signals.

I did release the enhanced version of the original trend reversal, however, it still repaint. You can take a look at it here.
 
MBF

MBF

Active member
2019 Donor
Warehouse
Hello Ben, I read te 14 pages. I have the indicator and the scan already in my TOS, now i know about the false, repainting things. I am trying to do swing trading, my questions would be....
how I can test this Indicator if i am using 1 day interval in the on demand section in TOS?

Do you think the false signals would be less in the 1 day interval? and with this I mean like, the bigger the internal is the less false signals will be... do think this would be possible?

I saw another post that you were working with this indicator and the advance market move indicator, I think, did you find something? and were i can
find that post? maybe I can help or try to give something.

Thank you in advance.
I can give my two ticks on this one. Nassau, this indi can work and I've used it on a 5 minute and my entry on a one minute. As Ben has said it repaints A LOT on the one and cant be trusted. I am currently trying to do this and what I've found is that WITH lower indis it is possible. I've noticed before the open that the five-minute label in premarket USUALLY gets the direction right but you have to use other lowers for confirm. I still don't trust it but put it on your 5-minute chart and take a look. What I have been working on is using the 5-minute for direction and using the one minute as my pullback entry. Both the five and one can have the same direction in premarket but the one can change. Er ... how to explain? If both labels are red premarket, sometimes the one will change to green so I wait for the green one minute to turn red and that would be the entry for the five-minute red. I also use lowers. Makes sense? It's a quirky indicator and complicated to explain. Maybe do yourself a favor and just use the dang SMA10! This indi looks so pretty after the fact but not as easy as it seems. Nothing worth having comes easy :::grumble:::
 
Last edited:
MBF

MBF

Active member
2019 Donor
Warehouse
I can give my two ticks on this one. Nassau, this indi can work and I've used it on a 5 minute and my entry on a one minute. As Ben has said it repaints A LOT on the one and cant be trusted. I am currently trying to do this and what I've found is that WITH lower indis it is possible. I've noticed before the open that the five-minute label in premarket USUALLY gets the direction right but you have to use other lowers for confirm. I still don't trust it but put it on your 5-minute chart and take a look. What I have been working on is using the 5-minute for direction and using the one minute as my pullback entry. Both the five and one can have the same direction in premarket but the one can change. Er ... how to explain? If both labels are red premarket, sometimes the one will change to green so I wait for the green one minute to turn red and that would be the entry for the five-minute red. I also use lowers. Makes sense? It's a quirky indicator and complicated to explain. Maybe do yourself a favor and just use the dang SMA10! This indi looks so pretty after the fact but not as easy as it seems. Nothing worth having comes easy :::grumble::: and trust me, that is coming from a female! ;D
Preferably NOT on a chart within the last month. None of my bell and whistle indis work lately.
I'm just using the 10SMA and a lower.
 
2

2sureshk

Member
Hi Ben,

Please help if it is possible to convert this into a Strategy, I really liked this and I observed too many signals but would like to find the best time frame by performing a back test using this as strategy.

any help is appreciated ..

If there is a process to covered indicator into strategy, I can follow the same.

Thx
Suresh
 
BenTen

BenTen

Administrative
Staff
VIP
@2sureshk You can create a strategy for this, however, the indicator repaint so it's pretty useless. I can tell you right now that you will get 100% win rate across all timeframes.
 
BenTen

BenTen

Administrative
Staff
VIP
@2sureshk Try this. Add it as a Strategy.

Code:
# Trend Reversal Scanner
# Scanner by https://usethinkscript.com/u/theelderwand
# Discuss https://usethinkscript.com/d/183-trend-reversal-indicator-with-signals-for-thinkorswim

# Modified into a Strategy for backtesting. Not recommended since this indicator reapaint.

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;
def Momentum_Down = buysignal[1] == 1 and buysignal == 0;

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;


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

AddOrder(OrderType.BUY_TO_OPEN, condition = bullish2, price = close,100, tickcolor = Color. GREEN, arrowcolor = Color.GREEN, name = "BUY");

AddOrder(OrderType.SELL_TO_CLOSE, condition = bearish2, price = close,100, tickcolor = Color.RED, arrowcolor = Color.RED, name = "SELL");
 
2

2sureshk

Member
Thank you for the complete code and help

It will be running back testing

Thx
Suresh K
 
J

jan_angel

New member
2019 Donor
Hi BenTen, I know you had mentioned that mobile version is not available. Just checking to see if any luck yet? I love this indicator along with AMM. Thank you!
 
BenTen

BenTen

Administrative
Staff
VIP
It's not possible at all to my knowledge so I wouldn't even be waiting for it. @jan_angel
 
markos

markos

Well-known member
VIP
Hello is there a conversation that explains how to use the RSI L or its concept it seems like traders like It would like to understand it more thanks
@Trading51 If you haven't found it yet, there is quite a bit that I have written in Tutorials thread.
Please put something like this in a questions thread next time. Luckily, I just happened to come across this.
 
T

Trading51

Active member
2019 Donor
Warehouse
@Trading51 If you haven't found it yet, there is quite a bit that I have written in Tutorials thread.
Please put something like this in a questions thread next time. Luckily, I just happened to come across this.
Markos thanks, im learning the way it works around here thanks for the heads up!!
 
2

2sureshk

Member
@Likos Unfortunately not possible to work on mobile at the moment. It sucks that the mobile app can barely display any custom indicators properly, even for some of their built-in ones.
undefined

Hi Ben

Can I setup alert with this indicator for any specific stock?

Please share if there is a separate code

Thx
Suresh
 
2

2sureshk

Member
Hi Ben ,

I am looking to setup email alert , when I select scan or enhanced or trend reversal alert I see an error “no such function” compoundvalue at 1:1

What am I doing wrong? Appreciate your help
 
BenTen

BenTen

Administrative
Staff
VIP
@2sureshk I don't think you can set up an email alert for this particular indicator.
 

Top