DEEPWATER_THE ONE For ThinkOrSwim

Looking at the charts today with most stocks in a down trend, it seems the best signals are for going short not long. Perhaps you can add a filter using EMA trends to filter out the buy signals or at least the weaker buy signals otherwise there are too many false positives on the long side.
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

If you put up 7 - 14 charts, different stocks, and add DEEPWATER_THE ONE and sit back and watch it work, it will alert you to many different things. Load it and watch it work. If you get a yellow/green Spike up it commonly marks the bottom and a second one close to the first is confirmation and an even stronger buy signal. 10% is knowing when to buy. 90% is knowing when to sell LOL. I made the RSI Cumulative to give me a second sell signal and it gives purple SPIKES DOWN. You get PURPLE SPIKES DOWN You better start selling some or part. or all. Good luck trading. It's just a tool but I have found it to be Synergetic in that all the parts make it very very useful.
Any thoughts on how it may work on a watchlist
 
Hi @Deepwater - Thanks for sharing this study. This doesn't work for SPX, is there something I can comment out in the code for it to work on SPX?
I think the indicator needs symbols with volume (i.e. stocks or ETFs) - try SPY instead of SPX and DIA instead of $DJI
 
I call this study THE ONE. It is basically throw everything but the kitchen sink into one study that would help both a new trader and an experienced trader, Alert me to things gapping, stocks suddenly seeing large volume, stocks with RSIs in extreme ranges. There are so many widgets of script in here that I look forward to others trying to improve it for the group. It is my payback to all of you who taught me so much and were unselfish with your knowledge and code. This is the one study I can not live without. I have 3 monitors and 30 charts I watch and "THE ONE" is the only indicator under each chart. I recently added what I call cumulative RSI extreme to it. What it does is if RSI goes overbought or oversold it starts cumulating and incrementing a count that seems to give a pretty good sell or buy signal. I have never seen this done and it is some neat code. I also look at MACD as it rounds over the top or bottom to trigger buy or sell signals. I do this with Spikes. Spikes from the top down are sells. Spikes from the Bottom up are buys. IT MAY BE THE EASIEST STUDY AS FAR AS SIGNALING YOU SOMETHING IS IN ALERT AND NEEDS A LOOK you may find. EASY FOR NOVICE and NEWBIES. Just load it and watch it for a week.

P.S. The code will give signals a bit differently on different time scales so always look at charts that are say 1D 1Min, 2D 5Min and 10D 30Min (these are only examples) and compare the buy and sell signals it's giving you. Enjoy

Code:

Code:
#DEEPWATER_THE ONE 5/7/2021 revision
#https://usethinkscript.com/threads/deepwater_the-one.6518/
declare lower;
input length = 13;
input length2 = 15;
input price = close;
input averageType = AverageType.WILDERS;

input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageTypeMACD = AverageType.EXPONENTIAL;

def Diff = MACD(fastLength, slowLength, MACDLength, averageTypeMACD).Diff;

def NetChgAvg = MovingAverage(averageType, price - price[1], length);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

def RSI = 50 * (ChgRatio + 1);
def RSIAvg3 = MovingAverage(averageType, (RSI), 3);
def RSIAvg5 = MovingAverage(averageType, (RSI), 5);
def RSI3OverSoldpivit = RSIAvg3 > RSIAvg3[1] and RSIAvg3[1] > RSIAvg3[2] and RSIAvg3[2] < RSIAvg3[3] and RSIAvg3[3] < RSIAvg3 [4];
def RSI3OverBoughtpivit = RSIAvg3 < RSIAvg3[1] and RSIAvg3[1] < RSIAvg3[2] and RSIAvg3[2] > RSIAvg3[3] and RSIAvg3[3] > RSIAvg3 [4];
#--------------------5 day MA
input displace = 0;
input showBreakoutSignals = no;
def MAvgExp14 = ExpAverage(price[-displace], 14);
#--------------------oversold
def twoBarPivotMACD = Diff > Diff[1] and Diff[1] > Diff[2] and Diff[2] < Diff[3] and Diff[3] < Diff [4];

def overSoldRSI = RSI <= 32;
def overSoldRSIHeavy = RSI <= 30 and Diff < 0 and (close < close[7]);
def TrendReversalalert = (twoBarPivotMACD and Highest(overSoldRSI, 6) > 0) / 3;
plot TrendReversal = (twoBarPivotMACD and Highest(overSoldRSI, 6) > 0) / 3;
Alert(TrendReversalalert, "Buy Alert");
plot TrendReversal1 = (twoBarPivotMACD and Highest(overSoldRSIHeavy, 6) > 0) / 1.2;


TrendReversal.SetDefaultColor(GetColor(4));#yellow
TrendReversal1.SetDefaultColor(GetColor(6));#green

