Gamestudio Links
Zorro Links
Newest Posts
Max Number of Strategies in /Strategy folder
by Martin_HH. 06/16/26 11:13
Z9 getting Error 058
by jcl. 06/16/26 09:51
How to select between IB accounts by script?
by AndrewAMD. 06/13/26 15:44
Zorro tutorial ideas?
by AndrewAMD. 06/13/26 15:01
Zorro 3.01 recoded MMI function issue
by 11honza11. 06/13/26 11:40
Stooq now requires an API key
by AndrewAMD. 06/11/26 17:55
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (Martin_HH, Student_64151), 3,152 guests, and 11 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Student_64151, Koti, curry, DeepxKalsi, Samed
19219 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 | 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