
//Long Entry
if time >= 845 and time <= 1430
and low cross under Xaverage(close,20) 
and close > Xaverage(close,20)
and ADX(14) >= 30
then buy this bar on close;

//Long Exit
if time = 1500
and marketposition = 1
then sell this bar on close;


//Short Entry
if time >= 845 and time <= 1430
and high cross over Xaverage(close,20) 
and close < Xaverage(close,20) 
and ADX(14) >= 30
then sellshort this bar on close;

//Short Exit
if time = 1500
and marketposition = -1
then buytocover this bar on close;