AddLabel(yes, if  TrendReversal > 0 then "Buy" else "");
Alert( TrendReversalalert > 0,  "Chart is now Oversold ", Alert.BAR, Sound.Ring);
AddLabel(TrendReversalalert > 0
, "Chart is now Oversold ", Color.LIME);
#-----------------------Overbought
def twoBarPivotMACD1 = Diff < Diff[1] and Diff[1] < Diff[2] and Diff[2] > Diff[3] and Diff[3] > Diff [4];

def overboughtRSI = RSIAvg3 >= 65 and Diff > 0;
def TrendReversalalert20 = (twoBarPivotMACD1 and Highest(overboughtRSI[1], 7) > 0);
plot TrendReversal20 = 1 - (((RSIAvg3 >= 68 and RSI < RSIAvg3[2]) and RSI3OverBoughtpivit)/ 1.5) ;
plot TrendReversal20a = 1 - ((((RSIAvg3 >= 60 and RSIAvg3 < 68 )and RSI < RSIAvg3[2]) and RSI3OverBoughtpivit) / 4) ;

TrendReversal20.SetDefaultColor(GetColor(5)); #Red
TrendReversal20a.SetDefaultColor(GetColor(2)); #lt Red
plot TrendReversal50 = 1 - ((RSIAvg5 >= 70 and close < MAvgExp14) / 2) ;
TrendReversal50.SetDefaultColor(GetColor(0)); #Red
AddLabel(yes, if  TrendReversal20 < 1 then "Sell" else "");
Alert( TrendReversal20 < 1 ,  "Chart is now Overbought ", Alert.BAR, Sound.Ring);
AddLabel(TrendReversal20 < 1, "Chart is now Overbought ", Color.LIME);
input show_label = yes;
input show_bubble = no;
#--------------------------- Large 5X and 10X Volume Alert
input AverageLength = 100;
input VolumeMultiplier = 8;
input VolumeMultiplier2 = 5;
input MinutesAfterOpen = 30;

def AvgVol = Average(volume, AverageLength);
def VolX = (volume > AvgVol * VolumeMultiplier) ;
def Vol10X = (volume > AvgVol * 10) ;

Alert(VolX, Concat(GetSymbolPart(), " has a large volume spike." ), Alert.BAR, Sound.Chimes);
AddLabel(VolX > 0,  " Has 5X Volume Spike ", Color.LIGHT_GREEN);
Alert(Vol10X, Concat(GetSymbolPart(), " has a large volume spike." ), Alert.BAR, Sound.Chimes);
AddLabel(Vol10X > 0,  " Has 10X Volume Spike ", Color.LIGHT_GREEN);
#-------------------------------------GAP UP Price
def IsUp = close > open;
def IsDown = close < open;
def IsDoji = IsDoji();
def avgRange = 0.05 * Average(high - low, 20);
def GapUp =
    IsUp[1] and
    IsUp[0] and
    high[1] < low[0] and
    high[1] < open[0] and
(volume > AvgVol * 5) ;
Alert(GapUp, Concat(GetSymbolPart(), " GAPUP" ), Alert.BAR, Sound.Ring);
AddLabel(GapUp > 0,  " GAP Up  ", Color.LIGHT_GREEN);

#---------------------------------Large Price change 3%
def Priceup =
    IsUp[1] and
    IsUp[0] and
    high[1] < high[0] and
    high[2] * 1.02 < high[0] and
    high[3] * 1.03 < high[0] and
(volume > AvgVol * 3) ;
Alert(Priceup, Concat(GetSymbolPart(), " Price JUMP" ), Alert.BAR, Sound.Bell);
AddLabel(Priceup > 0,  " Price JUMP  ", Color.CYAN);

#---------------------------------HugePrice change 6%
def Priceup2 =
    IsUp[1] and
    IsUp[0] and
    high[1] < high[0] and
    high[3] * 1.04 < high[0] and
    high[4] * 1.06 < high[0] and
(volume > AvgVol * 3) ;
Alert(Priceup2, Concat(GetSymbolPart(), " JUMP! JUMP! JUMP" ), Alert.BAR, Sound.Chimes);
AddLabel(Priceup2 > 0,  " JUMP! JUMP! JUMP  ", Color.LIGHT_RED);

