Time Functions not working?
Forums › ProRealTime English forum › ProOrder support › Time Functions not working?
- This topic has 14 replies, 4 voices, and was last updated 3 years ago by Mike.
-
-
06/13/2020 at 3:09 PM #135826
Hi
Can anyone see why this code won’t run. If I comment IN the defparams the code opens trades on the 1 minute time frame but nothing higher. If I comment the defparams out then no trades are opened.
I plagiarised “Morning CAC 40” from the library and it won’t open any trades either. I have had differing results on my Spreadbet and CFD accounts in the past. Neither will open any trades.
Thanks in advance
123456789101112DEFPARAM CumulateOrders = False//defparam flatbefore = 143000//defparam flatafter = 143300Stoplevel = SLProfitlevel = plIF time = 142950 THENSET STOP pLOSS StopLevelSET TARGET pPROFIT ProfitLevelSELLSHORT 10 perpoint at marketENDIF06/13/2020 at 4:06 PM #135828In your example you used 50 seconds, so only if a candle closes on that boundary (try on a 10-second TF).
If you use 142900 it’ll work on a 1-minute TF, if you use 142500 it’ll work also on a 5-minute TF, and so forth…
1 user thanked author for this post.
06/13/2020 at 4:09 PM #135829on the 1 minute time frame but nothing higher
That’s because you are using 143300 and so that time can only be met on a 1 min or less TF.
IF time = 142950 THEN
This means that your conditions must be met at that exact time else no trade.
1 user thanked author for this post.
06/13/2020 at 4:11 PM #13583006/13/2020 at 4:15 PM #135831Thanks GraHal
I thought my condition was the time of day, which must occur once every 24 hours, at which point I thought my trade would open. Again, I may have this wrong but I think “time” is supposed to relate to “real” time and “currenttime” is candles based.
It sounds like I can’t open a trade at this very specif time. Is that correct?
06/13/2020 at 4:36 PM #135836It sounds like I can’t open a trade at this very specif time. Is that correct?
I was wrong, you can open at that specific time.
I thought you have additional conditions, but now I see you haven’t.
See Roberto comment re use of 142950
1 user thanked author for this post.
06/14/2020 at 11:36 AM #135886Sorry, I had the “time” and “currenttime” functions reversed. It’s “currenttime” that is supposed to work independently of the candle/bar.
The code still opens no trades on the daily timeframe. It does, As Roberto suggested it would, open 1 trade at 142950 on the 10 second time frame. However, to reiterate, this seems to be acting like the “time” function” and not the “currenttime” function.
I have to imagine I can open a trade per day at a specific time…. Any further thoughts?
Many thanks
123456789101112DEFPARAM CumulateOrders = False//defparam flatbefore = 143000//defparam flatafter = 143300Stoplevel = SLProfitlevel = plIF currenttime = 142950 THENSET STOP pLOSS StopLevelSET TARGET pPROFIT ProfitLevelSELLSHORT 10 perpoint at marketENDIF06/14/2020 at 1:26 PM #135896As from Nicolas’ explanation in a comment to official documentation “CurrentTime is the one of the official timezone where the instrument is traded.”
So if you trade Nikkei and it’s 11am UTC+0 and the bar is labelled 100000, OPENTIME will return 100000 (opening time) TIME returns 110000 (closing time), CURRENTTIME will return 110000 + TZ difference for Japan.
1 user thanked author for this post.
06/14/2020 at 1:39 PM #135897Above added as Log 223 here …
I added the Comment … not code but worthy of logging here! 🙂
1 user thanked author for this post.
06/14/2020 at 1:45 PM #135898Thanks again Roberto – yes, I know I will have to offset the time zone difference and my understanding of CURRENTTIME is as you/Nicolas describe it. As a quick start I just wanted to get the code operational. I still don’t see why “currenttime” won’t trigger one trade every 24 hours. CURRENTTIME is acting like TIME. Is this a bug or am I just not getting it!?
To double check I tried this on the DAX and still no trades.
06/14/2020 at 1:46 PM #13589906/14/2020 at 2:32 PM #135900Code is read and decisions on orders made at the close of every candle. At this point the only times that the strategy can use are the ones at the open (OPENTIME) and at the close (TIME) of that candle. If you want a trade to open at time = 142950 then you must ensure that your chart has a candle that has a time of 142950.
06/14/2020 at 2:35 PM #135901Just trying to figure… maybe the trade is still open next day due to high TP or SL and no further entry is allowed.
1 user thanked author for this post.
06/14/2020 at 2:38 PM #13590206/14/2020 at 2:39 PM #135903 -
AuthorPosts
Find exclusive trading pro-tools on