Can someone add an IF THEN Statement to my code
I only want it to execute if the current price is within 10% of the 200SMA on the daily chart.
Something like this but I dont know the syntax...
IF current price is within 10% of the 200SMA then
# This puts the 200SMA for the daily on the 1 min chart
input Period = AggregationPeriod.DAY;
input AvgType = AverageType.SIMPLE;
input Length = 200;
plot AVG = MovingAverage(AvgType, close(period = Period), Length);
AVG.SetDefaultColor(Color.YELLOW);
I only want it to execute if the current price is within 10% of the 200SMA on the daily chart.
Something like this but I dont know the syntax...
IF current price is within 10% of the 200SMA then
# This puts the 200SMA for the daily on the 1 min chart
input Period = AggregationPeriod.DAY;
input AvgType = AverageType.SIMPLE;
input Length = 200;
plot AVG = MovingAverage(AvgType, close(period = Period), Length);
AVG.SetDefaultColor(Color.YELLOW);