Originally Posted By: jcl
Last question first - you can see that this system is not profitable when volatility is low, as in the test period except for the last part.

I would reduce the optimization range of the lowpass period, and not optimize the other 2 parameters.


Thank you jcl, I guess that the blue equity below 0 is a margin call isn't it? And the red below 0 are actually 'draw ups'

Anyway I trained as you said, only optimizing lowpass period, with this code:
Click to reveal..

Code:
var MMI(vars Data,int TimePeriod)
{
	var m = Median(Data,TimePeriod);
	int i, nh=0, nl=0;
	for(i=1; i<TimePeriod; i++) {
		if(Data[i] > m && Data[i] > Data[i-1])
			nl++;
		else if(Data[i] < m && Data[i] < Data[i-1])
			nh++;
	}
	return 100.*(nl+nh)/(TimePeriod-1);
}

function run()
{
	set(PARAMETERS);
	StartDate = 2002;
	EndDate = 2008;	
	NumWFOCycles = 10;
	LookBack = 3000;
	vars Price = series(price());
	var period = optimize(1200,1000,2000,50);//optimize(500,50,3000,50);
	var mmiperiod = 100;//optimize(200,50,1200);
	vars Trend = series(LowPass(Price,period));	
	
	Stop = ATR(100)*4;//optimize(4, 2, 8);
	
	vars Meanness = series(MMI(Price,period));
	vars Filter = series(LowPass(Meanness,mmiperiod));	
	
	if( valley(Trend) ){		
		exitShort();  // close opposite position
		if(falling(Filter))
			enterLong();
	} else if( peak(Trend) ) {		
		exitLong();
		if(falling(Filter))
			enterShort();
	}
}




Which gave this result:
Click to reveal..

Walk-Forward Test Workshop4_2Pb EUR/USD - performance report

Simulation period 01.07.2002-31.12.2008
Test period 06.01.2005-31.12.2008
WFO test cycles 9 x 2674 bars (23 weeks)
Training cycles 10 x 15152 bars (130 weeks)
Monte Carlo cycles 200
Lookback time 3000 bars (25 weeks)
Assumed slippage 10.0 sec
Spread 2.5 pips (roll 0.01/-0.02)
Contracts per lot 1000.0

Gross win/loss 220$ / -177$ (+588p)
Average profit 11$/year, 0.88$/month, 0.04$/day
Max drawdown -109$ 258% (MAE -133$ 314%)
Total down time 80% (TAE 31%)
Max down time 130 weeks from Jun 2006
Largest margin 5.00$
Trade volume 88337$ (22165$/year)
Transaction costs -17$ spr, 0.36$ slp, -0.16$ rol
Capital required 100$

Number of trades 92 (24/year, 1/week, 1/day)
Percent winning 16%
Max win/loss 70$ / -7.81$
Avg trade profit 0.46$ 6.4p (+203.8p / -32.1p)
Avg trade slippage 0.00$ 0.1p (+0.9p / -0.1p)
Avg trade bars 86 (+371 / -30)
Max trade bars 1316 (11 weeks)
Time in market 33%
Max open trades 1
Max loss streak 20 (uncorrelated 29)

Annual return 11%
Profit factor 1.24 (PRR 0.82)
Sharpe ratio 0.21
Kelly criterion 0.40
R2 coefficient 0.000
Ulcer index 69.5%
Prediction error 86%

Confidence level AR DDMax Capital

10% 26% 41$ 40$
20% 24% 45$ 44$
30% 22% 49$ 48$
40% 19% 57$ 55$
50% 18% 62$ 58$
60% 16% 69$ 65$
70% 15% 76$ 71$
80% 13% 92$ 85$
90% 11% 107$ 98$
95% 10% 121$ 110$
100% 8% 151$ 136$

Portfolio analysis OptF ProF Win/Loss Wgt% Cycles

EUR/USD .023 1.24 15/77 100.0 \X\X\\\\X
EUR/USD:L .047 1.49 9/39 107.2 \\\/\\\\/
EUR/USD:S .000 0.96 6/38 -7.2 \/\\\\\\\


And this equity I don't understand, now the unprofitable period became profitable and viceversa, how can be that? frown