#-----------------------------------------------------------------------------------------
#--------------------------RSI cumulative running total
def MAvgExp7 = ExpAverage(price[-displace], 7);
def RSICalc = 50 * (ChgRatio + 1);
def RSICalc1 = if RSI > 70 then  3 else if RSI < 30 then  -3 else 0;
def RSICalc2 = if RSI[1] > 70 then  2 else if RSI[1] < 30 then  -2 else 0;
def RSICalc3 = if RSI[2] > 70 then  1 else if RSI[2] < 30 then  -1 else 0;
def RSICalc4 = if RSI[3] > 70 then  1 else if RSI[3] < 30 then  -1 else 0;
def RSICalc5 = if RSI[4] > 70 then  1 else if RSI[4] < 30 then  -1 else 0;
def RSICalc6 = if RSI[5] > 70 then  1 else if RSI[5] < 30 then  -1 else 0;
def RSICalc7 = if RSI[6] > 70 then  1 else if RSI[6] < 30 then  -1 else 0;
def RSICalc8 = if RSI[7] > 70 then  1 else if RSI[7] < 30 then  -1 else 0;
def RSICalc9 = if RSI[8] > 70 then  1 else if RSI[8] < 30 then  -1 else 0;
def RSICalc10 = if RSI[9] > 70 then  1 else if RSI[9] < 30 then  -1 else 0;
def RSICalc11 = if RSI[10] > 70 then  1 else if RSI[10] < 30 then  -1 else 0;
def RSICalc12 = if RSI[11] > 70 then  1 else if RSI[11] < 30 then  -1 else 0;
def RSICalc13 = if RSI[12] > 70 then  1 else if RSI[12] < 30 then  -1 else 0;
def RSICalc14 = if RSI[13] > 70 then  1 else if RSI[13] < 30 then  -1 else 0;
def RSICalc15 = if RSI[14] > 70 then  1 else if RSI[14] < 30 then  -1 else 0;
def RSICalc16 = if RSI[15] > 70 then  1 else if RSI[15] < 30 then  -1 else 0;
def RSICalc17 = if RSI[16] > 70 then  1 else if RSI[16] < 30 then  -1 else 0;
def RSICalc18 = if RSI[17] > 70 then  1 else if RSI[17] < 30 then  -1 else 0;
def RSICalc19 = if RSI[18] > 70 then  1 else if RSI[18] < 30 then  -1 else 0;
def RSICalc20 = if RSI[19] > 70 then  1 else if RSI[19] < 30 then  -1 else 0;
def RSICalc21 = if RSI[20] > 70 then  1 else if RSI[20] < 30 then  -1 else 0;
def RSICalc22 = if RSI[21] > 70 then  1 else if RSI[21] < 30 then  -1 else 0;
def RSICalc23 = if RSI[22] > 70 then  1 else if RSI[22] < 30 then  -1 else 0;
def RSICalc24 = if RSI[23] > 70 then  1 else if RSI[23] < 30 then  -1 else 0;
def RSICalc25 = if RSI[24] > 70 then  1 else if RSI[24] < 30 then  -1 else 0;
def RSICalc26 = if RSI[25] > 70 then  1 else if RSI[25] < 30 then  -1 else 0;
def RSICalc27 = if RSI[26] > 70 then  1 else if RSI[26] < 30 then  -1 else 0;
def RSICalc28 = if RSI[27] > 70 then  1 else if RSI[27] < 30 then  -1 else 0;
def RSICalc29 = if RSI[28] > 70 then  1 else if RSI[28] < 30 then  -1 else 0;
def RSICalc30 = if RSI[29] > 70 then  1 else if RSI[29] < 30 then  -1 else 0;

def RSI30DayAvg = RSICalc1 + RSICalc2 + RSICalc3 + RSICalc4 + RSICalc5 + RSICalc6 + RSICalc7 + RSICalc8 + RSICalc9 + RSICalc10 + RSICalc11 + RSICalc12 + RSICalc13 + RSICalc14 + RSICalc15 + RSICalc16 + RSICalc17 + RSICalc18 + RSICalc19 + RSICalc20 + RSICalc21 + RSICalc22 + RSICalc23 + RSICalc24 + RSICalc25 + RSICalc26 + RSICalc27 + RSICalc28 + RSICalc29 + RSICalc30;
AddLabel(RSI30DayAvg >= 10 and RSI30DayAvg < 20, " RSI SELL: " + RSI30DayAvg + "   ",  Color.ORANGE);
AddLabel(RSI30DayAvg >= 20, " RSI SELL: " + RSI30DayAvg + "   ",  Color.RED);
AddLabel(RSI30DayAvg <= -10 and RSI30DayAvg > -20, " RSI BUY: " + RSI30DayAvg + "   ",  Color.LIME);
AddLabel(RSI30DayAvg <= -20, " RSI BUY: " + RSI30DayAvg + "   ",  Color.DARK_GREEN);
plot TrendReversal5 = 1 - (((RSI30DayAvg >= 10 and RSI30DayAvg < 15) and close < MAvgExp7) / 2) ;
TrendReversal5.SetDefaultColor(GetColor(0)); #magenta
plot TrendReversal5a = 1 - (((RSI30DayAvg >= 16  and RSI30DayAvg < 25) and close < MAvgExp7) / 1.3) ;
TrendReversal5a.SetDefaultColor(GetColor(0)); #magenta
plot TrendReversal5b = 1 - ((RSI30DayAvg >= 25 and close < MAvgExp7) / 1.05) ;
TrendReversal5b.SetDefaultColor(GetColor(0)); #magenta
plot TrendReversal6 = ((RSI30DayAvg <= -15 and close > MAvgExp7 ) * .3) ;
TrendReversal6.SetDefaultColor(GetColor(6)); #green
plot TrendReversal6a = (((RSI30DayAvg <= -20 and RSI30DayAvg > -30) and close > MAvgExp7) * .85) ;
TrendReversal6a.SetDefaultColor(GetColor(6)); #green
#End Code

