Display Cloud between EMA & Reverse Eng RSI 50


Category:
0
0

Hello Hahn,

Hope everything is going well! My revengrsi code seems to be incorrect, I want to display the reverse engineer rsi 50 line, could you please help me? Thank you so much for your help!

plot ema28 = movAvgExponential(close, 28);
plot RevEngRSI = compoundValue(50, value[50], Double.NaN);
AddCloud(ema28, RevEngRSI, Color.CYAN, Color. MAGENTA);

Marked as spam
Posted by (Questions: 9, Answers: 4)
Asked on March 5, 2021 12:47 pm
101 views
0
Private answer

The main fault in your code is that it does not even attempt to plot the ReverseEngineeringRSI.

Specifically, the line of code you label as RevEngRSI does not compute anything at all.

plot RevEngRSI = compoundValue(50, value[50], Double.NaN);

In fact if you try to load your code into a new chart study it will generate an error because you are trying to reference an undeclared variable named "value".

In order to plot the ReverseEngineeringRSI you need to include all of the code from that chart study along with lines of code to compute the moving average and then one more line of code to add the shading between those two plots.

The following section of code will provide a chart study that performs as you have requested:

input maLengthOne = 28;
input maTypeOne = AverageType.EXPONENTIAL;
input maPriceOne = close;
input length = 14;
input price = close;
input rsiValue = 50.0;
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);
plot maOne = MovingAverage(maTypeOne, maPriceOne, maLengthOne);
AddCloud(maOne, RevEngRSI, Color.CYAN, Color.MAGENTA);

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on March 5, 2021 1:13 pm