Time entry condition with stop orders
Forums › ProRealTime English forum › ProOrder support › Time entry condition with stop orders
- This topic has 8 replies, 2 voices, and was last updated 3 years ago by robertogozzi.
-
-
02/02/2021 at 8:53 AM #160096
I have an algo with the following definition of opening times:
1Ctime = time >=080000 and time <163000the entry conditions are:
1234567891011if Ctime and not onmarket or longonmarket and cb1 and cb2 and barindex-tradeindex(1)>=LookbackPeriod thenBUY positionsize CONTRACTS AT highest[LookbackPeriod](high)+PointsDistance*pointsize STOPSET STOP pLOSS slSET TARGET %PROFIT tpendifif Ctime and not onmarket or shortonmarket and cs1 and cs2 and barindex-tradeindex(1)>=LookbackPeriod thenSELLSHORT positionsize CONTRACTS AT lowest[LookbackPeriod](low)-PointsDistance*pointsize STOPSET STOP pLOSS slSET TARGET %PROFIT tpsendifbut I find it is placing orders outside of the Ctime definition.
I presume this is due to the system placing Stop Orders – and if this is the case, is there any way to restrict a stop order to only work within that time definition?
02/02/2021 at 9:23 AM #160100The issue is in the icorrect placing of parentheses, try this:
12if Ctime and (not onmarket or longonmarket) and cb1 and cb2 and ((barindex-tradeindex(1))>=LookbackPeriod) thenif Ctime and (not onmarket or shortonmarket) and cs1 and cs2 and ((barindex-tradeindex(1))>=LookbackPeriod) then1 user thanked author for this post.
02/02/2021 at 9:26 AM #160103thanks Roberto, I’ll try that.
02/02/2021 at 10:05 AM #160106Hmm, one small problem – this completely destroys the performance. It goes from being highly successful to total disaster.
Is the way I originally had it seriously wrong? ie, giving false results?
02/02/2021 at 10:08 AM #160107No, it only enters outside your time range. If this is good for you, then it’s fine.
Bear in mind that outside that time range spreads may be higher (and rquired distances from price as well). This might impact peformance.
02/02/2021 at 10:48 AM #160111outside that time range spreads may be higher
Yes, this was the main problem. It works with a tiny stop loss of just 5 points, but overnight the DAX minimum goes up to 10 so orders get cancelled and then the system gets stopped.
But now I realize there’s a bigger problem: the way i originally had it doesn’t work anymore either. Last week it was fine, showing massive profit over 10 years, now it breaks the bank almost immediately – exact same code, unchanged. Unfortunately I didn’t keep a print of the results I was getting.
So the disaster is not due to the changes you suggested, but some weirdness in the PRT backtests.
I’ve attached the itf if anyone wants to make further tests because i have no idea what is going on here.
02/02/2021 at 11:29 AM #160124On DAX, 1-hour TF (200K bars), 2-pip spread, it’s not that bad! (it worked similarly on the 30-minute and 15-minute TF).
I used my modifications and reaplaced TIME with OPENTIME.
Bear in mind that 8-16:30 is a bit different for me, it’s 7-15:30 UK.
02/02/2021 at 12:25 PM #160135This is making my head spin – suddenly it tests ok again, with absolutely no changes! (v4)
Also with your change to the ( ) now works. The profit drops as expected due to the time limit, but still acceptable. (v5T)
Molto misterioso …
02/02/2021 at 1:51 PM #160141 -
AuthorPosts
Find exclusive trading pro-tools on