Gamestudio Links
Zorro Links
Newest Posts
blogherenowcenter
by 3s05bmmc. 06/05/24 06:08
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 720 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19057 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
TimeFrame/BarPeriod issues #433939
12/09/13 11:30
12/09/13 11:30
Joined: Jul 2013
Posts: 110
B
bfleming Offline OP
Member
bfleming  Offline OP
Member
B

Joined: Jul 2013
Posts: 110
I'm testing a version of the low pass strategy from Workshop 4 and noticed that I get entirely different results when I use TimeFrame=1 / BarPeriod=240 vs. TimeFrame=4 / BarPeriod=60.

Here are the results for TimeFrame=4 / BarPeriod=60:

Quote:
Run Test Script..
Walk-Forward Test: Test Script EUR/USD 2002..2013
Read Test Script_1.par Test Script_2.par Test Script_3.par Test Script_4.par
Profit -35$ MI -1$ DD 176$ Capital 147$
Trades 15 Win 47% Avg -30.6p Bars 251
AR -5% PF 0.81 SR -0.12 UI 81.5% Error 117%


And here are the results for TimeFrame=1 / BarPeriod=240:

Quote:
Run Test Script..
Walk-Forward Test: Test Script EUR/USD 2002..2013
Read Test Script_1.par Test Script_2.par Test Script_3.par Test Script_4.par
Profit 115$ MI 2$ DD 136$ Capital 122$
Trades 25 Win 32% Avg +60.3p Bars 142
AR 22% PF 1.47 SR 0.25 UI 27.2% Error 98%
Time 00:01:48


As you can see, a considerable difference. Why would this be?

I trained each version separately, and the only change in code is the TimeFrame/BarPeriod. Am I missing something?

Here is the code for the strategy:

Code:
function tradeTrend1()
{
	TimeFrame = 4;
	vars Price = series(price());
	vars Trend = series(LowPass(Price,optimize(1000,500,1500)));
	vars Signals = series(0);
	
	Stop = 10*ATR(20);
	TakeProfit = 10*ATR(20);
	Entry = -20*PIP;	
	if(valley(Trend)) {
		Signals[0] = 1;
		if(Sum(Signals+1,4) == 0)  
			enterLong();
	} else if(peak(Trend)) {
		Signals[0] = 1;
		if(Sum(Signals+1,4) == 0)
			enterShort();
	}
}

function run()
{
	set(PARAMETERS+TICKS+TESTNOW);  
	set(LOGFILE);
	BarPeriod = 60;	
	LookBack = 500;	
	StartDate = 2002;
	NumWFOCycles = 5; 
	
	if(ReTrain) {
		UpdateDays = -1;	 
		SelectWFO = -1;	
	}
	
// portfolio loop
	while(asset(loop("EUR/USD")))
	while(algo(loop("TRND")))
	
	{
		
		if(strstr(Algo,"TRND") and strstr(Asset,"EUR/USD"))
		tradeTrend1();
	}
	
	PlotWidth = 600;
	PlotHeight1 = 300;
}


Re: TimeFrame/BarPeriod issues [Re: bfleming] #433941
12/09/13 12:12
12/09/13 12:12
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
There can be many reasons, like different week lengths and test periods. But you can easily check the reason of different behavior of two strategy variants. This is a frequent situation in strategy development.

Run tests of both strategies and compare the log files. You can then see where strategy 1 places a trade and strategy 2 doesn't, and vice versa. If the reason is then still not clear, plot or print the trade signals and their parameters. For strategy development you need to examine not only the total performance, but often also look into the behavior of single trades.

Re: TimeFrame/BarPeriod issues [Re: jcl] #433956
12/09/13 15:40
12/09/13 15:40
Joined: May 2013
Posts: 245
S
swingtraderkk Offline
Member
swingtraderkk  Offline
Member
S

Joined: May 2013
Posts: 245
jcl,

I'm assuming that the lowest granularity of tick data is the 1 min OHLC and that that bfleming doesn't use actual tick data.

In that case does the TICKS flag mean that zorro evaluates all trading at each 1 min OHLC irrespective of whether BarPeriod = 60 or 240 and irrespective of the Timeframe used?

or would the BarPeriod at 240 use a 120 min OHLC and at 60 use a 30 min OHLC?

Re: TimeFrame/BarPeriod issues [Re: swingtraderkk] #433958
12/09/13 15:43
12/09/13 15:43
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
The TICKS flag simulates trades in the resolution of the history files, which is 1 minute with the included data. This is regardless of the BarPeriod.

Re: TimeFrame/BarPeriod issues [Re: jcl] #433961
12/09/13 15:54
12/09/13 15:54
Joined: May 2013
Posts: 245
S
swingtraderkk Offline
Member
swingtraderkk  Offline
Member
S

Joined: May 2013
Posts: 245
Thanks jcl.

@bfleming try adding a line for BarOffset to try to ensure that candles start/end at a specific time. This may be useful in ruling out some time related issues.

e.g. I use this to ensure my daily candles end at New York close:

BarOffset = (ET+17)*60;

Last edited by swingtraderkk; 12/09/13 16:02.

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1