Gamestudio Links
Zorro Links
Newest Posts
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 962 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Not getting the same result on every backtest run, why? #472545
05/04/18 11:08
05/04/18 11:08
Joined: Feb 2017
Posts: 369
D
Dalla Offline OP
Senior Member
Dalla  Offline OP
Senior Member
D

Joined: Feb 2017
Posts: 369
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?

Last edited by Dalla; 05/04/18 11:08.
Re: Not getting the same result on every backtest run, why? [Re: Dalla] #472547
05/04/18 13:20
05/04/18 13:20
Joined: Feb 2017
Posts: 369
D
Dalla Offline OP
Senior Member
Dalla  Offline OP
Senior Member
D

Joined: Feb 2017
Posts: 369
Adding Lookback = 200 solved the issue


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1