Rapid order turnaround

Questions about MultiCharts and user contributed studies.
janus
Posts: 835
Joined: 25 May 2009
Has thanked: 63 times
Been thanked: 104 times

Rapid order turnaround

Postby janus » 17 Mar 2012

I've discovered a possible issue with my strategy, although it would be very rare. Let's say I have a sell order that is submitted to IB then soon afterwards I have a buy signal generated before the sell order was filled and acknowledged by the study. What should I do? I see at least two options. One, I should wait for the previous order to be acknowledged and then submit the second order. Two, I could submit it immediately and the interaction between IB and MC will take care of things to end up in the correct position, which I'm no sure will always work. I intend to do some simulations when the markets open tomorrow but wondering if anyone has come across this issue and solved it.

janus
Posts: 835
Joined: 25 May 2009
Has thanked: 63 times
Been thanked: 104 times

Re: Rapid order turnaround

Postby janus » 19 Mar 2012

After doing some tests it appears positions can go bad. For example, if I send a buy order then on the next tick I send a sellshort order, I've seen a few times the market position at the broker ending up flat or being short 2 instead of short 1. So, it looks like I'll have to queue the orders myself in my code to guarantee I don't have a problem. Not sure where the problem is. It could be at IB's end but even so I thought this problem would have been sorted out a long time ago, and MC found a way to correct the situation. I suppose no trading system is perfect.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Rapid order turnaround

Postby Henry MultiСharts » 20 Mar 2012

Hello Janus,

Please provide a sample script for better understanding of your case.
What symbol are you trading and what is the chart resolution?
Is IOG turned on for the signal?
Are you trading this symbol from one chart with 1 signal code?
Are you using regular or FA IB account?
What exact version and build number of MultiCharts are you running?

janus
Posts: 835
Joined: 25 May 2009
Has thanked: 63 times
Been thanked: 104 times

Re: Rapid order turnaround

Postby janus » 20 Mar 2012

Hello Janus,

Please provide a sample script for better understanding of your case.
What symbol are you trading and what is the chart resolution?
Is IOG turned on for the signal?
Are you trading this symbol from one chart with 1 signal code?
Are you using regular or FA IB account?
What exact version and build number of MultiCharts are you running?
Hi Henry.

The symbol is APM2 (AUD JUN12 SPI Futures). Resolution is 1 minute.. IOG is turned on. Yes, I'm only trading this symbol from one chart with one signal study. I'm testing this on a regular account in simulation mode. I'm using Version 7.4 (Build 4953).

I've written some code to buffer my orders and it's working well. I've stressed tested it so much I'm now confident I can send say an order on every update tick for 100 consecutive ticks, and they all eventually get processed and received by IB OK. It takes a while for all of them to get flushed but that's to be expected. Of course I will never get anywhere near that much activity but I wanted to try it and see.

I will package up for you a simplified version of my study and send it to you later.

janus
Posts: 835
Joined: 25 May 2009
Has thanked: 63 times
Been thanked: 104 times

Re: Rapid order turnaround

Postby janus » 22 Mar 2012

I replicated the problem during another one of my tests. I'm wondering if the cause of the problem is actually at IB's end and not MC. In any case I'll open a trouble ticket rather than continue the discussion here.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Rapid order turnaround

Postby Henry MultiСharts » 23 Mar 2012

Please share the PM issue number once you create it.

janus
Posts: 835
Joined: 25 May 2009
Has thanked: 63 times
Been thanked: 104 times

Re: Rapid order turnaround

Postby janus » 23 Mar 2012

Please share the PM issue number once you create it.
As it turned out the issue has changed. It was a mistake in my code that caused certain orders to be dropped. Once I fixed the code I discovered another issue with the exact same result but with a twist. The problem happens only in very quiet markets. See https://www.multicharts.com/pm/viewissu ... _no=MC-884

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Rapid order turnaround

Postby Henry MultiСharts » 05 Apr 2012

This issue's status has been changed to 'Not a bug'.
Please refer to the corresponding PM request for more details.
Last edited by Henry MultiСharts on 11 Apr 2012, edited 1 time in total.

janus
Posts: 835
Joined: 25 May 2009
Has thanked: 63 times
Been thanked: 104 times

Re: Rapid order turnaround

Postby janus » 05 Apr 2012

This issue's status has been changed to 'Not a bug'.
Pelase refer to the corresponding PM request for more details.
The issues were not answered fully. No matter, I suspect the problems I encountered were the result of using the simulation account where orders are stalled when there are insufficient contracts in the queue to fill them in one hit and the queue is not updated by IB for some time. In a real account the queue will update as soon as all contracts sitting at the bid or ask price are filled. The simulation account doesn't do this and the bid or ask is only ever repopulated when a change is made at the exchange due to a real fill by a real user. When I observed a simulated order is stalled, I might get a problem with duplicate/extra fills. It's rare but it does happen. I've added some checks for this in my study so if it ever happens with my real trading account I will get a warning, just in case. Hopefully it never happens but I was expecting a resolution to this to be certain. I do realise it may be very difficult to emulate as the problem is rare but as I stated it does happen. Whether it happens with a real trading account, I suppose we have to wait and see. My tests were exhaustive so even if there is a problem, it may not be uncovered for a very long time with a real trading account, if ever. Perhaps some users have experience it but shrugged it off as a once off error and dealt with the unbalanced fill manually. For now I will not pursue the issue, but I will revisit it if I find out more information, particularly with the real trading account.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Rapid order turnaround

