Gamestudio Links
Zorro Links
Newest Posts
FXCM demo test failed
by qin. 01/13/26 13:53
Camera always moves upwards?
by NeoDumont. 01/12/26 09:39
Alpaca Plugin v1.5.2 Release
by kzhao. 01/11/26 13:42
Alpaca Plugin v1.4.0
by kzhao. 01/11/26 13:38
separating groups of 3 digits by a comma
by joe_kane. 01/11/26 00:01
MRC.c and WFO
by joe_kane. 01/10/26 23:58
BarOffset (default = 940 for daily bars?
by joe_kane. 01/10/26 23:46
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 5,207 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
promfast, joe_kane, Namitha_NN, Syndrela, agasior
19190 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: 33
Q
qin Offline OP
Newbie
qin  Offline OP
Newbie
Q

Joined: Jan 2023
Posts: 33
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