how to delay an order in milliseconds
Forums › ProRealTime English forum › ProOrder support › how to delay an order in milliseconds
- This topic has 5 replies, 2 voices, and was last updated 5 years ago by
Paul.
-
-
10/05/2020 at 6:07 PM #146494
Hi,
Is it really possible to delay an order in milliseconds? Because this could be useful when testing similar strategies which open a trade in the same direction simultaneously. Possible that one gets rejected. By adding a time delay, like 100-500 ms in one strategy, the order is still opened in the same bar.
Could someone please advise how to code that correctly if even possible? Thanks.
12345678910111213141516171819202122// test dow 2s 10k bars spread 2,3defparam cumulateorders=falsedefparam flatbefore=000000defparam flatafter=220000ind1=Average[70](close)ind2=Average[40](totalprice)condbuy=ind2 crosses under ind1 and high<high[1]condsell=ind2 crosses over ind1 and low>low[1]if condbuy thenbuy 1 contract at marketendifif condsell thensellshort 1 contract at marketendifset stop %loss .1set target %profit .110/05/2020 at 6:18 PM #146499No, you can’t. There’s no provisions for planned delays.
You could only delay minimun 1 second, using MTF support and 1-second TF. You could delay each strategy with a defined different second unit (not tested):
Strategy A (enter at second 0)123456TIMEFRAME(1 hour,UodateOnClose)MyCondition = close CROSSES OVER Average[200,0](close)TIMEFRAME(Default)IF OpenSecond = 0 AND MyCondition THEN //Enter when second is 0BUY AT MARKETENDIFStrategy B (enter at second 1)123456TIMEFRAME(1 hour,UodateOnClose)MyCondition = close CROSSES OVER Average[200,0](close)TIMEFRAME(Default)IF OpenSecond = 1 AND MyCondition THEN //Enter when second is 1BUY AT MARKETENDIFyour next similar strategy on the same instrument could use second 2.
If 1 second difference is too high, then you have to give up. If it’s too little you can set the delay to a multiple of 1.
10/05/2020 at 6:24 PM #146500Sorry, use CurrentSecond (OpenSecond does not exist), but there’s no guarantee there’s a bar each second.
10/05/2020 at 6:37 PM #14650310/05/2020 at 6:50 PM #146505Thanks robertogozzi. Yeah when there’s no bar the next second is another problem of it’s own. I will give your code a try.
10/07/2020 at 4:24 AM #146608So the goal was to have identical strategies running the same index in the same direction more correctly for the entry.
“ve tested it for a day and it seemed in general to work fine.
Strategy running on 1 sec, with mtf using 2s. When a signal comes, entry is on the first sec and in another strategy entry is on the second sec.
Also tested the difference with and without updateonclose.
If there’s no bar on the one second timeframe hopefully the order will be repeated at first or later rejected. Not completely sure about that.
Another way to avoid conflict is using 1€, 2$ and 10$ charts I guess, still this was an interesting experiment.
Here’s the test file for anyone interested.
-
AuthorPosts
Find exclusive trading pro-tools on