I am seeking an effective solution to make MultiChats backtesting representable and reliable to all my trading in reality.
The problem of “Back to the Future” is often existent during backtesting with DataN operations. Data at the time of DataN could be a future, or past, values for Data1. i.e.: time data between Data1 and DataN are not concurrent.
It not only can cause incorrect results to all functions, indicators and signals but also put real trading at considerable risk.
Here is an example to review the problem. See a strategy performance report after about one year backtesting first:
Fig 1: Equity Curve Close To Close
Fig 2: Strategy Performance Summary
The strategy performance was incredible. You may have a try just simply refer the context with provided testing codes. The following statements are the settings of the backtesting:
Symbol: CL #F=1 (eSignal Crude Oil Futures)
Data Range: From 1/1/2014 to 5/5/2015
Resolution of Instrument Data 1: 5 Minutes
Resolution of Instrument Data 2: 5 Minutes
Fig 3: Format Objects
Fig 4: Instruments
Fig 5: Backtesting Settings of Strategy Properties
The strategy codes are brief and described below. The signal is just used to zoom in the problem for a closer examination and nonsense for real trading. You could modify it and print data out for checking details.
Code: Select all
[IntrabarOrderGeneration = true]
var:StopLoss(50),StopGain(50);
var: price1(0), price2(0);
price1 = Close of data1;
price2 = Close of data2;
if marketposition = 0 AND (price2 - price1 ) >= StopLoss/bigpointvalue
then begin
buy("LE") next bar at market;
end;
if marketposition = 0 AND (price2 - price1 ) <= StopLoss/bigpointvalue * -1
then begin
sellshort("SE") next bar at market;
end;
setstopcontract;
setstoploss(StopLoss);
setstopcontract;
setpercenttrailing(StopGain,1);
I could not find a way appropriate for solving the “Back to the Future” Problem so far.
Is it possible to have a good solution to deal with it and make backtesting more accurate?