BULLFIZZ
Member
- Platform
-
- Thinkorswim
Hi guys, i found something intresting and wanted to share with the community.. video and indicator link is below
#
# TD Ameritrade IP Company, Inc. (c) 2007-2022
#
# Modified by TOS Indicators
#Home of the Volatility Box
#Indicator: Rate of Change x RSI
#Code written in 2022
#Full Tutorial: https://www.tosindicators.com/indicators/rate-of-change
# Modified by Barbaros to add candle colors
declare lower;
input length = 14;
input colorNormLength = 14;
input price = close;
input colorBars = yes;
assert(length > 0, "'length' must be positive: " + length);
plot ROC = if price[length] != 0 then (price / price[length] - 1) * 100 else 0;
plot ZeroLine = 0;
ROC.DefineColor("Highest", Color.YELLOW);
ROC.DefineColor("Lowest", Color.LIGHT_RED);
ROC.AssignNormGradientColor(colorNormLength, ROC.color("Lowest"), ROC.color("Highest"));
ZeroLine.SetDefaultColor(GetColor(5));
plot highestROC = HighestAll(ROC);
plot lowestROC = LowestAll(ROC);
plot midPtHighestROC = highestROC/2;
plot midPtLowestROC = lowestROC/2;
highestROC.setLineWeight(3);
lowestROC.setLineWeight(3);
highestROC.setDefaultColor(Color.Red);
lowestROC.setDefaultColor(Color.Green);
midPtHighestROC.setLineWeight(1);
midPtLowestROC.setLineWeight(1);
midPtHighestROC.setStyle(Curve.Short_Dash);
midPtLowestROC.setStyle(Curve.Short_Dash);
midPtHighestROC.setDefaultColor(Color.light_red);
midPtLowestROC.setDefaultColor(Color.light_green);
def extremeHigh = ROC < HighestROC and ROC >= midPtHighestROC;
def extremeLow = ROC > LowestROC and ROC <= midPtLowestROC;
def RSIUpSignal = RSI().upSignal;
def RSIDownSignal = RSI().downSignal;
def ROCUpSignal = extremeLow and (ROC > ROC[1]);
def ROCDownSignal = extremeHigh and (ROC < ROC[1]);
plot bullSignal = if ROCUpSignal and RSIUpSignal then ROC else double.nan;
plot bearSignal = if ROCDownSignal and RSIDownSignal then ROC else double.nan;
bullSignal.setPaintingStrategy(PaintingStrategy.Arrow_Up);
bullSignal.setDefaultColor(Color.Green);
bullSignal.setLineWeight(3);
bearSignal.setPaintingStrategy(PaintingStrategy.Arrow_Down);
bearSignal.setDefaultColor(Color.Red);
bearSignal.setLineWeight(3);
#AddChartBubble(RSIUpSignal, ROC, RSIUpSignal, color.yellow);
def hh = Highest(roc, colorNormLength);
def ll = Lowest(ROC, colorNormLength);
def colorPerc = (ROC - ll) / (hh - ll);
# color2: rgb(173, 255, 47)
# color1: rgb(255, 0, 0)
def resultRed = 255 + colorPerc * (173 - 255);
def resultGreen = 0 + colorPerc * (255 - 0);
def resultBlue = 0 + colorPerc * (47 - 0);
AssignPriceColor(if !colorBars then Color.CURRENT else CreateColor(resultRed, resultGreen, resultBlue));