Why Identical Charts Are Showing Different Strategy Trading Results: Difference between revisions
Line 14: | Line 14: | ||
<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 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 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 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> | ||
=== Asynchronous Mode === | === Asynchronous Mode === |
Revision as of 10:02, 11 June 2013
One should not expect 100% identical results between backtested, calculating in real-time (forwardtesting) 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 charts (chart A is auto trading and chart B is calculating in real-time) are set up ideally to generate same orders on the same bars, the execution of the orders depends on different factors for each of the charts. To learn more, please read about general differences in 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 starting point of calculation in this case is not the first bar due to MaxBarsBack value (aka 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.
Synchronous Mode
In SA mode at the moment you click the button to toggle automaton on, the starting point of order generation on the chart A is shifted from the beginning of the chart to the bar that previous to current bar and the strategy is recalculated. Meanwhile, if you create the 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 bar at the same time as on chart A, you should perform some calculation to find out the correct data range setting for chart B in order to have the same starting points of order generation for strategies on both charts. If starting points are different, the results are also different.
Asynchronous Mode
Auto trading in asynchronous mode shows all the orders generated by your strategy on chart and the starting points 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 picture on chart and at broker end by its design.