Not getting the same result on every backtest run, why?

Posted By: Dalla

Not getting the same result on every backtest run, why? - 05/04/18 11:08

My code looks liks this:

Code:
//https://oxfordstrat.com/trading-strategies/hikkake-pattern/

function run()
{
	StartDate= 20110101;
	EndDate = 20171231;
	set(PARAMETERS+LOGFILE+TESTNOW);
	BarPeriod = 1440;
	BarOffset = 1020;
	EntryTime = 3;
	
	while(asset(loop("EUR/USD","USD/JPY","GER30"))) {
		vars close = series(priceClose());
		vars low = series(priceLow());
		vars high = series(priceHigh());
		
		var trend_index = optimize(1,1,200,10);
		LifeTime = optimize(25,1,200,10);

		Stop = ATR(20) * 6;
		
		if(high[1] < high[2] && low[1] > low[2]) {
			if (high[0] <  high[1] && low[0] < low[1]) {
				if(close[0] > close[trend_index]) {
					enterLong(1, high[2] + (1*PIP));
				}
			} else if (high[0] >  high[1] && low[0] > low[1]) {
				if(close[0] < close[trend_index]) {
					enterShort(1, low[2] - (1*PIP));
				}
			}
		}
	}
	
	PlotWidth = 1200;
}



After training, I don't get the same result on every run, and I cannot understand why. I can't see anything obviously wrong with my code?

For example, running with the assets in the script above, I'm seeing these two different results. It is consistent in the sense that I'm only seeing those two results, but I expect to the same result every time of course.

Code:
Oxford_HikkakePattern compiling...........
Read Oxford_HikkakePattern.par
Multiple assets...
Test: Oxford_HikkakePattern  2011..2017
Assets AssetsMini
Monte Carlo Analysis... Median AR 98%
Win 13804$  MI 165$  DD 2209$  Capital 2027$
Trades 90  Win 48.9%  Avg +180.6p  Bars 62
AR 97%  PF 2.04  SR 0.70  UI 21%  R2 0.62

Oxford_HikkakePattern compiling...........
Read Oxford_HikkakePattern.par
Multiple assets...
Test: Oxford_HikkakePattern  2011..2017
Assets AssetsMini
Monte Carlo Analysis... Median AR 23%
Win 7374$  MI 87.91$  DD 5406$  Capital 4146$
Trades 94  Win 43.6%  Avg +104.5p  Bars 61
AR 25%  PF 1.44  SR 0.37  UI 41%  R2 0.23



I'm running with Zorro 1.81.9.
What might be causing this?
Posted By: Dalla

Re: Not getting the same result on every backtest run, why? - 05/04/18 13:20

Adding Lookback = 200 solved the issue
© 2024 lite-C Forums