Working in AA mode (the only possible way to trade with multistrategy in the same underlying) when tws lose his connection for any reason for some seconds ( i'm not meaning the auto-logoff tws that occurs 1 time a day and when you have to relogon manually) , and after that automatically reconnect, AA strategy send new orders even if the previous one was not cancelled.
For a pratical example:
I have a position in e-mini dj with a stop loss order, during the night tws lose connection and reconnected automatically after few seconds, MC(that remained open) send another stop loss order even if the previous one is still active.
The results is a double stop loss order duplicated.
There is a way to prevent this problem? MC can't recognize the previos order? is there a programming solution for that (in strategy code i mean).
Another problem is that working in SA, if you turn off for a second SA automate order execution and you have a open position, if you turn on again there is no way to alligne MC with broker: you still have a position in the account but for MC you are flat.
Thank you very much for your work and have a nice day!
Duplicate orders when TWS lose connection
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Duplicate orders when TWS lose connection
Hello palmone,Working in AA mode (the only possible way to trade with multistrategy in the same underlying) when tws lose his connection for any reason for some seconds ( i'm not meaning the auto-logoff tws that occurs 1 time a day and when you have to relogon manually) , and after that automatically reconnect, AA strategy send new orders even if the previous one was not cancelled.
For a pratical example:
I have a position in e-mini dj with a stop loss order, during the night tws lose connection and reconnected automatically after few seconds, MC(that remained open) send another stop loss order even if the previous one is still active.
The results is a double stop loss order duplicated.
There is a way to prevent this problem? MC can't recognize the previos order? is there a programming solution for that (in strategy code i mean).
Similar question has been already raised multiple times. Please see my replies in the related topics:1, 2.
When auto trading is turned off - the strategy position becomes zero. If you have an open position at the broker and you want your strategy to continue trading this position - you need to specify the position manually for each strategy next time you turn on the auto trading.Another problem is that working in SA, if you turn off for a second SA automate order execution and you have a open position, if you turn on again there is no way to alligne MC with broker: you still have a position in the account but for MC you are flat.
Thank you very much for your work and have a nice day!
Please do the following:
Go to Format-> Strategy properties-> Auto trading-> Assign the initial market position at the broker setting->Show the assign the initial market position at the broker dialogue-> Show always-> Ok.
When you start the auto trading - a dialogue window will appear where you can set the position for the strategy. This is how you can synchronize your broker and strategy positions.
You can also synchronize your strategy and broker position automatically with the help of the synchronizer script (!From Broker To Strategy MP Synchronizer!). Position at the broker cannot be divided between multiple strategies automatically by means of the "synchronizer" script. If you are trading with multiple strategies on one instrument - you need to assign the position manually for each strategy. For more information on the synchronizer script usage please refer to the following pages: #1 and #2.
- Smoky
- Posts: 518
- Joined: 03 Dec 2010
- Location: Thailand
- Has thanked: 99 times
- Been thanked: 123 times
Re: Duplicate orders when TWS lose connection
hi Henry,
Sorry i'm not agree with you, MC 9 have a reconnection issue, as I have already explain, in reconnection buffered order are sent to the broker !
Here a example wirh HAC buy order and P1 pyramid orders, pyramid order are sent on reconnection !
As I already ask, we need powerlangage new functions to manage reconnection :
- erase buffered orders on reconnection, (better in disconnection LoL )
- manage backfill data or not.
- manage status broker disconnection AND datafeed disconnection
Thanks
Sorry i'm not agree with you, MC 9 have a reconnection issue, as I have already explain, in reconnection buffered order are sent to the broker !
Here a example wirh HAC buy order and P1 pyramid orders, pyramid order are sent on reconnection !
As I already ask, we need powerlangage new functions to manage reconnection :
- erase buffered orders on reconnection, (better in disconnection LoL )
- manage backfill data or not.
- manage status broker disconnection AND datafeed disconnection
Thanks
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Duplicate orders when TWS lose connection
Smoky, did you read the reply in the links I have provided? I will quote it here again:
IB support has studied the case and provided recommendations on improving MultiCharts to IB API connection that should resolve the issue.
As significant changes in the connection algorithms are required – these improvements have been targeted to the next major platform revision which is MultiCharts 9.1 Beta 1. There is no ETA for this version at the moment.