Restrict hours to between 8:30 and 3:00 in code. I think fxshrat is planning on adding this.
See here for example http://www.amibroker.com/kb/index.php?s=timeok
tn = TimeNum();
startTime = 83000; // start in HHMMSS format
endTime = 150000; // end in HHMMSS format
timeOK = tn >= startTime AND tn <= endTime;
Buy = Cross( MACD(), Signal() ) AND timeOK;
Sell = (Cross( Signal(), MACD() ) AND timeOK) OR Cross( tn, endTime );
2 Likes
Would this go in strategy.afl?
If so, what line?