I'm sorry to be having so many issues today... but this one has really got me scratching my head. I've tried to narrow it down as best as I can. Maybe there is a quick explanation for this behavior:
I'm working on a process for optimization. As part of the process, I optimize different parts of the strategy in a specific order. After each optimization step, I "hardcode" the optimized values in the script, which I get from the script.par file.
The problem I've noticed is that, in this one case so far, the hardcoded values do not produce the same trading result as when it is supposedly read directly from the .par file. Therefore, I don't think we can blame precision/rounding on this.
The optimize stmt is written like this:
var fast = optimize(1,1,10,.25);
var slow = optimize(30,30,80,.25);
and produces this .par file:
EURUSD: 9.50 44.3=> 2.209
and then I hardcode it like this:
var fast = 9.50; //optimize(1,1,10,.25);
var slow = 44.3; //optimize(30,30,80,.25);
However, look at how dramatic the results change:
when leaving the optimize stmt in the script (ie, read from .par file):
Walk-Forward Test dt-phantom EURUSD - performance report
Simulation period 08.01.2002-26.07.2013
Test period 30.09.2008-26.07.2013
WFO test cycles 4 x 11026 bars (61 weeks)
Training cycles 5 x 62480 bars (350 weeks)
Lookback time 141 bars (3 days)
Assumed slippage 10.0 sec
Assumed spread 1.9 pips (roll -0.05/0.04)
Contracts per lot 100
Gross win/loss 90$ / -50$ (+4023p)
Average profit 8.35$/year, 0.70$/month, 0.03$/day
Max drawdown -10$ 25% (MAE -15$ 37%)
Total down time 65% (TAE 57%)
Max down time 56 weeks from Dec 2011
Largest margin 2.62$
Trade volume 20781$ (4313$/year)
Transaction costs -2.91$ spr, -0.13$ slp, -0.18$ rol
Capital required 11$
Number of trades 154 (32/year, 1/week, 1/day)
Percent winning 30%
Max win/loss 9.46$ / -5.06$
Avg trade profit 0.26$ 26.1p (+1.95$ / -0.46$)
Avg trade slippage -0.00$ -0.1p (+0.01$ / -0.01$)
Avg trade bars 168 (+393 / -73)
Max trade bars 1837 (10 weeks)
Time in market 59%
Max open trades 1
Max loss streak 14 (uncorrelated 16)
Annual return 88%
Profit factor 1.81 (PRR 1.41)
Sharpe ratio 0.73
Kelly criterion 0.65
OptimalF .314
Ulcer index 14%
Prediction error 52%
Cycle performance 2.10 1.57 1.82
Portfolio analysis OptF ProF Win/Loss Cycles
EURUSD .314 1.82 45/107 X/XX
EURUSD:L .286 1.79 28/64 //\/
EURUSD:S .363 1.86 17/43 \//\
and this is how it looks if I hardcode those optimized values:
Walk-Forward Test dt-phantom EURUSD - performance report
Simulation period 08.01.2002-26.07.2013
Test period 30.09.2008-26.07.2013
WFO test cycles 4 x 11026 bars (61 weeks)
Training cycles 5 x 62480 bars (350 weeks)
Lookback time 141 bars (3 days)
Assumed slippage 10.0 sec
Assumed spread 1.9 pips (roll -0.05/0.04)
Contracts per lot 100
Gross win/loss 93$ / -47$ (+4588p)
Average profit 9.52$/year, 0.79$/month, 0.04$/day
Max drawdown -8.52$ 19% (MAE -15$ 32%)
Total down time 64% (TAE 57%)
Max down time 44 weeks from Sep 2008
Largest margin 2.62$
Trade volume 20385$ (4231$/year)
Transaction costs -2.86$ spr, -0.11$ slp, -0.18$ rol
Capital required 9$
Number of trades 151 (32/year, 1/week, 1/day)
Percent winning 30%
Max win/loss 9.46$ / -4.66$
Avg trade profit 0.30$ 30.4p (+2.03$ / -0.45$)
Avg trade slippage -0.00$ -0.1p (+0.01$ / -0.01$)
Avg trade bars 171 (+405 / -68)
Max trade bars 1837 (10 weeks)
Time in market 59%
Max open trades 1
Max loss streak 10 (uncorrelated 15)
Annual return 115%
Profit factor 1.97 (PRR 1.53)
Sharpe ratio 0.83
Kelly criterion 0.66
OptimalF .288
Ulcer index 12%
Prediction error 55%
Cycle performance 2.54 1.74 1.74
Portfolio analysis OptF ProF Win/Loss Cycles
EURUSD .288 1.74 42/105 X//X
EURUSD:L .357 2.02 28/59 ////
EURUSD:S .162 1.38 14/46 \//\
These values affect equity-curve trading, which can definitely affect the performance results. But the issue is -- why is a hardcoded value different than what Zorro is reading from the .par file?