Open main menu

From Broker To Strategy MP Synchronizer

Definition

From Broker To Strategy MP Synchronizer signal is used to synchronize MultiCharts position and the broker position. This can be useful in cases when you auto trade in Asynchronous mode (AA mode) or combine manual trading and auto trading on the same instrument. The synchronization is performed inside MultiCharts, no actual orders are sent to the broker.

On each strategy calculation, the signal compares chart position with broker position. If the difference between these two positions is detected, TimeOutMS timer starts counting down. If by the end of the specified period the positions don’t get equal, then ChangeMarketPosition order will be sent by the auto trading system. This event will activate the next timer specified in LatencyMS input. LatencyMS determines how much time to wait before the next synchronization. If during the period specified for LatencyMS the ChangeMarketPosition order is not filled, the synchronizing signal sends another synchronizing order which will send the second notification on the chart. The price of the synchronizing order is equal to AvgEntryPrice_at_Broker.

By default, the IOG mode is enabled.

How to set timeouts

1) Use Print statement in your script to output computer time in ms and three market positions: (MarketPosition, MarketPosition_at_Broker, MarketPosition_at_Broker_for_The_Strategy);
2) Use Print statement in your script to output computer time in milliseconds and the fact of execution of ChangeMarketPosition command.

Default Inputs

TimeOutMS sets the first timeout (in ms) that must be expired before the first synchronizing order is generated, 250 by default.
The TimeOutMS value shouldn’t be less than the difference between the value from Order and Position Tracker -> Orders tab -> Filled/Cancelled column and the last market position change printed out to the Output for MarketPosition_at_Broker. At the same time, this parameter shouldn’t be bigger than the interval between sending orders to the broker (otherwise, the Synchronizer can go into the resonance).

LatencyMS sets the second timeout (in ms) that must be expired before the second synchronizing order is generated, 500 by default.
The LatencyMS value shouldn’t be less than the difference between the time of generating ChangeMarketPosition order and its execution. However, this time value shouldn’t be too big, because it corresponds to the period when the Synchronizer stays inactive after sending the synchronizing order.

Note: The first timeout (TimeOutMS) will not immediately change the chart position.