Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
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
3 registered members (EternallyCurious, Quad, vicknick), 700 guests, and 7 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
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: 586
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 586
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,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
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