Gamestudio Links
Zorro Links
Newest Posts
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
Release 2.68 replacement of the .par format
by Martin_HH. 09/23/25 20:48
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,161 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Generate bars whenever there is data #484411
10/23/21 16:35
10/23/21 16:35
Joined: Oct 2018
Posts: 72
J
JamesHH Offline OP
Junior Member
JamesHH  Offline OP
Junior Member
J

Joined: Oct 2018
Posts: 72
I want to backtest a strategy, generating bars for whenever there is data for that bar.

Following the BarMode documentation, e.g. "For trading assets even at weekends, such as cryptocurrencies, reset BR_WEEKEND before sampling bars", I put this at the beginning of my script:

Code
	if (is(INITRUN)) {
		features = malloc(num_features * sizeof(var));
		set(BR_MARKET | OFF);
		set(BR_WEEKEND | OFF);
	}


However, comparing with an export from the ZHistoryEditor, I see that the script is skipping thousands of bars (I presume on the weekend but I have not carefully checked yet).

Also, according to the docs, after resetting BR_WEEKEND, I would expect StartWeek and EndWeek to have no effect, yet changing these does affect the number of bars generated.

What am I misunderstanding, or is there possibly a bug here?

Re: Generate bars whenever there is data [Re: JamesHH] #484413
10/23/21 18:04
10/23/21 18:04
Joined: Feb 2017
Posts: 1,806
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,806
Chicago
set() does not configure BarMode. And don’t use OFF. Use the setf and resf macros on the BarMode int.

Re: Generate bars whenever there is data [Re: AndrewAMD] #484424
10/24/21 11:24
10/24/21 11:24
Joined: Oct 2018
Posts: 72
J
JamesHH Offline OP
Junior Member
JamesHH  Offline OP
Junior Member
J

Joined: Oct 2018
Posts: 72
You are right, it does say to use setf and resf in the BarMode documentation. However, it gave me the exact same result.

I will double-check my input .t6 file...

Re: Generate bars whenever there is data [Re: JamesHH] #484429
10/24/21 18:28
10/24/21 18:28
Joined: Oct 2018
Posts: 72
J
JamesHH Offline OP
Junior Member
JamesHH  Offline OP
Junior Member
J

Joined: Oct 2018
Posts: 72
It was an issue with an incorrect StartDate, btw. So it was in fact generating all bars.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1