Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
M1 Oversampling
by 11honza11. 04/20/24 20:57
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
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 533 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
clarification on TimeFrame #475978
01/16/19 13:23
01/16/19 13:23
Joined: Jul 2016
Posts: 64
G
gtell Offline OP
Junior Member
gtell  Offline OP
Junior Member
G

Joined: Jul 2016
Posts: 64
Hello, I have just installed version 1.96 and tested the following script:

Code:
#define NORMPERIOD 100

#define F 2

#define BUFFER 2

​

var preprocess (var x) {

	return scale(x,NORMPERIOD)/100;

}

​

function run()

{

	StartDate = 20150101;

	EndDate = 20150331;

	BarPeriod = 1;	// 1 hour

	LookBack = 2000;

    int Offset=1;

​

	assetList("AssetsFix");

	asset("EUR/USD");

	set(RULES);

	Spread = RollLong = RollShort = Commission = Slippage = 0;

​

    TimeFrame=1;

	vars CloseTS = series(priceClose());

	vars LowTS = series(priceLow());

	vars HighTS = series(priceHigh());

	vars OpenTS = series(priceOpen());

	

	var ret = CloseTS[0]-OpenTS[0];

	vars rets = series(ret);

​

	int r1 = random(14);

	int r2 = random(14);

	int r3 = random(14);

	

	vars c1 = series(CloseTS[r1]);

	vars c2 = series(CloseTS[r2]);

	vars c3 = series(CloseTS[r3]);

​

    TimeFrame = 15;

​

	

	MACD(c1,12,26,9);

	vars m1=series(rMACD);

	vars F1=series(preprocess(m1[0]-m1[1]));

​

	MACD(c2,12,26,9);

	vars m2=series(rMACD);

	vars F2=series(preprocess(m2[0]-m2[1]));

	

	MACD(c3,12,26,9);

	vars m3=series(rMACD);

	vars F3=series(preprocess(m3[0]-m3[1]));

	

	string line = strf(

		"%02i/%02i/%02i %02i:%02i, %.5f, %.5f, %.5f, %.5f, %.5f, %.5f, %.5f, %.5fn",

		day(),month(),year()%100,hour(),minute(),

		priceOpen(),priceHigh(),priceLow(),priceClose(),F1[Offset],F2[Offset],F3[Offset],ret);

	if(is(INITRUN))

		file_delete("Data\exportMACD4.csv");

	else

		file_append("Data\exportMACD4.csv",line);

​

}



I would expected 15 min interval points but instead I have got this:

Code:
08/01/15 06:41, 1.18204, 1.18241, 1.18185, 1.18220, -0.03581, -0.04978, -0.12568, -0.00011

08/01/15 06:42, 1.18197, 1.18241, 1.18185, 1.18206, -0.03581, -0.04978, -0.12568, -0.00014

08/01/15 06:43, 1.18200, 1.18241, 1.18185, 1.18206, -0.03581, -0.04978, -0.12568, 0.00000

08/01/15 06:44, 1.18202, 1.18241, 1.18185, 1.18198, -0.03581, -0.04978, -0.12568, -0.00008

08/01/15 06:45, 1.18204, 1.18241, 1.18185, 1.18210, -0.03581, -0.04978, -0.12568, 0.00012

08/01/15 06:46, 1.18190, 1.18241, 1.18185, 1.18208, -0.03581, -0.04978, -0.12568, -0.00002

08/01/15 06:47, 1.18203, 1.18241, 1.18190, 1.18210, 0.17135, 0.15174, 0.17540, 0.00002

08/01/15 06:48, 1.18204, 1.18241, 1.18190, 1.18209, 0.17135, 0.15174, 0.17540, -0.00001

08/01/15 06:49, 1.18204, 1.18241, 1.18190, 1.18209, 0.17135, 0.15174, 0.17540, 0.00000

08/01/15 06:50, 1.18224, 1.18241, 1.18190, 1.18209, 0.17135, 0.15174, 0.17540, 0.00000

08/01/15 06:51, 1.18221, 1.18241, 1.18190, 1.18219, 0.17135, 0.15174, 0.17540, 0.00010

08/01/15 06:52, 1.18225, 1.18241, 1.18190, 1.18217, 0.17135, 0.15174, 0.17540, -0.00002

08/01/15 06:53, 1.18225, 1.18241, 1.18190, 1.18219, 0.17135, 0.15174, 0.17540, 0.00002

08/01/15 06:54, 1.18238, 1.18241, 1.18190, 1.18218, 0.17135, 0.15174, 0.17540, -0.00001

08/01/15 06:55, 1.18231, 1.18232, 1.18190, 1.18222, 0.17135, 0.15174, 0.17540, 0.00004

08/01/15 06:56, 1.18220, 1.18241, 1.18190, 1.18241, 0.17135, 0.15174, 0.17540, 0.00019

08/01/15 06:57, 1.18206, 1.18243, 1.18190, 1.18238, 0.17135, 0.15174, 0.17540, -0.00003

08/01/15 06:58, 1.18206, 1.18243, 1.18190, 1.18231, 0.17135, 0.15174, 0.17540, -0.00007

08/01/15 06:59, 1.18198, 1.18243, 1.18194, 1.18208, 0.17135, 0.15174, 0.17540, -0.00023

08/01/15 07:00, 1.18210, 1.18243, 1.18201, 1.18223, 0.17135, 0.15174, 0.17540, 0.00015

08/01/15 07:01, 1.18208, 1.18243, 1.18139, 1.18139, 0.17135, 0.15174, 0.17540, -0.00084

08/01/15 07:02, 1.18210, 1.18243, 1.18139, 1.18157, 0.13500, 0.05425, 0.15839, 0.00018

08/01/15 07:03, 1.18209, 1.18243, 1.18138, 1.18138, 0.13500, 0.05425, 0.15839, -0.00019

08/01/15 07:04, 1.18209, 1.18243, 1.18109, 1.18120, 0.13500, 0.05425, 0.15839, -0.00018



do you see any mistake in the code?

Re: clarification on TimeFrame [Re: gtell] #475982
01/16/19 14:16
01/16/19 14:16
Joined: Jul 2017
Posts: 784
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 784
Zorro scripts in run() execute each BarPeriod, TimeFrame is just an internal variable.

if (frame()) file_append() - should help.

Last edited by Zheka; 01/16/19 20:46.
Re: clarification on TimeFrame [Re: Zheka] #475991
01/16/19 16:52
01/16/19 16:52
Joined: Feb 2018
Posts: 236
Italy
tradingest Offline
Member
tradingest  Offline
Member

Joined: Feb 2018
Posts: 236
Italy


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1