SPY.jpg
Any way to change the color of the "RSI BUY" label that shows up on the upper left of the indicator? It shows up as a light greenish color with white lettering. I use a white background so it sort of washes out.
 
Any way to change the color of the "RSI BUY" label that shows up on the upper left of the indicator? It shows up as a light greenish color with white lettering. I use a white background so it sort of washes out.
@FreefallJM03 AddLabel has three varibles as in AddLabel(boolean Visible or CONDITION, Any Text to SHOW, CustomColor Color);

Yow can show a label as follows: Addlabel(1, "Close "+Round(Close,2), Color.DARK_GREEN) ; therefore in your case you can change the last variable in the line
AddLabel(RSI30DayAvg <= -10 and RSI30DayAvg > -20, " RSI BUY: " + RSI30DayAvg + " ", Color.LIME); #<<====== Color.DARK_GREEN

if you have inspector checked in the TOS editor you can get the syntax and colors from there. RTM yields the same result
 
Looking at the charts today with most stocks in a down trend, it seems the best signals are for going short not long. Perhaps you can add a filter using EMA trends to filter out the buy signals or at least the weaker buy signals otherwise there are too many false positives on the long side.
We have tried using EMA but can't seem to get the right balance. Besides that we talk about Clairvoyance of when you get stocks in pullback mode like the small caps there is no way a signal can tell you that inflation is rising so interest rates will rise and stocks will enter correction. You would need AI and human input to know that so like all signals it doesn't completely stand alone. It just gives you the best chances so when things turn around you get winners.
 
This is awesome! Greatness @Deepwater !
How do you set it up to give you text alerts, for when to buy or sell? Thanks
The Thinkscript code doesn't allow a study to send out SMS or such that I have ever seen but if you look at youtube videos, I found one that let me set up a watchlist so that if any stock in that watch list get's news, TOS sends the news to me via SMS and email. And also any ALERTS I set in TOS on a Chart gets forward to me SMS Text once triggered. Now you should be able to download the TOS App and when you pull up charts I have seen a study being able to be added to the chart within the app.
 
I call this study THE ONE. It is basically throw everything but the kitchen sink into one study that would help both a new trader and an experienced trader, Alert me to things gapping, stocks suddenly seeing large volume, stocks with RSIs in extreme ranges. There are so many widgets of script in here that I look forward to others trying to improve it for the group. It is my payback to all of you who taught me so much and were unselfish with your knowledge and code. This is the one study I can not live without. I have 3 monitors and 30 charts I watch and "THE ONE" is the only indicator under each chart. I recently added what I call cumulative RSI extreme to it. What it does is if RSI goes overbought or oversold it starts cumulating and incrementing a count that seems to give a pretty good sell or buy signal. I have never seen this done and it is some neat code. I also look at MACD as it rounds over the top or bottom to trigger buy or sell signals. I do this with Spikes. Spikes from the top down are sells. Spikes from the Bottom up are buys. IT MAY BE THE EASIEST STUDY AS FAR AS SIGNALING YOU SOMETHING IS IN ALERT AND NEEDS A LOOK you may find. EASY FOR NOVICE and NEWBIES. Just load it and watch it for a week. Also, what is the red horizontal line in the indicator? Does the buy or sell signal have to cross that or does it matter? On the 15 min chart for CLN21 there are two buy signals that show the green and yellowish buy signals with the yellowish one smaller inside the green one. The third buy signal on today's chart shows just the yellowish or maybe brownish colored one. Are these accurate buy signals or not because they are below the red horizontal line?

P.S. The code will give signals a bit differently on different time scales so always look at charts that are say 1D 1Min, 2D 5Min and 10D 30Min (these are only examples) and compare the buy and sell signals it's giving you. Enjoy

Code:

Code:
#DEEPWATER_THE ONE 5/7/2021 revision
#https://usethinkscript.com/threads/deepwater_the-one.6518/
declare lower;
input length = 13;
input length2 = 15;
input price = close;
input averageType = AverageType.WILDERS;

input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageTypeMACD = AverageType.EXPONENTIAL;

def Diff = MACD(fastLength, slowLength, MACDLength, averageTypeMACD).Diff;

def NetChgAvg = MovingAverage(averageType, price - price[1], length);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

