Cannot get daily close price

qinking127

New member
I try to build a scanner. want to find stocks that cross 8ema or 20ema.

I am getting "Secondary period not allowed: Day." If I remove "period = AggregationPeriod.DAY" from the first line. it will work. but i want to make sure I am using daily closing price.

Code:
def closePrice = close(period = AggregationPeriod.DAY);
def ma8 = MovAvgExponential(closePrice, 8);
def ma20 = MovAvgExponential(closePrice, 20);
def s1 = ma8 * 0.005;
def r1 = AbsValue(close - ma8) <= s1;

def s2 = ma20 * 0.005;
def r2 = AbsValue(close - ma20) <= s2;

plot scan = r1 or r2;
 

Similar threads

Top