Slow order management automated trading 1 second timeframe
Forums › ProRealTime English forum › ProRealTime platform support › Slow order management automated trading 1 second timeframe
- This topic has 25 replies, 5 voices, and was last updated 10 months ago by pointofbrew.
-
-
01/18/2024 at 4:04 PM #226523
Good day.
I’m testing the responsiveness of the platform for automated trading with IG.
I’m simply placing stop orders at specific times on the 1 second timeframe in the DAX to see how quickly they’re cancelled.
E.g. If I place a stop order on the 1-second timeframe at time = 113000, I expect that order to be cancelled at 113001 if not filled.
But, that is not the case at all. I’ve ran a few tests by now, and I notice that orders are deleted after 1 second maybe 30% of the time, while the rest may need 2-3 seconds before cancellation. A few times it even took 5 and 6 seconds, according to the order list.
I’m seeing orders being filled 3 seconds after the order in fact should have been cancelled. In backtesting none of these orders are triggered, but in practice they very much are.
Are these delays well known? And if so, is it due to PRT servers, IG or both?
01/18/2024 at 4:06 PM #22652401/18/2024 at 4:09 PM #226526Sorry, should have mentioned … Both live and in demo.
The one I’m referring to here was live, today. “I’m seeing orders being filled 3 seconds after the order in fact should have been cancelled”
01/18/2024 at 4:15 PM #226528Hmm … This is not something I recognize. But that does not tell anything. 🙂
May we ask for a (consistent) sample code snippet so we can see what you actually attempt ?N.b.: I am used to “seconds” TF systems, but lately they are mere 1 minute systems. Still the responsiveness I see visually, looks immediate to me. For IG that is (IB is a bit of a different story). BUT … this is then about pending orders which move price. So this is not exactly what you are saying …
01/18/2024 at 6:14 PM #226538There is not much more to say, really …
I’m placing stop orders completely randomly at random times to test the responsiveness of the platform. And what I’ve found is that you really need to keep in mind that on a 1-second timeframe (and perhaps other timeframes as well) orders might be placed even though your conditions are not true, because of what seems to be multiple second delays between PRT and IG.
I’m using tests like the one below just to see how quickly the orders are cancelled.
123456789DEFPARAM CumulateOrders = falseIF not onmarket THENIF time = 180800 or time = 180805 or time = 180810 or time = 180815 or time = 180820 or time = 180825 or time = 180830 or time = 180835 or time = 180840 or time = 180845 or time = 180850 or time = 180855 or time = 180900 or time = 180905 or time = 180910 or time = 180915 or time = 180920 or time = 180925 or time = 180930 or time = 180935 or time = 180940 or time = 180945 or time = 180950 or time = 180955 or time = 181000 or time = 181005 or time = 181010 or time = 181015 or time = 181020 or time = 181025 or time = 181030 or time = 181035 or time = 181040 or time = 181045 or time = 181050 or time = 181055 or time = 181100 or time = 181105 or time = 181110 or time = 181115 or time = 181120 or time = 181125 or time = 181130 or time = 181135 or time = 181140 or time = 181145 or time = 181150 or time = 181155 or time = 181200 THENSELLSHORT 10 CONTRACT AT Low[1] - 3 STOPSET TARGET PROFIT 6set stop loss 6ENDIFENDIF01/18/2024 at 8:32 PM #226555Just ran another test, in demo.
see the attached order list.
System, as seen below, was supposed to place 40 orders with 15 second intervals, but only a total of 15 orders were placed. How this is even possible, I don’t know. Cancellations take multiple seconds, as before. Sometimes as much as 7-8 seconds, meaning backtests on lower timeframes cannot be trusted unless you can add an 8ish-second delay to your scripts. Scalping is also completely out of the question.
Massive delays in order cancellation is one thing, but 35 missing orders?
1234567891011121314DEFPARAM CumulateOrders = falseIF not onmarket THENIF time = 195500 or time = 195515 or time = 195530 or time = 195545 or time = 195600 or time = 195615 or time = 195630 ortime = 195645 or time = 195700 or time = 195715 or time = 195730 or time = 195745 or time = 195800 or time = 195815 ortime = 195830 or time = 195845 or time = 195900 or time = 195915 or time = 195930 or time = 195945 or time = 200000 ortime = 200015 or time = 200030 or time = 200045 or time = 200100 or time = 200115 or time = 200130 or time = 200145 ortime = 200200 or time = 200215 or time = 200230 or time = 200245 or time = 200300 or time = 200315 or time = 200330 ortime = 200345 or time = 200400 or time = 200415 or time = 200430 or time = 200445 THENSELLSHORT 10 CONTRACT AT Low[1] - 3 STOPSET TARGET PROFIT 6set stop loss 6ENDIFENDIF01/18/2024 at 8:39 PM #22655601/18/2024 at 9:34 PM #226559just to be clear, all tests were run in 1-second time frame.
Tested on a 5-second timeframe using 15 second intervals just now, and I’m not seeing any of these delays anymore. this may be an issue only with the lowest time frames like the 1-second and 2-second,.
However, 25 out of 28 orders were placed, so there’s 3 missing. That’s worrying.
12345678910111213141516DEFPARAM CumulateOrders = falseIF not onmarket THENIF time = 211500 or time = 211515 or time = 211530 or time = 211545or time = 211600 or time = 211615 or time = 211630 or time = 211645or time = 211700 or time = 211715 or time = 211730 or time = 211745or time = 211800 or time = 211815 or time = 211830 or time = 211845or time = 211900 or time = 211915 or time = 211930 or time = 211945or time = 212000 or time = 212015 or time = 212030 or time = 212045or time = 212100 or time = 212115 or time = 212130 or time = 212145THENSELLSHORT 10 CONTRACT AT Low[1] - 3 STOPSET TARGET PROFIT 6set stop loss 6ENDIFENDIF01/19/2024 at 11:28 AM #226575I was a bit too hasty in my last post. There were delays also in the 5-second timeframe test, but less.
The reason why only 15 out of 40 pending stop orders on the 1-second test was actually placed, is likely to be delays when both opening and closing positions. Conditions to place an order is no longer true after 1 second, and more than 60% of the orders had at least 1 second delay. 2-3 seconds delay seems normal, and sometimes as bad as 6-8 seconds.
As such, it’s only natural that the 5-second test had higher success rate of actual placed pending stop orders, as the order is pending for 5 seconds instead of 1 second, allowing for more delay. Still, 25 out of 28 orders were placed, meaning I had 3 incidents where delays were 5 seconds or more.
I ran another test in DAX today (script below) on the 10-second timeframe, where I placed 40 pending stop orders with a 30 second interval, and had them cancelled at the open of the next candle. Just like before. This time 40 out of 40 orders were placed, meaning that we at least had no delay of more than 10 seconds. Nonetheless, more than 60% of the orders will have been placed somewhere between 1-8 seconds later than what you expect it to, and that’s just horrendously bad. At least for day traders. And you can forget about scalping.
Order list screenshot: https://pasteboard.co/DGyOHVCC4CX7.png
12345678910111213141516DEFPARAM CumulateOrders = falseIF not onmarket THENIF time = 104700 or time = 104730 or time = 105000 or time = 105030 or time = 105100or time = 105130 or time = 105200 or time = 105230 or time = 105300 or time = 105330or time = 105400 or time = 105430 or time = 105500 or time = 105530 or time = 105600or time = 105630 or time = 105700 or time = 105730 or time = 105800 or time = 105830or time = 105900 or time = 105930 or time = 110000 or time = 110030 or time = 110100or time = 110130 or time = 110200 or time = 110230 or time = 110300 or time = 110330or time = 110400 or time = 110430 or time = 110500 or time = 110530 or time = 110600or time = 110630 or time = 110700 or time = 110730 or time = 110800 or time = 110830 THENSELLSHORT 10 CONTRACT AT Low[1] - 20 STOPSET TARGET PROFIT 6set stop loss 6ENDIFENDIF01/19/2024 at 12:59 PM #226582Very good work / analysis you have done here pointofbrew … big thank you and also for sharing with us all.
I’m hoping @PeterSt will have useful comments and observations on what you have highlighted!
01/19/2024 at 2:02 PM #226583For sure. No problem. I hope everyone who day trade takes notice, because their systems are most likely placing orders outside of system conditions.
Sorry about the thread becoming a bit messy. I tested and wrote along the way, while in half sleep.
I have done more testing, and have excluded the possibility that it might have had to do with my test intervals. The delays are there, whether it’s 1 single order or 100 consecutive orders in an interval.
I guess my conclusion is that the delays I’m seeing in order cancellations, are there for when opening positions as well. Anywhere between 1-8 seconds delay, both for opening and cancelling an order. 2-16 seconds for a round trip.
01/19/2024 at 4:56 PM #226591Well, at least I am highly interested (thank you GraHal). But with this topic pinned to my screen, I seem to have too few time today (already yesterday). So it requires mimicking what you do, pob, and it seems that I will run into the weekend, when this can not be tested. 🙁
So at this moment I rather start spouting somewhat … and if it doesn’t make much sense, then perhaps you can still take something from it (ideas) ?
It will undoubtedly be my lack of concentration or focus, but I can’t grab the subject much. I see “entities” used, which are not conform the expressions you use. I am certainly not referring to a language problem of any sort (and otherwise always blame me) but merely to “phenomena” (entities) which do not fit. Allow me to give an hopefully justified example :
The reason why only 15 out of 40 pending stop orders on the 1-second test was actually placed, is likely to be delays when both opening and closing positions. Conditions to place an order is no longer true after 1 second, and more than 60% of the orders had at least 1 second delay.
In my book this conflicts. If you’d really still be talking about 1 second systems, then nothing can last more than one second, because PRT will have kicked you out. Explanation :
The pending orders you use will need to be repeated each 1 second, or else they are discarded. I could also say : if the broker did not respond within that 1 second, PRT will see error and throw out your system.**
but
not in Demo.OR
Or you quite explicitly don’t talk about your Pending ENTRY orders, which …
I think are not correct because they should be Limit orders – not Stop orders.
Or you do that on purpose, because it is perfectly allowed, if you only don’t think the will be filled at the price you want (they will act as Market Orders).
… or I completely misunderstood up to don’t understand. 🙂 It could be your mechanism to test this, which I don’t grab yet (must first do it myself).
But if I am right on this one, your orders being filled will be a coincidence because you may not know in advance whether the order is at the correct side of the price (for the Stop order to match). I see you using 3 and 20 points for it and while 20 points should be OK to always be on the wrong side, 3 may not be at all (for the DAX). Mind you, the order at the right side of the price will do what you want, which is almost never.
It is also a bit in the lap of the Gods when you have Entry times at the whole minute and the half minute (or per 15 seconds which also includes the whole minute) while no single soul will ever trade on the 15 or 30 second, while many will on the whole minute. And oh, I could add to this that IG may be manipulating the prices exactly at those rarity points so you won’t notice (and just see the price changed at the whole minute). Yes, with me we can go everywhere. 😉**): This is crucial because something which can’t happen, will now not be noticed by you and instead you could run into different issues (PRT can’t calculate the gain correctly).
On the other hand, you told that it happens in Live as well, which I don’t think you showed with screenshots and of which I may wonder how on earth you are testing *that*. Lose money ? (which exists – I do that too).
I could undermine all of my ideas above with telling that I still don’t see those delays for broker (vs PRT) response which I could easily prove by something you see below (I wrote this before I looked it up for real – haha). So this is sorted on Entries and Market orders only. All spot on the whole minute.
And to ensure I did not pick a few which coincidentally are at :00, I have a few of them (see 2nd picture) – these are just the last. Look for “Koop” (Buy) and “Bestens” (Market). Maybe I can do that for Exit as well …
… yes I can. See third picture. So that is “Verkoop” (Sell) combined with “Positie sluiten” (Exit). These are Longs and I can’t find them readily for Shorts. I do find something else though;Picture #4 shows a mall list of erroneous trades. This is why I show the small losses as well. So, I *know* that these are failed orders, right when they started. Thus within … well, the seconds you see after the whole minute (1 or 2 or even 0 seconds). It almost looks like what you presented …
Interesting that they are all on the same 2 dates (following each other, Dec. 11 and Dec. 12).
Why this sometimes happens I could never find, but I think I have a video somewhere, testifying that because of a (too) fact price movement – while the 4 point distance which can be set by/in PRT to move with the price when a limit order is too close to the price – jumps into the too short distance after all, and the order Exits immediately. This too long sentence is to be read as : the Limit order ended up at the wrong side of the price and acts as a Market order and exits the order (because it now goes short with the same quantity while the order is long and therewith cancels the position).Over here we say : If you can make chocolate of this, then you’re a smart guy.
(this is all too ad hoc reasoning and writing)Sorry for my English – you must be having a hard time understanding it.
01/19/2024 at 5:32 PM #226599while no single soul will ever trade on the 15 or 30 second,
I do (5 sec time frame I manual trade) and you do as you often say your Algos trade on 1 sec TF. I also have a few Algos that trade on 15 sec and 30 sec.
Above does not need any answer or even a comment, just throwing it in … shows I read your post! 😉
1 user thanked author for this post.
01/19/2024 at 5:49 PM #226604Haha, Yes. Manually surely !
But this won’t move markets really (me thinks).And of course some crazies do with AutoTrading. That’s us. But that too won’t move markets (YET -:) 🙂 ).
Offtopic : I use 3 seconds systems. Think of it. 😉1 user thanked author for this post.
01/20/2024 at 8:44 PM #226631It will undoubtedly be my lack of concentration or focus, but I can’t grab the subject much. I see “entities” used, which are not conform the expressions you use. I am certainly not referring to a language problem of any sort (and otherwise always blame me) but merely to “phenomena” (entities) which do not fit. Allow me to give an hopefully justified example :
The reason why only 15 out of 40 pending stop orders on the 1-second test was actually placed, is likely to be delays when both opening and closing positions. Conditions to place an order is no longer true after 1 second, and more than 60% of the orders had at least 1 second delay.
In my book this conflicts. If you’d really still be talking about 1 second systems, then nothing can last more than one second, because PRT will have kicked you out. Explanation :
The pending orders you use will need to be repeated each 1 second, or else they are discarded. I could also say : if the broker did not respond within that 1 second, PRT will see error and throw out your system.**
I’ll keep this short.
There is indeed a language “problem”, and it’s hard for me to express myself well in english. But on the other hand, there’s nothing for me to prove here. I suggest you simply run similar tests yourself. I hardly doubt this is an issue to my account exclusively. For all I know, these delays are there on purpose, e.g. to prevent arbitrage opportunites. I’m saying this because if I place a datastream of ES directly from the exchange next a US500 chart from IG, there is notable delay between the two charts. Would have been to easy, right? As US500 is a derivative, It’s only natural that there is some delay, as IG have to process the real data and pass it on. They have to protect themselves in some way. And a natural soultion to that would be to add delay.
“On the other hand, you told that it happens in Live as well, which I don’t think you showed with screenshots and of which I may wonder how on earth you are testing *that*. Lose money ? (which exists – I do that too).”
Here’s the screenshot from that example, that I btw have reported to PRT, where an automated strategy executed an order on the 1-second timeframe 3 seconds after it should have been cancelled. In a live account. I’m simply trying to trade the volatilty around the open in DAX on this one. Also notice how I was stopped by out 0.7 points. I had a 6 point stop loss in. I thought IG would not accept stop loss less than 5 points, and why on earth is my stop loss in DAX sometimes 0.6 points, and other times 6 points, using the exact same script? https://pasteboard.co/cLVX7qOUh9gL.png
I began my testing because of it, and I find it fascinating that this is an unkown issue to the forum? It looks to me like you are backtesting this, except from the last couple of screenshots? You have to forward test it. Backtests will only show you what you want to see. These delays are pretty obvious. It does not matter whether you trade the 1 second or the 15 minute … Many will still experience orders being triggered when conditions are not true, and many will experience orders NOT being triggered, when conditions are in fact true. Especially those times delays are at 8 seconds, as I ‘ve seen in my tests.
“Or you quite explicitly don’t talk about your Pending ENTRY orders, which …
I think are not correct because they should be Limit orders – not Stop orders.”Why can’t I use pending stop orders as entry orders? Anyways, the point of this exercise is to identify speed of order execution only.
” I see you using 3 and 20 points for it and while 20 points should be OK to always be on the wrong side, 3 may not be at all (for the DAX). Mind you, the order at the right side of the price will do what you want, which is almost never.”
I’ve ran multiple tests since using 20 points for all. There is no difference. Delays are still there.
“while no single soul will ever trade on the 15 or 30 second,”
You would be suprised to know how many traders actually trade these timeframes. Just from a top down approach, there’s probably quite a few. In fact I spoke with a british trader yesterday, who trades the 5-second timeframe algorithmically.
-
AuthorPosts
Find exclusive trading pro-tools on