def RSI = 50 * (ChgRatio + 1);
def RSIAvg3 = MovingAverage(averageType, (RSI), 3);
def RSIAvg5 = MovingAverage(averageType, (RSI), 5);
def RSI3OverSoldpivit = RSIAvg3 > RSIAvg3[1] and RSIAvg3[1] > RSIAvg3[2] and RSIAvg3[2] < RSIAvg3[3] and RSIAvg3[3] < RSIAvg3 [4];
def RSI3OverBoughtpivit = RSIAvg3 < RSIAvg3[1] and RSIAvg3[1] < RSIAvg3[2] and RSIAvg3[2] > RSIAvg3[3] and RSIAvg3[3] > RSIAvg3 [4];
#--------------------5 day MA
input displace = 0;
input showBreakoutSignals = no;
def MAvgExp14 = ExpAverage(price[-displace], 14);
#--------------------oversold
def twoBarPivotMACD = Diff > Diff[1] and Diff[1] > Diff[2] and Diff[2] < Diff[3] and Diff[3] < Diff [4];

def overSoldRSI = RSI <= 32;
def overSoldRSIHeavy = RSI <= 30 and Diff < 0 and (close < close[7]);
def TrendReversalalert = (twoBarPivotMACD and Highest(overSoldRSI, 6) > 0) / 3;
plot TrendReversal = (twoBarPivotMACD and Highest(overSoldRSI, 6) > 0) / 3;
Alert(TrendReversalalert, "Buy Alert");
plot TrendReversal1 = (twoBarPivotMACD and Highest(overSoldRSIHeavy, 6) > 0) / 1.2;


TrendReversal.SetDefaultColor(GetColor(4));#yellow
TrendReversal1.SetDefaultColor(GetColor(6));#green

AddLabel(yes, if  TrendReversal > 0 then "Buy" else "");
Alert( TrendReversalalert > 0,  "Chart is now Oversold ", Alert.BAR, Sound.Ring);
AddLabel(TrendReversalalert > 0
, "Chart is now Oversold ", Color.LIME);
#-----------------------Overbought
def twoBarPivotMACD1 = Diff < Diff[1] and Diff[1] < Diff[2] and Diff[2] > Diff[3] and Diff[3] > Diff [4];

def overboughtRSI = RSIAvg3 >= 65 and Diff > 0;
def TrendReversalalert20 = (twoBarPivotMACD1 and Highest(overboughtRSI[1], 7) > 0);
plot TrendReversal20 = 1 - (((RSIAvg3 >= 68 and RSI < RSIAvg3[2]) and RSI3OverBoughtpivit)/ 1.5) ;
plot TrendReversal20a = 1 - ((((RSIAvg3 >= 60 and RSIAvg3 < 68 )and RSI < RSIAvg3[2]) and RSI3OverBoughtpivit) / 4) ;

TrendReversal20.SetDefaultColor(GetColor(5)); #Red
TrendReversal20a.SetDefaultColor(GetColor(2)); #lt Red
plot TrendReversal50 = 1 - ((RSIAvg5 >= 70 and close < MAvgExp14) / 2) ;
TrendReversal50.SetDefaultColor(GetColor(0)); #Red
AddLabel(yes, if  TrendReversal20 < 1 then "Sell" else "");
Alert( TrendReversal20 < 1 ,  "Chart is now Overbought ", Alert.BAR, Sound.Ring);
AddLabel(TrendReversal20 < 1, "Chart is now Overbought ", Color.LIME);
input show_label = yes;
input show_bubble = no;
#--------------------------- Large 5X and 10X Volume Alert
input AverageLength = 100;
input VolumeMultiplier = 8;
input VolumeMultiplier2 = 5;
input MinutesAfterOpen = 30;

def AvgVol = Average(volume, AverageLength);
def VolX = (volume > AvgVol * VolumeMultiplier) ;
def Vol10X = (volume > AvgVol * 10) ;

Alert(VolX, Concat(GetSymbolPart(), " has a large volume spike." ), Alert.BAR, Sound.Chimes);
AddLabel(VolX > 0,  " Has 5X Volume Spike ", Color.LIGHT_GREEN);
Alert(Vol10X, Concat(GetSymbolPart(), " has a large volume spike." ), Alert.BAR, Sound.Chimes);
AddLabel(Vol10X > 0,  " Has 10X Volume Spike ", Color.LIGHT_GREEN);
#-------------------------------------GAP UP Price
def IsUp = close > open;
def IsDown = close < open;
def IsDoji = IsDoji();
def avgRange = 0.05 * Average(high - low, 20);
def GapUp =
    IsUp[1] and
    IsUp[0] and
    high[1] < low[0] and
    high[1] < open[0] and
(volume > AvgVol * 5) ;
Alert(GapUp, Concat(GetSymbolPart(), " GAPUP" ), Alert.BAR, Sound.Ring);
AddLabel(GapUp > 0,  " GAP Up  ", Color.LIGHT_GREEN);

#---------------------------------Large Price change 3%
def Priceup =
    IsUp[1] and
    IsUp[0] and
    high[1] < high[0] and
    high[2] * 1.02 < high[0] and
    high[3] * 1.03 < high[0] and
