Gamestudio Links
Zorro Links
Newest Posts
zorro with ccxt?
by opm. 03/03/26 03:17
ZorroGPT
by TipmyPip. 03/02/26 18:13
WFO Training with parallel cores Zorro64
by Martin_HH. 02/26/26 16:03
Zorro version 3.0 prerelease!
by TipmyPip. 02/25/26 16:38
Camera always moves upwards?
by clonman. 02/21/26 09:29
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (AndrewAMD, TipmyPip), 5,278 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
the1, alx, ApprenticeInMuc, PatrickH90, USER0328
19200 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: 52
Q
qin Offline OP
Junior Member
qin  Offline OP
Junior Member
Q

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