726
edits
Abeloglazova (talk | contribs) No edit summary |
|||
(29 intermediate revisions by 6 users not shown) | |||
Line 61: | Line 61: | ||
<br> | <br> | ||
=== Cancel Market Orders | === Cancel Expired Market Orders After X Seconds === | ||
Market orders that were not filled within the specified time (30 seconds by default) will be canceled. | |||
<div style="background-color: #E5F6FF;">'''Example''': | <div style="background-color: #E5F6FF;">'''Example''': Default 30 second timeout is set;<br>12:00:00 Strategy Calculation at close of bar # 51 - place market order to buy at open of next bar;<br>12:00:01 Strategy Calculation at open of bar # 52 - market order to buy is placed at broker;<br>12:00:10 Strategy Calculation at close of bar # 52 - no market order to buy at open of next bar should be placed;<br> Default 30 second countdown starts:<br>12:00:40 - market order is cancelled.</div> | ||
<br> | <br> | ||
Line 73: | Line 73: | ||
<br> | <br> | ||
=== Stop auto | === Stop auto trading if final status of an order is not received === | ||
There is a possibility of a situation when broker's API loses the order and does not send the status for it at all or sends it with a big delay. | There is a possibility of a situation when broker's 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 the Order and Position Tracker window Logs tab. 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. | 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 the Order and Position Tracker window Logs tab. 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. | ||
When this option is enabled the auto | When this option is enabled the auto trading will be automatically turned off once the final status for an order sent by this strategy is not received. This option does not manage the open position/active orders. By default this option is disabled. | ||
<br> | <br> | ||
=== Stop auto | === Stop auto trading after X rejected orders === | ||
When enabled the auto | When enabled the auto trading will be automatically turned off after the specified number of the strategy orders is rejected. By default this option is disabled. | ||
<br> | <br> | ||
Line 90: | Line 90: | ||
=== Price Order Emulation === | === Price Order Emulation === | ||
Since '''MultiCharts 12''' it is possible to switch between native and emulated Stop, Limit and Stop-Limit orders in both auto trading and manual trading. This feature requires realtime data subscription on your broker account. When a Stop/Limit order is emulated - once the Stop/Limit price level is reached by the corresponding Ask/Bid or Trade prices, a market order is sent to the broker. When a Stop-Limit order is emulated - once the Stop price level is reached by the corresponding Ask/Bid or Trade prices, a Limit order is sent to the broker. In case Stop, Limit and/or Stop-Limit order emulation is enabled - the emulated OCO group is used, disregard the broker profile/ | Since '''MultiCharts 12''' it is possible to switch between native and emulated Stop, Limit and Stop-Limit orders in both auto trading and manual trading. This feature requires realtime data subscription on your broker account. When a Stop/Limit order is emulated - once the Stop/Limit price level is reached by the corresponding Ask/Bid or Trade prices, a market/limit order is sent to the broker correspondingly. When a Stop-Limit order is emulated - once the Stop price level is reached by the corresponding Ask/Bid or Trade prices, a Limit order is sent to the broker. In case Stop, Limit and/or Stop-Limit order emulation is enabled - the emulated OCO group is used, disregard the broker profile/auto trading broker plugin settings. | ||
To enable the Stop, Limit or Stop-Limit order emulation for | To enable the Stop, Limit or Stop-Limit order emulation for automated trading select '''Emulate locally using Bid/Ask''' or '''Emulate locally using Trade''' from the dropdown list next to the corresponding order type. Leave the settings to '''Use native''' if using price order emulation is undesirable. | ||
In order to apply the changes one needs to disconnect the broker profile and reconnect it. | In order to apply the changes one needs to disconnect the broker profile and reconnect it. | ||
<br> | <br> | ||
=== Self-Adaptive Trading === | |||
Check the Enable box to run periodic re-optimization of the strategy on new data. | |||
See the [[Self-Adaptive Trading]] page for more info. | |||
=== Unfilled Strategy Order Replacement === | === Unfilled Strategy Order Replacement === | ||
With the help of these options one can have unexecuted entry/exit price orders converted into market orders when the specified timeout is exceeded or upon bar close. | With the help of these options one can have unexecuted entry/exit price orders converted into market orders when the specified timeout is exceeded or upon bar close. | ||
The timer is launched depending on the option “Get | The timer is launched depending on the option “Get Real-Time Data from” and the mode of auto trading. | ||
In '''SA''' mode: | |||
* when set to “Broker”, the timer starts when the '''price at the broker''' touches the order’s price; | * when set to “Broker”, the timer starts when the '''price at the broker''' touches the order’s price; | ||
* when set to “Chart”, the timer starts when the order price is hit '''on a chart'''. | * when set to “Chart”, the timer starts when the order price is hit '''on a chart'''. | ||
Line 107: | Line 113: | ||
<div style="background-color: #E3FBE5;">'''Note''': If the order price is not hit at broker/chart then the order will not be converted.</div> | <div style="background-color: #E3FBE5;">'''Note''': If the order price is not hit at broker/chart then the order will not be converted.</div> | ||
<br> | <br> | ||
In '''AA''' mode conversion will start when an order is filled on a chart. | |||
The conversion algorithm is the following: | |||
# The Auto trading engine system receives an order filling event on the chart. | |||
#* If an identical order is now placed on the broker, the timer for conversion is launched. | |||
#* If this order is not placed on the broker yet, MultiCharts remembers that on this bar it is necessary to convert this particular order. | |||
# The Auto Trading engine places an order that needs conversion. The timer for conversion is launched. | |||
=== Partially Filled Orders Replacement === | === Partially Filled Orders Replacement === | ||
Line 129: | Line 141: | ||
<div style="background-color: #E5F6FF;">'''Example''': | <div style="background-color: #E5F6FF;">'''Example''': | ||
Auto trading mode is Async. (see [[Understanding Automated Trade Execution]]), Get Real-Time from Chart is selected, there is an executed entry and a trailing stop is sent. The trailing order price is calculated based on the entry order fill price at the broker and the real-time price from the chart.</div> | |||
# From Broker: Asks and Bids are taken from the connected broker. | # From Broker: Asks and Bids are taken from the connected broker.<div style="background-color: #E3FBE5;">'''Note''': '''From Broker''' option is not available for asynchronous mode [AA]</div> | ||
# From Chart: depends on the BackTesting Mode:<BR> | # From Chart: depends on the BackTesting Mode:<BR> | ||
::a) If it is Classic Backtesting, then the data is taken from the data series 1;<BR> | ::a) If it is Classic Backtesting, then the data is taken from the data series 1;<BR> | ||
Line 145: | Line 157: | ||
====Understanding Strategy Calculation in Different Modes==== | ====Understanding Strategy Calculation in Different Modes==== | ||
There are 3 separate market positions when strategy is auto | There are 3 separate market positions when strategy is auto trading in MultiCharts: | ||
# '''Broker position'''. This is '''net position for a traded security at your broker account''' that takes into consideration all trades. It can be seen on [[Order and Position Tracker#Open Positions Tab| Open Positions tab of Order and Position Tracker]]. | # '''Broker position'''. This is '''net position for a traded security at your broker account''' that takes into consideration all trades. It can be seen on [[Order and Position Tracker#Open Positions Tab| Open Positions tab of Order and Position Tracker]]. | ||
# '''Auto | # '''Auto trading engine position'''. This is '''inner position of the strategy on a specific chart''' calculated by the software. It can be seen on [[Order and Position Tracker#Strategy Positions tab| Strategy Positions tab of Order and Position Tracker]]. | ||
# '''Chart position'''. This is the '''position generated by orders visually executed on chart'''. It has nothing to do with open position horizontal drawing shown when you open [[Chart Trading]] panel. | # '''Chart position'''. This is the '''position generated by orders visually executed on chart'''. It has nothing to do with open position horizontal drawing shown when you open [[Chart Trading]] panel. | ||
When you auto trade '''in SA (sync. mode) the 2 and 3 are the same''', what you see on the chart is synchronized with auto | When you auto trade '''in SA (sync. mode) the 2 and 3 are the same''', what you see on the chart is synchronized with auto trading engine. When '''you use AA (async. mode), you may have to deal with 3 different positions''': what you have on broker, what you see on chart, what MC thinks it is. | ||
====Market Position Checking Keywords==== | ====Market Position Checking Keywords==== | ||
# [[MarketPosition_at_Broker]]. Returns '''broker position'''. | # [[MarketPosition_at_Broker]]. Returns '''broker position'''. | ||
# [[MarketPosition_at_Broker_for_The_Strategy]]. Returns MC '''auto | # [[MarketPosition_at_Broker_for_The_Strategy]]. Returns MC '''auto trading engine position'''. | ||
# [[MarketPosition]]. Returns '''chart position''' (only direction). | # [[MarketPosition]]. Returns '''chart position''' (only direction). | ||
<br> | <br> | ||
===Assign | ===Assign Initial Market Position to Strategy=== | ||
When auto trading is turned on, a strategy starts working with a specific market position.<br> | |||
Depending on the mode of auto trading, this position can vary. In [SA] mode it is always flat on chart when you turn it on, but in [AA] mode it can be short, flat or long, depending on backtesting trades (to learn more see [[#Mode_Selection|Mode Selection]]).<br> | |||
This option allows to control the initial market position for the strategy to start calculation and order generation with when you turn on auto trading. | |||
The available options are: | |||
* | :* '''Flat ''' - the initial position will be flat.<br> <div style="background-color: #E3FBE5;">'''Example''': According to your backtesting, the current position is 1 contract long and your real broker position is 1 contract short. With this option you will have +1 on your chart, flat for auto trading engine within the software and -1 short at broker, when the automation is turned on. </div> | ||
:* '''From Chart''' - the initial position will be the same as the position on the chart. | |||
:* '''From Broker''' - the initial position will be the same as the actual position at the broker when automation is enabled. | |||
:* '''Always show dialog window''' - to get the dialog every time the automation is enabled, no matter what the strategy position is at that moment.<br> <div style="background-color: #E3FBE5;">'''Note''': It is extremely important for [SA] mode, because it is always flat when automation is turned on in [SA].</div> | |||
:* '''Show dialog window only if market position on chart is different from broker''' - to get the dialog when the chart and broker positions do not match. | |||
=== Set TIF for order types === | |||
* | Select the '''Time in Force (TIF)''' for each order type: | ||
* Market | |||
* Limit | |||
* Stop | |||
* Stop-Limit | |||
< | |||
These controls work as a dropdown list with all TIFs supported in MultiCharts: | |||
* Default (corresponds to the value from the broker plugin settings) | |||
* DAY | |||
* GTC | |||
* GTD (includes the additional control to select the number of days) | |||
* IOC | |||
* FOK | |||
* AON | |||
The list depends on what TIFs are supported by the broker. | |||
The selected TIF values will be used to send orders into the broker plugin. | |||
If the selected TIF is not supported by a broker profile, the value from the [https://www.multicharts.com/trading-software/index.php?title=Auto_Trading#Select_Broker_Plug-in broker plugin settings] will be taken. | |||
<div style="background-color: #E3FBE5;">'''Notes''': | |||
# Some brokers may change TIF on their end – MultiCharts doest not regulate it. | |||
# The described behaviour is ''not applicable'' to backtesting. | |||
</div> | |||
===Select Broker Plug-in=== | ===Select Broker Plug-in=== | ||
Line 218: | Line 251: | ||
* Any Auto Trading parameters are changed | * Any Auto Trading parameters are changed | ||
* Connectivity between MultiCharts and the execution gateway has been lost and the disconnection time (of the broker profile) exceeded the specified acceptable level. | * Connectivity between MultiCharts and the execution gateway has been lost and the disconnection time (of the broker profile) exceeded the specified acceptable level. | ||
* [[Auto_Trading#Stop_auto-trading_if_final_status_of_an_order_is_not_received|"Stop auto | * [[Auto_Trading#Stop_auto-trading_if_final_status_of_an_order_is_not_received|"Stop auto trading if final status of an order is not received"]] option has come into effect | ||
* [[Auto_Trading#Stop_auto-trading_after_X_rejected_orders|"Stop auto | * [[Auto_Trading#Stop_auto-trading_after_X_rejected_orders|"Stop auto trading after X rejected orders"]] option has come into effect | ||
* You have got a [[Fail-Watch and Trading System Warnings]] alert | |||
<br> | <br> | ||