×

Sign up and get MultiCharts free

Use its powerful simulation mode with data included out of the box. Just fill out the form and start honing your trading skills with a few clicks.

Changes - MultiCharts

Changes

Jump to navigation Jump to search
no edit summary
'''One should not expect 100% identical results between backtestedbacktesting, calculating in real-time (forwardtestingforward testing) and auto trading charts. The results may be close but it is almost impossible to make them absolutely the same'''.
== Difference in Order Execution ==
Even if 2 two charts (chart A is auto trading and chart B is calculating in real-time) are set up ideally identically to generate the same orders on the same bars, the execution of the those orders depends on different factors for each of the charts. To learn more, please read about the general differences in the results of [[Backtesting vs Live Trading]].
== Different Starting Points of Strategy Calculation ==
When a chart is created and a strategy is applied to the chart, it is backtested , immediately displaying entries and exits. It is important to understand that the calculation's starting point of calculation in this case is not the first bar due to [[Strategy Properties#Setting Maximum Bars Back|MaxBarsBack value]] (aka the Maximum number of bars a study will reference) '''the first bar when an order can be generated (''''to be placed on next bar'''') is bar # X''', where '''X = MaxBarsBack value + 1'''.<div style="background-color: #E3FBE5;">'''Example''': Let's say a signal contains only 1 line: '''buy next bar market''' and the MaxBarsBack is set to '''50'''. It means script will be be calculated only at close bar # '''51''' to place the '''buy market''' at open of bar # '''52'''. Depending on the [[Auto Trading#Mode Selection|selected mode of auto trading]], the starting point for a strategy to calculate may differ.</div>
=== Synchronous Mode ===
In SA mode at the moment when you click the button to toggle automaton automation on, the starting point of strategy calculation an order generation on chart A is shifted from the beginning of the chart to the previous to bar before the current bar and the strategy starts calculation from scratchis recalculated. Meanwhile, when if you create an identical chart B nearby to see the strategy calculating in real-time (forward-testing) and you expect to see at least the first order triggered at the same time on the same bar as on chart A, you should perform a calculation to find out the correct data range setting for chart B so that both charts' strategies have the same order generation starting point points. If the starting points are different, then the results are also different.<div style="background-color: #E3FBE5;">'''Example''': Let's say a signal applied to chart A contains only 1 line: '''buy next bar at close-15 limit;''' and the MaxBarsBack is still set to '''50'''. It means the script will be be calculated only at close bar # = '''51''' to place the guaranteed-to-be-executed '''buy limit''' at the open of the bar, that is, bar # '''52''', when the chart is created and the script is applied. Assume that this is a '''1 + MaxBarsBack valueminute''' chart, the current bar # is '''122''' and its time (closing time of the bar) is '''11:02'''. The current bar is not closed yet, so the script cannot be calculated on the current or bar. You enable automated execution by clicking on the SA button. The order executed historically on bar # 52 is wiped from from the chart and the script is recalculated. To emulate the same situation on another chart B you will need to create identical chart right after you enable automated exectuion on chart A, but the bar # '''1''' of the char B should be the bar with time = '''10:10''' ('''11:02 (bar # 122) - 1 ''(the bar that is previous to the current bar, where the script was calculated for the first time to generate the order on chart A)'' - 50 (MaxBarsBack) - 1 (current bar)'''. In other words, the bar # '''121''' on chart A and the bar '''51''' on chart B should be the same bar ('''10:10''').</div><div style="background-color: #E3FBE5;">'''Note 1''': The opening tick of the current bar is already passed, so the order execution prices will differ on the charts.</div><div style="background-color: #E3FBE5;">'''Note 2''': Example is valid for price orders only. It will work differently for market orders.</div><div style="background-color: #E3FBE5;">'''Note 3''': If your script requires a number of bars for calculation the price for an order and this number of bars is greater than MaxBarsBack value, the example is not valid.</div><div style="background-color: #E3FBE5;">'''Note 4''': In this example an ideal and very simple situation is described. Different resolutions, presence of session breaks on chart and many other factors make it much more complicated.</div>To summarize: '''it is hard, but it is possible to get at least first identical trade on 2 charts (chart A is auto trading, chart B is calculating in real-time), though it doesn't mean it is possible to make all trades 100% the same between these 2 charts'''. === Asynchronous Mode ===Auto trading in asynchronous mode shows all the orders generated by your strategy on chart and the starting points lead of script calculation are the same on chart A that is auto trading in AA and the same chart B that is calculating in real-time nearby, but '''this mode is supposed to give you different resultspicture on chart and at broker end by its design'''[[Category:FAQ]]

Navigation menu