Custom trading hours won't work with dopen/dclose
Forums › ProRealTime English forum › ProRealTime platform support › Custom trading hours won't work with dopen/dclose
- This topic has 4 replies, 2 voices, and was last updated 3 years ago by mykologen.
-
-
07/05/2020 at 8:03 PM #138488
Hi!
I have been using GAP-strategies (SPTRD/USA500) with custom trading hours for the US market UTC+1 (14:30-21:00 + enabled the Daily data option) without any issues.
Now I am taking the same approach for Swedish market open UTC (08:00-16:30 + enable daily data) and this won’t work as intended. The candles/price is cut off in the right way on my chart but the strategy doesn’t work properly. It will for example trade even though the open-price is not above previous close. It seems to work if I restrict the time from 10:00-16:30 but then the data is of course incorrect. Attached my settings and a trade that shouldn’t happen.
Any idea what might be wrong?
123456789101112131415DEFPARAM CumulateOrders = Falseif date>date[1] and dopen(0)>dclose(1) thengap=1elsegap=0endifif gap=1 thenBuy 1 contract at marketEndifif longonmarket and time=170000 thensell at marketendif07/05/2020 at 9:20 PM #138495I haven’t digested all you say, but a couple of other members on here have made comments about Gap Strategies not working recently.
Link below
https://www.prorealcode.com/topic/prt-not-showing-gaps/
07/06/2020 at 9:00 PM #13859207/11/2020 at 9:28 AM #138992No answer from PRT but found out that on the 5 min TF code below will work properly. However on the 1-4 min TF neither does my first code or this one work as intended, I am clueless.
1234567891011121314151617ONCE entertime = 090000tt1 = opentime >= entertimett2 = opentime <= entertimetradetime = tt1 and tt2ONCE closetime = 172500if opentime >= closetime and opentime <= closetime thenlastcl = closeendifIf NOT LongOnMarket and tradetime and close > lastcl thenBuy 1 contract at marketendifif longonmarket and time=closetime thensell at marketendif07/11/2020 at 10:52 AM #138996 -
AuthorPosts