Open is specific percent above moving average


I tried but failed to create a script. Can you please help creating a script that show stocks on that are at least .90% or greater than the SMA60 day trend line? This will be for the Open price on 1min candlesticks.

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on February 28, 2021 10:12 pm
Private answer

I have adjusted the title of your question to reflect what I believe you have requested. Not sure I got it right. But it seems you want a scan that finds stocks that have opened at specified percent above a 60 period simple moving average.

This code has not been tested because you did not provide an example stock exhibiting this condition you have described.

input percentFromAverage = 0.9;
input comparisonPrice = open;
input maLengthOne = 60;
input maTypeOne = AverageType.SIMPLE;
input maPriceOne = close;
def maOne = MovingAverage(maTypeOne, maPriceOne, maLengthOne);
plot scan = comparisonPrice > maOne * (1 + percentFromAverage * 0.01);

Marked as spam
Posted by (Questions: 38, Answers: 3602)
Answered on March 1, 2021 8:20 am