Gamestudio Links
Zorro Links
Newest Posts
Alternative to Stooq for Zorro S
by cwford. 10/09/26 21:13
Stooq now requires an API key
by cwford. 10/08/26 23:27
ZorroGPT
by TipmyPip. 10/06/26 05:32
Purchase A8 full licence version
by jcl. 10/05/26 12:12
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
0 registered members (), 23,442 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
JimSimons, julienp, julienper, KelleyAbbey, Yopachi
19246 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,835
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,835
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