(volume > AvgVol * 3) ;
Alert(Priceup, Concat(GetSymbolPart(), " Price JUMP" ), Alert.BAR, Sound.Bell);
AddLabel(Priceup > 0,  " Price JUMP  ", Color.CYAN);

#---------------------------------HugePrice change 6%
def Priceup2 =
    IsUp[1] and
    IsUp[0] and
    high[1] < high[0] and
    high[3] * 1.04 < high[0] and
    high[4] * 1.06 < high[0] and
(volume > AvgVol * 3) ;
Alert(Priceup2, Concat(GetSymbolPart(), " JUMP! JUMP! JUMP" ), Alert.BAR, Sound.Chimes);
AddLabel(Priceup2 > 0,  " JUMP! JUMP! JUMP  ", Color.LIGHT_RED);

#-----------------------------------------------------------------------------------------
#--------------------------RSI cumulative running total
def MAvgExp7 = ExpAverage(price[-displace], 7);
def RSICalc = 50 * (ChgRatio + 1);
def RSICalc1 = if RSI > 70 then  3 else if RSI < 30 then  -3 else 0;
def RSICalc2 = if RSI[1] > 70 then  2 else if RSI[1] < 30 then  -2 else 0;
def RSICalc3 = if RSI[2] > 70 then  1 else if RSI[2] < 30 then  -1 else 0;
def RSICalc4 = if RSI[3] > 70 then  1 else if RSI[3] < 30 then  -1 else 0;
def RSICalc5 = if RSI[4] > 70 then  1 else if RSI[4] < 30 then  -1 else 0;
def RSICalc6 = if RSI[5] > 70 then  1 else if RSI[5] < 30 then  -1 else 0;
def RSICalc7 = if RSI[6] > 70 then  1 else if RSI[6] < 30 then  -1 else 0;
def RSICalc8 = if RSI[7] > 70 then  1 else if RSI[7] < 30 then  -1 else 0;
def RSICalc9 = if RSI[8] > 70 then  1 else if RSI[8] < 30 then  -1 else 0;
def RSICalc10 = if RSI[9] > 70 then  1 else if RSI[9] < 30 then  -1 else 0;
def RSICalc11 = if RSI[10] > 70 then  1 else if RSI[10] < 30 then  -1 else 0;
def RSICalc12 = if RSI[11] > 70 then  1 else if RSI[11] < 30 then  -1 else 0;
def RSICalc13 = if RSI[12] > 70 then  1 else if RSI[12] < 30 then  -1 else 0;
def RSICalc14 = if RSI[13] > 70 then  1 else if RSI[13] < 30 then  -1 else 0;
def RSICalc15 = if RSI[14] > 70 then  1 else if RSI[14] < 30 then  -1 else 0;
def RSICalc16 = if RSI[15] > 70 then  1 else if RSI[15] < 30 then  -1 else 0;
def RSICalc17 = if RSI[16] > 70 then  1 else if RSI[16] < 30 then  -1 else 0;
def RSICalc18 = if RSI[17] > 70 then  1 else if RSI[17] < 30 then  -1 else 0;
def RSICalc19 = if RSI[18] > 70 then  1 else if RSI[18] < 30 then  -1 else 0;
def RSICalc20 = if RSI[19] > 70 then  1 else if RSI[19] < 30 then  -1 else 0;
def RSICalc21 = if RSI[20] > 70 then  1 else if RSI[20] < 30 then  -1 else 0;
def RSICalc22 = if RSI[21] > 70 then  1 else if RSI[21] < 30 then  -1 else 0;
def RSICalc23 = if RSI[22] > 70 then  1 else if RSI[22] < 30 then  -1 else 0;
def RSICalc24 = if RSI[23] > 70 then  1 else if RSI[23] < 30 then  -1 else 0;
def RSICalc25 = if RSI[24] > 70 then  1 else if RSI[24] < 30 then  -1 else 0;
def RSICalc26 = if RSI[25] > 70 then  1 else if RSI[25] < 30 then  -1 else 0;
def RSICalc27 = if RSI[26] > 70 then  1 else if RSI[26] < 30 then  -1 else 0;
def RSICalc28 = if RSI[27] > 70 then  1 else if RSI[27] < 30 then  -1 else 0;
def RSICalc29 = if RSI[28] > 70 then  1 else if RSI[28] < 30 then  -1 else 0;
def RSICalc30 = if RSI[29] > 70 then  1 else if RSI[29] < 30 then  -1 else 0;

