NY, NY
Posts: 68 since Dec 2011
Thanks Given: 27
Thanks Received: 19
|
I'm having trouble trying to programmatically add a custom colored "cloud"
a/k/a fill to an RSI study to highlight overbought and oversold conditions as shown below...
FYI, I have been able to successfully plot the shaded overbought (>95) and oversold(<5)
conditions, but I am unable to remove the the unwanted shading between 95 and 5...
Any help/assistance would be greatly appreciated. Thanks in advance...
declare lower;
declare zerobase;
input RSIlength = 2;
input priceH = high;
input priceL = low;
input priceC = close;
input smoothingType = 1;
input over_bought = 95;
input over_sold = 5;
def sf = 1 / RSIlength;
def NetChgAvg = Ema2(data = priceC - priceC[1], prefetch = RSIlength, "smoothing factor" = sf);
def TotChgAvg = Ema2(data = AbsValue(priceC - priceC[1]), prefetch = RSIlength, "smoothing factor" = Sf);
def ChgRatio = if TotChgAvg != 0 then
NetChgAvg / TotChgAvg
else
0;
plot RSI = 50 * (ChgRatio + 1);
RSI.SetDefaultColor(CreateColor(0, 102, 204));
RSI.SetLineWeight(2);
plot OverBought = over_bought;
#OverBought.SetDefaultColor(GetColor(4));
OverBought.hide();
AddCloud(RSI, over_bought, Color.red, Color.red);
plot OverSold = over_sold;
#OverSold.SetDefaultColor(GetColor(4));
OverSold.hide();
AddCloud(RSI, over_sold, Color.red, Color.red);
|