Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
4 registered members (AndrewAMD, fogman, Grant, juanex), 972 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Confusion about Zorro reading parameters in .par file #427869
08/14/13 19:00
08/14/13 19:00
Joined: Jul 2013
Posts: 522
D
dusktrader Offline OP
User
dusktrader  Offline OP
User
D

Joined: Jul 2013
Posts: 522
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:
Code:
var fast = optimize(1,1,10,.25);
var slow = optimize(30,30,80,.25);



and produces this .par file:
Code:
EURUSD: 9.50 44.3=> 2.209



and then I hardcode it like this:
Code:
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):
Code:
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:
Code:
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?

Re: Confusion about Zorro reading parameters in .par file [Re: dusktrader] #427874
08/14/13 20:13
08/14/13 20:13
Joined: Nov 2012
Posts: 126
B
blaub4r Offline
Member
blaub4r  Offline
Member
B

Joined: Nov 2012
Posts: 126
You are using a WFO-Test. Each cycle has it's own set of trained parameters, that's why you get different results. The parameters you hardcode are the final parameters which are calculated from all cycles. These are for the future trading of your strategy.
However, there should be a .par file for each training cycle, too.

Re: Confusion about Zorro reading parameters in .par file [Re: blaub4r] #427878
08/14/13 21:07
08/14/13 21:07
Joined: Jul 2013
Posts: 522
D
dusktrader Offline OP
User
dusktrader  Offline OP
User
D

Joined: Jul 2013
Posts: 522
Aha! Thank you for explaining that. I do see that there are these files:
script_1.par
script_2.par
script_3.par
script_4.par
script.par
(created in that chronological order, so script.par is latest)

So does this mean that script.par represents the "aggregate best" of all the WFO cycles? Or is it only for the last test period (ie, current cycle optimization)?

Re: Confusion about Zorro reading parameters in .par file [Re: dusktrader] #427879
08/14/13 21:21
08/14/13 21:21
Joined: Nov 2012
Posts: 126
B
blaub4r Offline
Member
blaub4r  Offline
Member
B

Joined: Nov 2012
Posts: 126
script.par should be a calculated from all cycles, although I don't know how. It might be as simple as taking the average of all parameters.
Anyways, it's not the set of the last cycle, that's your script_4.par.

Re: Confusion about Zorro reading parameters in .par file [Re: blaub4r] #427891
08/15/13 10:26
08/15/13 10:26
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
script.par is normally not calculated from all cycles, it's calculated from the last cycle only. scrip_4.par is the last-but-one cycles. To calculate script.par from all cycles, you need anchored WFO. For details look here:

http://manual.zorro-trader.com/numwfocycles.htm

Re: Confusion about Zorro reading parameters in .par file [Re: jcl] #427895
08/15/13 11:09
08/15/13 11:09
Joined: Nov 2012
Posts: 126
B
blaub4r Offline
Member
blaub4r  Offline
Member
B

Joined: Nov 2012
Posts: 126
Ok, my bad


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1