Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Trading Journey
by howardR. 04/24/24 20:04
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, EternallyCurious, Petra, 1 invisible), 764 guests, and 4 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
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