Gamestudio Links
Zorro Links
Newest Posts
New Lic: When does the Support clock start?
by Student_64151. 07/17/26 01:38
New Zorro version 3.11
by madpower2000. 07/16/26 13:49
What are you working on?
by NeoDumont. 07/15/26 16:38
Z9 getting Error 058
by jcl. 07/15/26 15:07
Zorro version 3.0 prerelease!
by madpower2000. 07/14/26 20:11
Accepting new programming clients
by AndrewAMD. 07/14/26 19:32
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
0 registered members (), 1,426 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
riggi89, shuhari, KD1990, Ephraim, Student_64151
19223 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
BarOffset (default = 940 for daily bars? #489063
01/03/26 04:31
01/03/26 04:31
Joined: Jan 2023
Posts: 53
Q
qin Offline OP
Junior Member
qin  Offline OP
Junior Member
Q

Joined: Jan 2023
Posts: 53
The document states that BarOffset (default = 940 for daily bars, otherwise 0), meaning the default BarOffset for daily bars is 940. However, in my tests with BarPeriod = 1440 (i.e., daily bars), the printed BarOffset remains 0, regardless of whether the underlying historical data consists of minute bars or EOD daily bars.

Any idea?

Re: BarOffset (default = 940 for daily bars? [Re: qin] #489085
01/10/26 23:46
01/10/26 23:46
Joined: Jan 2026
Posts: 4
Austria
J
joe_kane Offline
Guest
joe_kane  Offline
Guest
J

Joined: Jan 2026
Posts: 4
Austria
The default BarOffset = 940 for daily bars (BarPeriod = 1440) is an internal setting that Zorro only applies automatically if the asset is identified as a Stock (Type 1) in your asset list.


Here are the most likely reasons why you are seeing 0:

Asset Type: Check your .csv asset list. If the Type column is set to 0 (Generic/Forex) or any other value besides 1, Zorro uses the universal default of 0 (alignment at 00:00). For US stocks, ensure the Type is set to 1.
Order of Execution: If you print BarOffset at the very beginning of the run function before calling asset(), it will still show the global default. The asset-specific offset is only loaded after the asset is selected.
Data Source: Even if your historical data consists of minute bars, Zorro won't change the BarOffset unless the asset type specifically triggers it.


Recommendation: While Zorro aims to set these defaults, it is best practice to define the alignment explicitly in your script to avoid confusion across different brokers or asset lists:

c
void run() {
BarPeriod = 1440;
BarOffset = 9*60 + 40; // 940: Align with US market close (15:40 ET)
...
}

Note that 940 is the standard offset for US stocks because the last 1-minute bar of the session starts at 15:59 and ends at 16:00. 940 minutes after midnight is 15:40, which matches the bar timestamping logic (timestamp = bar start time).


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1