Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (1 invisible), 692 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Daily bars #480009
05/13/20 09:26
05/13/20 09:26
Joined: Sep 2018
Posts: 29
K
kerplunk1899 Offline OP
Newbie
kerplunk1899  Offline OP
Newbie
K

Joined: Sep 2018
Posts: 29
Hi all,

could you help me?
I want to get daily bars whose open price is the first price of that day and the close price is the last one.
I'm struggling with the weekend and with the close price of the friday bar.
I want to exclude the sunday price AT ALL.
To do this I have set: StartWeek = 10000; EndWeek = 52359;
Also I placed the BR_WEEKEND flag.

Here's the code I use. I set an hourly BarPeriod and the TimeFrame = frameSync(24) to get the daily prices.

Everything seems correct except from the friday bar printed on monday.
Its close price is actually the midnight price of sunday. I would like to exclude the sunday getting the last available price of friday as the close price of the friday bar.
Is this possible?

Code
function run()
{
set(LOGFILE);
assetList("AssetsFix");
BarPeriod = 60;
BarOffset = 0;
BarMode = BR_WEEKEND;
Weekend = 2;
StartWeek = 10000;
EndWeek = 52359;
StartDate = 20200401;
asset("EUR/USD");

printf("\n%s", datetime());

/*HOUR PRICES*/
printf(" | open=%f - close=%f | ", priceOpen(), priceClose());

TimeFrame = frameSync(24);
vars open = series(priceOpen());
vars close = series(priceClose());
TimeFrame = 1;

/*DAILY PRICES*/
printf(" | open=%f - close=%f | ", open[0], close[0]);

}


Thanks

Re: Daily bars [Re: kerplunk1899] #480055
05/17/20 12:23
05/17/20 12:23
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria
What you probably need is BR_SLEEP for ignoring the Sunday prices. But I don't know if this works also in the backtest, in the manual BR_SLEEP seems to be for live trading. Try it out.

Re: Daily bars [Re: kerplunk1899] #480066
05/18/20 07:55
05/18/20 07:55
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
BR_SLEEP is for live trading. It would make sense to implement it also for the backtest. Until then, just let the week end on Sunday, not Monday, but don't trade on the Sunday bar. The Sunday prices are then not included in the Monday bar.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1