Gamestudio Links
Zorro Links
Newest Posts
What are you working on?
by rayp. 07/11/26 18:10
Z9 getting Error 058
by madpower2000. 07/09/26 18:09
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 07/09/26 13:16
New Zorro version 3.11
by jcl. 07/06/26 06:56
Synthetic test data in Zorro
by jcl. 07/06/26 06:54
Parameter filename BUG
by walt_Schwarz. 07/02/26 15:36
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
0 registered members (), 8,570 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
riggi89, shuhari, KD1990, Ephraim, Student_64151
19223 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Hourly bars / Daily prices #479812
04/27/20 17:26
04/27/20 17:26
Joined: Sep 2018
Posts: 29
K
kerplunk1899 Offline OP
Newbie
kerplunk1899  Offline OP
Newbie
K

Joined: Sep 2018
Posts: 29
Hi all,
could someone help me to implement the following?
I want my trades to be executed every day at 1 am based on the daily (midnight) bars prices.

Code
string datetime(){
	return strf("%02d.%02d.%02d %02d:%02d:%02d %d",day(),month(),year(),hour(),minute(),(int)second(),dow());
}


function run()
{
set(LOGFILE);
LookBack = 0;
BarPeriod = 60;
assetList("AssetsFix");
StartDate = 20200410;

asset("EUR/USD");

TimeFrame = 1;
FrameOffset = 0;
var open = priceOpen();
var close = priceClose();
printf("\n%s | Open=%.5f, Close=%.5f", datetime(), open, close);

TimeFrame = 24;
FrameOffset = 1;
var open = priceOpen();
var close = priceClose();
if(hour()==1) printf(" | Open=%.5f, Close=%.5f", open, close);

}



I thought I could use FrameOffset, but it didn't get the expected result.
I'm not sure I understood what FrameOffset does exactly. Changing its value seems to make no difference at all.

[Linked Image]

What I want, is to get the green prices and not the red ones.
Can you please help me?
Is there a more correct way to set BarPeriod/TimeFrame in order to get the result??

Thanks!!!

Re: Hourly bars / Daily prices [Re: kerplunk1899] #479814
04/27/20 18:31
04/27/20 18:31
Joined: Sep 2018
Posts: 29
K
kerplunk1899 Offline OP
Newbie
kerplunk1899  Offline OP
Newbie
K

Joined: Sep 2018
Posts: 29
Code

string datetime(){
	return strf("%02d.%02d.%02d %02d:%02d:%02d %d",day(),month(),year(),hour(),minute(),(int)second(),dow());
}


function run()
{
set(LOGFILE);
LookBack = 0;
assetList("AssetsFix");
StartDate = 20200410;
BarPeriod = 60;

TimeFrame = 1;
FrameOffset = 0;
printf("\n%s | open=%.5f - close=%.5f", datetime(), priceOpen(), priceClose());

TimeFrame = 24;
FrameOffset = 17;
vars open = series(priceOpen());
vars close = series(priceClose());

if(hour()==1) printf(" | open=%.5f - close=%.5f", open[0], close[0]);


}



It seems this way I obtain what I want, but can you explain me why??
Why FrameOffset should be equals to 17?
Is is because of the default value of BarOffset (1000)?

Last edited by kerplunk1899; 04/27/20 18:32.

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1