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?
DEFPARAM CumulateOrders = False
if date>date[1] and dopen(0)>dclose(1) then
gap=1
else
gap=0
endif
if gap=1 then
Buy 1 contract at market
Endif
if longonmarket and time=170000 then
sell at market
endif
I 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/
Strange… In my case I cut off the price manually, hence I create the GAPs but PRT won’t understand them. I am just confused since the same approach works for the US market. Will contact PRT.
No 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.
ONCE entertime = 090000
tt1 = opentime >= entertime
tt2 = opentime <= entertime
tradetime = tt1 and tt2
ONCE closetime = 172500
if opentime >= closetime and opentime <= closetime then
lastcl = close
endif
If NOT LongOnMarket and tradetime and close > lastcl then
Buy 1 contract at market
endif
if longonmarket and time=closetime then
sell at market
endif
Seems to work now, it was somehow bugged, had to switch from 1 min TF to 5 min and then back again to reload the candles/data, then it suddenly started to work on the 1 min TF as intended…