Code to exclude extended hours for SMA on a 10minute chart going back 500 lengths?

T

Thebtrader

New member
VIP
Would this work?

def isopen=if secondsFromTime(0930)>=0 and secondstillTime(1600)>=0 then 1 else 0;

Plot SMA = if isopen = 1 then SimpleMovingAvg(Close,500,0,no) else 0;
 
Top