germanburrito
Active member
After testing thousands of indicators the RSI indicator has gain it place on my chart for good. This indicator plots rsi on the upper chart as cloud between values 70 and 30.
Code:
input length = 14;
input price = close;
input rsiValue = 70;
input rsiValue2 = 80;
input rsiValue3 = 30;
input rsiValue4 = 20;
input smoothingType = {default Wilders, EMA};
def coeff = rsiValue / (100 - rsiValue);
def coeff2 = rsiValue2 / (100 - rsiValue2);
def coeff3 = rsiValue3 / (100 - rsiValue3);
def coeff4 = rsiValue4 / (100 - rsiValue4);
def chg = price - price[1];
def diff = (length - 1) * (WildersAverage(Max(-chg, 0), length) * coeff - WildersAverage(Max(chg, 0), length));
def diff2 = (length - 1) * (WildersAverage(Max(-chg, 0), length) * coeff2 - WildersAverage(Max(chg, 0), length));
def diff3 = (length - 1) * (WildersAverage(Max(-chg, 0), length) * coeff3 - WildersAverage(Max(chg, 0), length));
def diff4 = (length - 1) * (WildersAverage(Max(-chg, 0), length) * coeff4 - WildersAverage(Max(chg, 0), length));
def value = price + if diff >= 0 then diff else diff / coeff;
def value2 = price + if diff2 >= 0 then diff2 else diff2 / coeff2;
def value3 = price + if diff3 >= 0 then diff3 else diff3 / coeff3;
def value4 = price + if diff4 >= 0 then diff4 else diff4 / coeff4;
plot RevEngRSI = compoundValue(1, value[1], Double.NaN);
plot RevEngRSI2 = compoundValue(1, value2[1], Double.NaN);
plot RevEngRSI3 = compoundValue(1, value3[1], Double.NaN);
plot RevEngRSI4 = compoundValue(1, value4[1], Double.NaN);
revengRSI.SetDefaultColor(Color.red);
revengRSI2.SetDefaultColor(Color.red);
revengRSI3.SetDefaultColor(Color.green);
revengRSI4.SetDefaultColor(Color.green);
AddCloud(revengRSI,revengRSI2,Color.red);
AddCloud(revengRSI3,revengRSI4,Color.green);