def RSI30DayAvg = RSICalc1 + RSICalc2 + RSICalc3 + RSICalc4 + RSICalc5 + RSICalc6 + RSICalc7 + RSICalc8 + RSICalc9 + RSICalc10 + RSICalc11 + RSICalc12 + RSICalc13 + RSICalc14 + RSICalc15 + RSICalc16 + RSICalc17 + RSICalc18 + RSICalc19 + RSICalc20 + RSICalc21 + RSICalc22 + RSICalc23 + RSICalc24 + RSICalc25 + RSICalc26 + RSICalc27 + RSICalc28 + RSICalc29 + RSICalc30;
AddLabel(RSI30DayAvg >= 10 and RSI30DayAvg < 20, " RSI SELL: " + RSI30DayAvg + "   ",  Color.ORANGE);
AddLabel(RSI30DayAvg >= 20, " RSI SELL: " + RSI30DayAvg + "   ",  Color.RED);
AddLabel(RSI30DayAvg <= -10 and RSI30DayAvg > -20, " RSI BUY: " + RSI30DayAvg + "   ",  Color.LIME);
AddLabel(RSI30DayAvg <= -20, " RSI BUY: " + RSI30DayAvg + "   ",  Color.DARK_GREEN);
plot TrendReversal5 = 1 - (((RSI30DayAvg >= 10 and RSI30DayAvg < 15) and close < MAvgExp7) / 2) ;
TrendReversal5.SetDefaultColor(GetColor(0)); #magenta
plot TrendReversal5a = 1 - (((RSI30DayAvg >= 16  and RSI30DayAvg < 25) and close < MAvgExp7) / 1.3) ;
TrendReversal5a.SetDefaultColor(GetColor(0)); #magenta
plot TrendReversal5b = 1 - ((RSI30DayAvg >= 25 and close < MAvgExp7) / 1.05) ;
TrendReversal5b.SetDefaultColor(GetColor(0)); #magenta
plot TrendReversal6 = ((RSI30DayAvg <= -15 and close > MAvgExp7 ) * .3) ;
TrendReversal6.SetDefaultColor(GetColor(6)); #green
plot TrendReversal6a = (((RSI30DayAvg <= -20 and RSI30DayAvg > -30) and close > MAvgExp7) * .85) ;
TrendReversal6a.SetDefaultColor(GetColor(6)); #green
#End Code

SPY.jpg
I'm checking it out on the oil futures market /cl.On the 15 minute chart for /CLN21, it shows a buy signal at 2:15AM on 13 MAY 21 at 65.23 and another 7:00AM at 64.39. That's a pretty sizeable drawdown of $840 per contract. Also, shows a smaller (yellowish) buy signal at 9:45AM at 64.56. There are no sell signals in between any of the buy signals. Do you hold it through no matter the drawdown or are you putting a stop loss at some point? I've looked at it on some individual stocks and on some it performs great regardless if they are in an up/down trend, on others not so much. Do you think it works best on the basket of stocks you are using versus the overall market? I just checked it out today and went back through timeframes to see what the performance looked like. Some had serious drawdowns, but recovered for a profit by the time a sell signal came along. Some of those drawdowns might be tough to stomach. I think knowing what the drawdown for a strategy is might help people better understand the strategy unless this is buy and sell on signals only.
 
Last edited:
I'm checking it out on the oil futures market /cl.On the 15 minute chart for /CLN21, it shows a buy signal at 2:15AM on 13 MAY 21 at 65.23 and another 7:00AM at 64.39. That's a pretty sizeable drawdown of $840 per contract. Also, shows a smaller (yellowish) buy signal at 9:45AM at 64.56. There are no sell signals in between any of the buy signals. Do you hold it through no matter the drawdown or are you putting a stop loss at some point? I've looked at it on some individual stocks and on some it performs great regardless if they are in an up/down trend, on others not so much. Do you think it works best on the basket of stocks you are using versus the overall market? I just checked it out today and went back through timeframes to see what the performance looked like. Some had serious drawdowns, but recovered for a profit by the time a sell signal came along. Some of those drawdowns might be tough to stomach. I think knowing what the drawdown for a strategy is might help people better understand the strategy unless this is buy and sell on signals only.
Hi FreefallJM03,
Not to put words in DeepWater's mouth, but from our previous conversations, I believe the intention is to scale into positions while price is in downtrend and take profits when in the uptrend. You probably will not see many mean reversion exits while price is in a downtrend, however scaling into positions is a very sound strategy depending on your trading style, time horizon and so on. If you don't mind some pain, the gains will generally be there with a little patience.
 
Hi FreefallJM03,
Not to put words in DeepWater's mouth, but from our previous conversations, I believe the intention is to scale into positions while price is in downtrend and take profits when in the uptrend. You probably will not see many mean reversion exits while price is in a downtrend, however scaling into positions is a very sound strategy depending on your trading style, time horizon and so on. If you don't mind some pain, the gains will generally be there with a little patience.
That would explain the continuous buy signals as the bars continue downtrending. That's quite a bit of pain to have $1000-1500 drawdowns in the oil markets. I generally won't take more than $150 loss let alone that much of a drawdown with no sell signals. I'll have to watch it work for awhile to get a better understanding of it to see if I can use it without that much pain. I like moderately small stop losses to prevent such drastic drawdowns or worse potential losses. Thanks for the reply though. Thus far the best strategy for me has just been watching the chart for the right price/volume action to buy in. Only indicator I've had any real success with is the reversal indicator, but I only use that as a guide rather than an actual entry/exit.
 
i guess i'd say that in your case oil ain't the right market for this particular study. seems pretty obvious, right?
 
That would explain the continuous buy signals as the bars continue downtrending. That's quite a bit of pain to have $1000-1500 drawdowns in the oil markets. I generally won't take more than $150 loss let alone that much of a drawdown with no sell signals. I'll have to watch it work for awhile to get a better understanding of it to see if I can use it without that much pain. I like moderately small stop losses to prevent such drastic drawdowns or worse potential losses. Thanks for the reply though. Thus far the best strategy for me has just been watching the chart for the right price/volume action to buy in. Only indicator I've had any real success with is the reversal indicator, but I only use that as a guide rather than an actual entry/exit.
You may consider trying out either my Confirmation Candles or my CC Candles. Both of these are better suited to your trading style. https://usethinkscript.com/threads/confirmation-candles-indicator-for-thinkorswim.6316/. It does extremely well at calling out the trend and showing entry and exits (imo).
gLKTFdP.png
 
You may consider trying out either my Confirmation Candles or my CC Candles. Both of these are better suited to your trading style. https://usethinkscript.com/threads/confirmation-candles-indicator-for-thinkorswim.6316/. It does extremely well at calling out the trend and showing entry and exits (imo).
gLKTFdP.png
This looks pretty good if it doesn't repaint much. It gives an immediate sell signal if you get a false buy signal (a buy followed by a sell) so you can get out of a trade quick with a small loss rather than the ride the wave to the bottom. I'm not much for the averaging down or scaling as some call it. I see that often as throwing good money after bad. A friend of mine does it quite well, but he hurls about $5000 to 10,000 into each block he buys. I've seen him buy $100K worth of stock buying in at increments like that. Any time I've attempted scaling the stock or futures continue falling. I'm going to check this out for a few weeks and see how it does. Looking over the charts history it looks like it works pretty well. I don't see any of the clouds form for buy/sell though, I only see the up/down arrows.
 
This looks pretty good if it doesn't repaint much. It gives an immediate sell signal if you get a false buy signal (a buy followed by a sell) so you can get out of a trade quick with a small loss rather than the ride the wave to the bottom. I'm not much for the averaging down or scaling as some call it. I see that often as throwing good money after bad. A friend of mine does it quite well, but he hurls about $5000 to 10,000 into each block he buys. I've seen him buy $100K worth of stock buying in at increments like that. Any time I've attempted scaling the stock or futures continue falling. I'm going to check this out for a few weeks and see how it does. Looking over the charts history it looks like it works pretty well. I don't see any of the clouds form for buy/sell though, I only see the up/down arrows.
As long as showcloud is set to yes, they will show up. Let me know if that doesn't work.
YliFBJ7.png
 
As long as showcloud is set to yes, they will show up. Let me know if that doesn't work.
YliFBJ7.png
IT shows up on stocks, but I haven't seen it show up on a futures contract for /CL as of yet. I only went back about 20 days on the hourly chart and about 5 days on the 15 minute chart and maybe 3 days on five minute chart. I'm going to watch how it works for two weeks and see how it does. On stocks it seems to work pretty well as the clouds show up along with the up/down signals.
 
IT shows up on stocks, but I haven't seen it show up on a futures contract for /CL as of yet. I only went back about 20 days on the hourly chart and about 5 days on the 15 minute chart and maybe 3 days on five minute chart. I'm going to watch how it works for two weeks and see how it does. On stocks it seems to work pretty well as the clouds show up along with the up/down signals.
I am able to see it on all futures I have tested so far. Here is the 5 min chart for /CL today. Are you still having issues with clouds not showing?
D7bPNGo.png
 
I am able to see it on all futures I have tested so far. Here is the 5 min chart for /CL today. Are you still having issues with clouds not showing?
D7bPNGo.png
The clouds are showing up now. Not sure what the issue was before. This works well thus far combined with my own strategy. The one thing is really helps me do is focus when the "look to buy" or "look to sell" label lights up. I also notice that if the "breakout" is lit up it seems to drive the train. I really do like the labels lighting up because it grabs your attention to what the price/volume action may be alerting you to. I still use my own stops, but I can get a pretty solid idea thus far from the various indicators, primarily the labels once I've entered a trade. While it does repaint, the labels can still tell you the story you may need. At least that's what I am seeing thus far during the trial with it. Have to see how it works over several weeks, particularly when the market gets really choppy. Thus far though it is looking really good. Biggest thing as always is finding your stops and exits. I think after using this a few weeks it could become the only indicator I use once I figure out some patterns in how it operates in different conditions. You should make a powerpoint type presentation explaining some of the details like the red/green dots which I think are sort of like warnings of which direction it might break next before an arrow occurs. I cleared pretty much everything else off my charts for this one. Thanks for the hard work on this!
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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