Postby Henry MultiСharts » 11 Apr 2012

This issue's status has been changed to 'Not a bug'.
Pelase refer to the corresponding PM request for more details.
The issues were not answered fully. No matter, I suspect the problems I encountered were the result of using the simulation account where orders are stalled when there are insufficient contracts in the queue to fill them in one hit and the queue is not updated by IB for some time. In a real account the queue will update as soon as all contracts sitting at the bid or ask price are filled. The simulation account doesn't do this and the bid or ask is only ever repopulated when a change is made at the exchange due to a real fill by a real user. When I observed a simulated order is stalled, I might get a problem with duplicate/extra fills. It's rare but it does happen. I've added some checks for this in my study so if it ever happens with my real trading account I will get a warning, just in case. Hopefully it never happens but I was expecting a resolution to this to be certain. I do realise it may be very difficult to emulate as the problem is rare but as I stated it does happen. Whether it happens with a real trading account, I suppose we have to wait and see. My tests were exhaustive so even if there is a problem, it may not be uncovered for a very long time with a real trading account, if ever. Perhaps some users have experience it but shrugged it off as a once off error and dealt with the unbalanced fill manually. For now I will not pursue the issue, but I will revisit it if I find out more information, particularly with the real trading account.
Please use the suggestions provided by Andrew and let us know if this issue will reappear.
We will do our best to help you.

janus
Posts: 835
Joined: 25 May 2009
Has thanked: 63 times
Been thanked: 104 times

Re: Rapid order turnaround

Postby janus » 11 Apr 2012

Please use the suggestions provided by Andrew and let us know if this issue will reappear.
We will do our best to help you.
Thanks I did see his comment. Not sure if it will help but I will find out. One thing I've found out is I haven't experienced the problem with MC 8.0 beta 2. I have a study that stress tests the order management system by throwing at it a variety of orders. If there's ever a discrepancy between the position according to the broker and the study, it halts. I've been able to make it fail after about 10-20 minutes with 7.4 but it hasn't yet failed with 8.0. I will try again for a longer time to make sure. I'm hoping the order management system has been improved in 8.0. I'm not yet brave enough to use it for live trading though.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Rapid order turnaround

Postby Henry MultiСharts » 11 Apr 2012

Please use the suggestions provided by Andrew and let us know if this issue will reappear.
We will do our best to help you.
Thanks I did see his comment. Not sure if it will help but I will find out. One thing I've found out is I haven't experienced the problem with MC 8.0 beta 2. I have a study that stress tests the order management system by throwing at it a variety of orders. If there's ever a discrepancy between the position according to the broker and the study, it halts. I've been able to make it fail after about 10-20 minutes with 7.4 but it hasn't yet failed with 8.0. I will try again for a longer time to make sure. I'm hoping the order management system has been improved in 8.0. I'm not yet brave enough to use it for live trading though.
Order management has been improved in 8.0 beta 2.
Please let us know the results of your tests.

janus
Posts: 835
Joined: 25 May 2009
Has thanked: 63 times
Been thanked: 104 times

Re: Rapid order turnaround

Postby janus » 11 Apr 2012

Order management has been improved in 8.0 beta 2.
Please let us know the results of your tests.
I will. A possible issue is I'm running 8.0 beta 2 on a much slower PC and it's possible that may make a difference. I'm tempted to upgrade my production environment to 8.0 beta 2 but as I said a number of times I'm hesitant to using a beta version of the software for my real trading.

Roughly how long before 8.0 is officially released? Weeks, months?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Rapid order turnaround

Postby Henry MultiСharts » 12 Apr 2012

Order management has been improved in 8.0 beta 2.
Please let us know the results of your tests.
I will. A possible issue is I'm running 8.0 beta 2 on a much slower PC and it's possible that may make a difference. I'm tempted to upgrade my production environment to 8.0 beta 2 but as I said a number of times I'm hesitant to using a beta version of the software for my real trading.

Roughly how long before 8.0 is officially released? Weeks, months?
MC 8.0 Release Candidate is expected on the end of the next week.
MC 8.0 Release is expected in two-three weeks after RC.

janus
Posts: 835
Joined: 25 May 2009
Has thanked: 63 times
Been thanked: 104 times

Re: Rapid order turnaround

Postby janus » 12 Apr 2012

MC 8.0 Release Candidate is expected on the end of the next week.
MC 8.0 Release is expected in two-three weeks after RC.
That's really good news. Thanks.

I'll wait for the official release since it's so soon. Once I have upgraded my production environment I will repeat the stress tests to see if the problem is still there on my much faster PC. Hopefully it won't be. If it is I'll open up an issue on PM as I feel it's important enough to resolve it for the next release. I'm sure other traders would agree.

One thing to note is after applying the recent hot fix to 7.4 for the latest IB TWS version, the stress tests passed after 40 or so minutes. I never had it work for that long. Either the problem has already been fixed or it was just a fluke. Let's wait and see.


Return to “MultiCharts”