JP782
Active member
Need some help to fix this double RSI Im getting an error msg. This code works but doesnt show the cross(which is the whole point of making the custom study) you see if you just run 2 RSI's w/diff lengths bc I cant change the ABSValue to ABSValueA for the 2nd RSI to differentiate from the 1st one
Suggestions??
Suggestions??
Code:
declare lower;
input length = 25;
input over_Bought = 70;
input over_Sold = 30;
input price = close;
input averageType = AverageType.WILDERS;
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;
plot RSI = 50 * (ChgRatio + 1);
RSI.setlineWeight(2);
RSI.setDefaultColor(color.black);
#
input lengthA = 100;
input over_BoughtA = 70;
input over_SoldA = 30;
input priceA = close;
input averageTypeA = AverageType.WILDERS;
def NetChgAvgA = MovingAverage(averageTypeA, priceA - priceA[1], lengthA);
def TotChgAvgA = MovingAverage(averageTypeA, AbsValue(priceA - priceA[1]), lengthA);
def ChgRatioA = if TotChgAvgA != 0 then NetChgAvgA / TotChgAvgA else 0;
plot RSI_ = 50 * (ChgRatioA + 1);
RSI_.setlineWeight(2);
RSI_.setDefaultColor(color.red);