Hi. can someone extend this study to the right and also is there a way to set alerts on it as if a candle crosses it?
Code:
#
# TD Ameritrade IP Company, Inc. (c) 2009-2020
#
input length = 14;
input price = close;
input rsiValue = 50;
input onExpansion = Yes;
input smoothingType = {default Wilders, EMA};
def coeff = rsiValue / (100 - rsiValue);
def chg = price - price[1];
def diff;
switch (smoothingType) {
case Wilders:
diff = (length - 1) * (WildersAverage(Max(-chg, 0), length) * coeff - WildersAverage(Max(chg, 0), length));
case EMA:
diff = (length - 1) * (ExpAverage(Max(-chg, 0), length) * coeff - ExpAverage(Max(chg, 0), length)) / 2;
}
def value = price + if diff >= 0 then diff else diff / coeff;
plot RevEngRSI = compoundValue(1, value[1], Double.NaN);
RevEngRSI.DefineColor("Up", GetColor(1));
RevEngRSI.DefineColor("Down", GetColor(0));
RevEngRSI.AssignValueColor(if RevEngRSI > RevEngRSI[1] then RevEngRSI.color("Up") else RevEngRSI.color("Down"));
Last edited by a moderator: