I'm running a daytrading system which has had a few hiccups due to me running automated trading asychronously (orders sometimes seem to fill but data doesn't quite match) which has been fine, but today the system went nuts and while the "model" system in MC did not even show a fill, MC sent 8 buy orders and opened 8 positions, and had 3 exit orders live.
Not sure how that can happen, could it be a result of broker disconnections (which I don't think happened but I haven't looked through the logs yet) or something else? The system is off for now as I obviously don't trust it, but it's been running fine for months without this happening.
I'm using MC version 9.1.12010.
Positions opened 8 times
-
- Posts: 72
- Joined: 20 Apr 2014
- Has thanked: 9 times
- Been thanked: 8 times
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Positions opened 8 times
Hello DaveAronow,
Which broker do you use?
Please go to File -> New -> Order and position tracker window->Orders tab.
What is the State of the order you are having issues with?
Then in the same window go to the Logs tab.
Are the any errors related to this order?
Like "Did not receive final status for order...".
Which broker do you use?
Please go to File -> New -> Order and position tracker window->Orders tab.
What is the State of the order you are having issues with?
Then in the same window go to the Logs tab.
Are the any errors related to this order?
Like "Did not receive final status for order...".
-
- Posts: 72
- Joined: 20 Apr 2014
- Has thanked: 9 times
- Been thanked: 8 times
Re: Positions opened 8 times
Broker is openecry. Not by my trading pc will check for them when back.
-
- Posts: 72
- Joined: 20 Apr 2014
- Has thanked: 9 times
- Been thanked: 8 times
Re: Positions opened 8 times
OK found a bunch of "Did not receive final status for order" so I assume that's the problem. How do I prevent that? I'd rather miss a trade than end up filled 8 times.
Re: Positions opened 8 times
You can turn auto-trading off after a specified number of rejected orders if that would work for you as a back up.
-
- Posts: 72
- Joined: 20 Apr 2014
- Has thanked: 9 times
- Been thanked: 8 times
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Positions opened 8 times
There are situations when the broker API loses the order and does not send the status for it at all or sends it with a big delay.
MultiCharts waits for the order status for 60 seconds by default (60 seconds between MultiCharts asking for the order status and receiving or not receiving the order status). If no feedback is provided for the order within 60 seconds by the broker - this order is considered to be cancelled/no longer present at the broker.
In such situation the message “Didn’t receive final status for order” appears in Order and Position tracker Logs tab. This is the issue you have experienced.
If the order was cancelled but the order generation conditions are still valid in the code – the signal generates the order and sends it to the broker again while the order generation conditions are met in the code.
If the previous order (lost by the API/not sent to MC) is still active – an overfill is possible.
We have faced this issue multiple times before with different people with different brokers and unfortunately none of the brokers have provided a solution for their API issue.
As a workaround from our end we have added ability to increase the order waiting timeout.
Timeout registry key can be found in HKEY_CURRENT_USER\Software\TS Support\MultiCharts64\TraderServer
Key name is "AT_WaitOrdersTimeOut". It would be created upon first start of auto trading.
Alternatively you can manually create a new DWORD 32 bit value and set the value you need.
Default value is 60 seconds. This key affects auto trading only (not manual trading) for all supported brokers.
If you try to disable auto trading during the specified timeout (while waiting order status) MultiCharts application can stop responding for the period specified in the registry key.
You can also check if MultiCharts auto trading engine position matches the broker position. If there is a mismatch - synchronize the position using the !From Broker To Strategy MP Synchronizer! signal or your own code, or turn off the auto trading.
But basically you should contact your broker and ask him to address this issue. Also make sure your Internet connection is stable.
MultiCharts waits for the order status for 60 seconds by default (60 seconds between MultiCharts asking for the order status and receiving or not receiving the order status). If no feedback is provided for the order within 60 seconds by the broker - this order is considered to be cancelled/no longer present at the broker.
In such situation the message “Didn’t receive final status for order” appears in Order and Position tracker Logs tab. This is the issue you have experienced.
If the order was cancelled but the order generation conditions are still valid in the code – the signal generates the order and sends it to the broker again while the order generation conditions are met in the code.
If the previous order (lost by the API/not sent to MC) is still active – an overfill is possible.
We have faced this issue multiple times before with different people with different brokers and unfortunately none of the brokers have provided a solution for their API issue.
As a workaround from our end we have added ability to increase the order waiting timeout.
Timeout registry key can be found in HKEY_CURRENT_USER\Software\TS Support\MultiCharts64\TraderServer
Key name is "AT_WaitOrdersTimeOut". It would be created upon first start of auto trading.
Alternatively you can manually create a new DWORD 32 bit value and set the value you need.
Default value is 60 seconds. This key affects auto trading only (not manual trading) for all supported brokers.
If you try to disable auto trading during the specified timeout (while waiting order status) MultiCharts application can stop responding for the period specified in the registry key.
You can also check if MultiCharts auto trading engine position matches the broker position. If there is a mismatch - synchronize the position using the !From Broker To Strategy MP Synchronizer! signal or your own code, or turn off the auto trading.
But basically you should contact your broker and ask him to address this issue. Also make sure your Internet connection is stable.
This option will not help in this case.You can turn auto-trading off after a specified number of rejected orders if that would work for you as a back up.
-
- Posts: 72
- Joined: 20 Apr 2014
- Has thanked: 9 times
- Been thanked: 8 times
Re: Positions opened 8 times
I see an autotrading setting for "Stop auto-trading if final status of an order is not received". However I didn't see this described on the wiki so I'm not sure how this would work. If this was checked and an order status was not received, I assume (based on the wording) autotrading would be turned off. Would this also:
Cancel all pending orders for this strategy (including sending a cancellation request for the order without a final status)?
Close all existing positions for the symbol (I would assume no)?
Would it do anything else?
Cancel all pending orders for this strategy (including sending a cancellation request for the order without a final status)?
Close all existing positions for the symbol (I would assume no)?
Would it do anything else?
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Positions opened 8 times
Hello DaveAronow,I see an autotrading setting for "Stop auto-trading if final status of an order is not received". However I didn't see this described on the wiki so I'm not sure how this would work. If this was checked and an order status was not received, I assume (based on the wording) autotrading would be turned off. Would this also:
Cancel all pending orders for this strategy (including sending a cancellation request for the order without a final status)?
Close all existing positions for the symbol (I would assume no)?
Would it do anything else?
This option will only turn off the auto trading. It will not manage the position/orders.
-
- Posts: 72
- Joined: 20 Apr 2014
- Has thanked: 9 times
- Been thanked: 8 times