Trying to utilize the SetHiding command but I'm having trouble. Id like the moving average to hide when the "Close" is above it. Im trying to incorporate this into a bigger study with multiple moving averages and as the close price crosses above them the idea is that they'd disappear off the screen.
I know I could use:
I just wanted to try to use SetHiding. Is it possible to do? Im able to use "SetHiding" with other condition's but for some reason when I use "Close" it doesn't recognize it.
I know I could use:
Code:
def AvgExp_Def = ExpAverage(price[-displace], length);
plot AvgExp = If close(pricetype.last) >= AvgExp_Def then double.nan else AvgExp_Def;
I just wanted to try to use SetHiding. Is it possible to do? Im able to use "SetHiding" with other condition's but for some reason when I use "Close" it doesn't recognize it.
Code:
input price = close;
input length = 9;
input displace = 0;
input showBreakoutSignals = no;
plot AvgExp = ExpAverage(price[-displace], length);
plot UpSignal = price crosses above AvgExp;
plot DownSignal = price crosses below AvgExp;
UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);
AvgExp.SetDefaultColor(GetColor(1));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
def Avg_HIDE = if close(pricetype.last) >= AvgExp then 1 else 0;
AvgExp.SetHiding(Avg_Hide);
Last edited: