Autotrading issues with v5 beta 2

Questions about MultiCharts and user contributed studies.
brendanh
Posts: 158
Joined: 07 Apr 2007
Has thanked: 1 time

Autotrading issues with v5 beta 2

Postby brendanh » 14 Jan 2009

1. It disconnects every morning at 4:55am GMT. I run TWSStart which prevents TWS logging out:

from Tradingserver_trace.txt:
"[0x00001B84](14.01.2009 - 04:55:42.563) Global Message: "Interactive Brokers The connection to Interactive Brokers Trader Workstation has been lost." (Warning)"

from TWSTradingPlugin_Trace.txt:
[0x000049D8](14.01.2009 - 04:55:42.532)Set ConnectionLost Timer
[0x000049D8](14.01.2009 - 04:55:42.563)On Timer ConnectionLost
[0x000049D8](14.01.2009 - 04:55:43.188)=> ib_server::CIBServerImpl::Disconnect

MC's IB connection is configured to "Disable auto trading after 0 seconds after connection loss". This is the default. This setting is undocumented in the Help system. Please explain what this setting does, what is the maximum, what does setting it to 0 do?

2. When I restart autotrading the option "Assume the initial market position is the SAME as on the chart" has changed to "Assume the initial market position is FLAT".

3. According to Help: "Auto Trading Market Position Synchronizer may not work correctly in case of Pyramiding use and if more than one active entry were generated on a chart at the moment of auto trading launch". Does this mean if I have two entries that are in the market at the time of autotrading launch, only one will be exited? If so how does MC determine which to exit?
Last edited by brendanh on 14 Jan 2009, edited 1 time in total.

User avatar
Marina Pashkova
Posts: 2758
Joined: 27 Jul 2007

Postby Marina Pashkova » 14 Jan 2009

Hi brendanh,

1. Auto trading is disabled because the timeout that you are referring to is set to 0. "Disable auto trading after n seconds after connection loss" has been designed for situations when for whatever reason (TWS logs out, poor internect connection etc) the connection between TWS and MultiCharts is lost but then restored and you want auto trading to pick up the restored connection and keep trading.

To make sure auto trading is not disabled when TWS logs out and is then brought up every morning, set a different value in the timeout (depending on how long it takes for TWS to be fully up and running).


2. We have tested the situation you are describing, but the position synchronization settings were retained after re-enabling auto trading in our tests. Could you please describe, step by step, what exactly you were doing?

3.
According to Help: "Auto Trading Market Position Synchronizer may not work correctly in case of Pyramiding use and if more than one active entry were generated on a chart at the moment of auto trading launch". Does this mean if I have two entries that are in the market at the time of autotrading launch, only one will be exited? If so how does MC determine which to exit?
All your entries will be exited. The only serious problem in the scenario that you are describing is that exits from entry will not be possible.

Regards.

brendanh
Posts: 158
Joined: 07 Apr 2007
Has thanked: 1 time

Postby brendanh » 14 Jan 2009

Hi brendanh,

1. Auto trading is disabled because the timeout that you are referring to is set to 0. "Disable auto trading after n seconds after connection loss" has been designed for situations when for whatever reason (TWS logs out, poor internect connection etc) the connection between TWS and MultiCharts is lost but then restored and you want auto trading to pick up the restored connection and keep trading.
As mentioned, I use TWSStart, so TWS is never logged out. So 0 means MC immediately disconnects when the connection with TWS is lost. Perhaps there is a momentary interruption at 4:55am that causes MC to disconnect. I have changed it to 9999 so we'll see whether that prevents the disconnection.
2. We have tested the situation you are describing, but the position synchronization settings were retained after re-enabling auto trading in our tests. Could you please describe, step by step, what exactly you were doing?
a: Enable autotrading with "assume SAME" set.
b: Find autotrading has disconnected the next morning. When I check settings are correct before re-enabling, I find it has changed to "assume FLAT".
3. According to Help: "Auto Trading Market Position Synchronizer may not work correctly in case of Pyramiding use and if more than one active entry were generated on a chart at the moment of auto trading launch". Does this mean if I have two entries that are in the market at the time of autotrading launch, only one will be exited? If so how does MC determine which to exit?
All your entries will be exited. The only serious problem in the scenario that you are describing is that exits from entry will not be possible.
By "exits from entry will not be possible" I assume you mean entries that were generated at the moment that autotrading was enabled. That is fine.

Many thanks.

brendanh
Posts: 158
Joined: 07 Apr 2007
Has thanked: 1 time

Postby brendanh » 15 Jan 2009

Since changing the "Disable auto trading after..." setting to 9999 yesterday, MC stayed connected through the night and past 4:55am, however I noticed that trades hadn't been placed in TWS this morning and when I looked at the logs, there were no updates since 8:45am in any except ATOrderController_Trace.txt. This indicates that MC thought it was connected to TWS so was sending orders, but it wasn't actually connected, so they were never received by TWS.

It seems if you set it to 0, a momentary loss of connection with TWS will cause MC to disable autotrading, if you set it to max 9999, MC will assume it is connected even when it isn't (for up to 9999 seconds or just under 3hrs). So setting it to a high value effectively disables monitoring of the connection for the period of the timer, and the green indicator isn't a true reflection of the connection status.

Perhaps there is a better way of keeping MC and TWS connected. The "Disable auto trading after..." setting gives MC a tolerance timer for disconnection during which MC will continue to place orders. Perhaps at the end of this timer if TWS still isn't connected, MC could display a dialogue asking "Your broker connection has been lost, would you like to try reconnecting? Yes or No". This way you can set the default of "Disable auto trading after..." to a few seconds and a momentary connection loss will still be tolerated, but if after a few seconds TWS still isn't connected, the user is made aware of this important event and is given the option to reconnect. Plus this will make the green\grey indicator in the top left a true reflection of the connection status.

Another lesser issue I've noticed: If you have TWSStart configured to automatically accept incoming connections, it conflicts with MC trying to do the same thing and the connection fails to be automatically accepted.


Return to “MultiCharts”