Hi all,
I’ve just relatively recently started running a few intraday trend following systems on US equites, generally they are performing ok, however more often than not they are getting whipped in the volatility at the US open, was just wondering if there is an easy way to strip out a period of the day, so the systems square up between say 14:00 – 15:00(BST) . Given I am using flat before/after code already for the close of day/reopen, I thought trying to use that code again is going to get messy. Any help appreciated.
Cheers,
Just add time condition to your entry conditions, for example:
defparam flatbefore= 090000
defparam flatafter= 220000
// Time Directions
t1= time>090000 and time<140000
t2= time>150000 and time<220000
te= time=140000
// Entry
if your conditions then
if t1 or t2 then
buy/sellshort n contract at market
endif
endif
// 14.00 Exit
if longonmarket and te then
sell at market
endif
if shortonmarket and te then
exitshort at market
endif
I added a casual flatbefore and flatafter, you have to change it with your favorite time.
Thanks Francesco, perfect!