gaosng
New member
Hi guys,
I find my moving average on charts does not show up if the bars are less than the days counted.
Example:
plot XMA200 = MovingAverage( AverageType.SIMPLE, price, 200);
if the stock has less than 200 bars the indicator will not show up, i would like the following code to hide this indicator so it does not affect the other function in the script.
This code shows error, what is the right way to code this?
plot XMA200 = if BarNumber() > 200 { XMA20 } else { double.NaN };
I find my moving average on charts does not show up if the bars are less than the days counted.
Example:
plot XMA200 = MovingAverage( AverageType.SIMPLE, price, 200);
if the stock has less than 200 bars the indicator will not show up, i would like the following code to hide this indicator so it does not affect the other function in the script.
This code shows error, what is the right way to code this?
plot XMA200 = if BarNumber() > 200 { XMA20 } else { double.NaN };