Hi,
I experienced very big difference in behavior of my scripts in live trading and backtesting the same period later. Unfortunately the difference caused loss, not profit.
I think that the problem is with CFD market open hours: Zorro knows nothing about this, so bars are opened during night while the market is closed. Series get filled with the same data and this gap causes problems, e.g. lowpass filters change direction too early.
Although my script does nothing when the market is closed, I must fill the series because this is needed by Zorro.
Interestingly, when I download the data from fxcm with the download script and run a backtest, there are no bars during the night.
I have no idea what to do except that I have to stop using series.
Thank you for your help in advance!
Krisztián
-------
Some more detail:
Log from live (removed some lines logged by other components):
[Fri 13.06. 02:58] 1080 -113 +5 /\\
[Fri 13.06. 03:58] 1080 -113 +5 /\\
[Fri 13.06. 04:58] 578 -113 +5 /\\
[Fri 13.06. 05:58] 581 -113 +5 /\\
[Fri 13.06. 06:58] 516 -174 +4 /
[Fri 13.06. 07:58] 532 -174 +29 /
[Fri 13.06. 08:58] 529 -174 +28 /
[Fri 13.06. 09:58] 550 -174 +44 /
[Fri 13.06. 11:00] 548 -129 +0
Lowpass Short Invested Capital: 1095, on 6/13
[GER30:lowpass:S1819] Short 11@9843 Risk 39 t at 10:59
The same period from a backtest:
[1056: Thu 12.06. 21:59] 9910.00
[1057: Fri 13.06. 06:59] 9910.00
[1058: Fri 13.06. 07:59] 9926.00
[1059: Fri 13.06. 08:59] 9881.00
[1060: Fri 13.06. 09:59] 9883.00
[1061: Fri 13.06. 10:59] 9850.00
[1062: Fri 13.06. 11:59] 9842.00
[1063: Fri 13.06. 12:59] 9853.00
[1064: Fri 13.06. 13:59] 9880.00
Part of the code of my lowpass component which is the most affected one by this problem (although equity curve trading logic in other components is also heavily affected):
function tradeLowPass() {
algo("lowpass:S");
Stop = 22 * PIP;
Margin = margin * 3;
Trail = 0;
ExitTime = 18;
vars Price = series(price());
vars lowPass = series(LowPass(Price, 600));
vars lowPass2 = series(LowPass(Price, 760));
vars lowPass3 = series(LowPass(Price, 100));
if (isTradingHour() and falling(lowPass2) and falling(lowPass) and falling(lowPass3) and not opened) {
Lots = 1;
enterShort(0, 0, 25, 0, 30, 115);
opened = 1;
openedAt = price();
}
...
}