Trading times impossible to set
Forums › ProRealTime English forum › ProOrder support › Trading times impossible to set
- This topic has 4 replies, 3 voices, and was last updated 6 years ago by
Lorenzo47.
-
-
06/04/2018 at 3:08 PM #72248
Hi everyone,
I’m today facing a problem I can’t explain… In order to set trading times with ProBuilder, I usually use this code which works for me:
For instance1234567// x is a value returned at the endMyCondition = Time < 090000 AND Time > 190000IF MyCondition THENx = 0ENDIFRight here, I believe we’ll all agree, but in my code I can’t set these “time preferences” (not before 090000 and not after 190000). I can let it run during the night very easily (from 190000 to 090000), or if I set the values I want, then it seems to ignore them.. There’s a mistake somewhere and if anyone could help me it would be amazing!
Here’s my code “not caring” about my time preferences :
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748TradingTimes = 190000 < Time AND Time < 090000// Allowing tradingIF VolatilityConditions THENallows = 1ELSEallows = 0ENDIF// Long loopIF (x <> 0) AND (High < (x + 0.0012)) THENy = 0ELSEx = 0ENDIF// Short loopIF (y <> 0) AND (Low > (y - 0.0012)) THENx = 0ELSEy = 0ENDIFIF TradingTimes THENx = 0y = 0ELSEIF allows THEN// Long openingc1 = (pSAR[1] > High[1])c2 = (High > pSAR[1])IF c1 AND c2 THENx = pSAR[1]ENDIF// Short openingc3 = (pSAR[1] < Low[1])c4 = (Low < pSAR[1])IF c3 AND c4 THENy = pSAR[1]ENDIFENDIFENDIFRETURN x, yPS : I’m trying to build a strategy with this code as indicator, that’s why it might seem totally useless so far but I can’t start backtesting to improve it before fixing this time issue… (it’s obviously messing up all the startegy).
Thank you by advance for helping 🙂
06/04/2018 at 3:49 PM #72252The first part of line 1 should read TIME > 190000.
06/04/2018 at 3:58 PM #72255Hi Roberto,
Thank for your answer, it wouldn’t change anything. I don’t know why I wrote it like that in my post but in my code it’s written your way :
1TradingTimes = Time > 190000 AND Time < 090000Sorry for this mistake. I’ll be still waiting for your ideas 🙂
06/04/2018 at 4:23 PM #72257A variable can’t be simultaneously lower than 90000 and higher than 190000, even if in your mind it’s a continuous clock time ending at 240000 with continuity at 0, in the space of real numbers what your really want for night trading times is a subset made of 2 distinct intervals [0;090000] [190000;240000], so try replacing your “and” with “or”:
1TradingTimes = Time > 190000 OR Time < 0900001 user thanked author for this post.
06/04/2018 at 4:38 PM #72261Hello NoobyWan,
Thank you so much! It works perfectly! I think I’ve been working on it for too long, and I couldn’t see anything anymore. Thank you so much once again.
Btw, really nice username 😉
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on