Gamestudio Links
Zorro Links
Newest Posts
AssetAdd() vs. modern asset list?
by jcl. 02/21/24 15:01
How many still using A8
by Aku_Aku. 02/20/24 12:18
Zorro Trader GPT
by TipmyPip. 02/16/24 06:53
Support PEEK for time and calendar functions
by AndrewAMD. 02/14/24 22:23
Deeplearning Script
by tomaslolo. 02/07/24 18:28
The Super-System
by TipmyPip. 02/06/24 19:32
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Ayumi), 594 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
I don't understand time zones and BarZone at all #487077
01/10/23 02:06
01/10/23 02:06
Joined: Nov 2022
Posts: 13
Tampa Bay
B
bigsmack Offline OP
Newbie
bigsmack  Offline OP
Newbie
B

Joined: Nov 2022
Posts: 13
Tampa Bay
Sorry if this post is ridiculous. Thanks in advance if you make it through this monstrosity.

I think Zorro is the best thing since sliced bread so please don't get me wrong.

I've read the manual over and over. I've watched videos. I've tried all kinds of variations of BarZone and BarMode like this and that...

BarMode = BR_LOCAL;
AssetMarketZone = ET;
AssetMarketStart = 0930;
AssetMarketEnd = 1615;


//BarZone = EST;
//BarMode = BR_MARKET;

I don't understand it. I don't understand what the Market column of the Assets.csv file does.

Frankly the examples in the manual seem thin and kind of not-so-mainstream. Maybe I just need some sleep.

Tradestation has the symbol.D files and that excludes the night sessions which is what I want to do.

But I'm getting my data from MT4 platform so all that dirty night data is there. I've also got some from Tradestation and Sierra Charts too and need some basis for understanding those data in Zorro.

I'll open a support ticket if I must but maybe there are other threads or explanations how all this works because I'm making it way too complicated.

I wish somebody could help me conceptualize this because I hit the wall.

Here's how I think about it.

I can put a timezone like zzz:begintime-endtime in the Market column of the assets_blah.csv file.

My broker is Eightcap for this example. On the MT4 platform it seems like the time is UTC+2? Or minus 2 - I can't remember now. Does it matter?

On the MT4 chart, the Dow30 15 minute chart looks like it starts the day session at 15:30. That is 6 hours after 9:30. Then the last bar must me 22:00 (16:00 + 6hrs).

It looks like Zorro always uses UTC time - so it automatically converts all the files to the same time? I don't get it. That probably helps a ton and I'm trying to code around it.

So what do I put in the Market column in the Asset.csv?

UTC:15:30-23:45?
EST:9:30-16:00?

Should I leave it blank and use code?

Then what do I put in the script?

Do I still use the AssetMarketStart or is it automatically converted?

I run the backtest and the bars don't look like the day session and it is hard to debug.

Maybe a watch statement would help?

I just need some real world English explanation because the way the manual is written just loops my brain in to a big pile of spaghetti.

Re: I don't understand time zones and BarZone at all [Re: bigsmack] #487153
01/29/23 07:36
01/29/23 07:36
Joined: Apr 2019
Posts: 53
Canada
A
aelagha Offline
Junior Member
aelagha  Offline
Junior Member
A

Joined: Apr 2019
Posts: 53
Canada
I spent sometime experimenting and this is what I figured how it works. I may not be 100% correct, but this might help

Say, the data (historical or from broker) is in UTC. In your script, you want to use local times and align the bars with the local time zone. However, assets can be of different classes, on different exchanges in different time zones and have different trading hours. Zorro offers a couple of ways to handle this (as you might have a mix of assets with different local times and trding hours). Also, you could be isitting in a whole different time zone, and you want everything referenced to your time zone (local time zone)..

Set BarZone to the local time zone. Generated bars will alsign with the local times, i.e. start and end of day. BarZone becomes your reference. I am in EST, but I could be trading assets in WET, CET, etc. When I set BarZone=EST, all bars are adjusted to EST.

To specify the time zone and market hours for each asset, either:
- set that in your script using AssetMarketStart/AssetMarketEnd/AssetMarketZone, or
- set that in assetList file using zzz:hh:mm-hh:mm (for Market field). In this case, AssetMarketStart/AssetMarketEnd/AssetMArketZone will be set to what is in the assetList file. However, you can override them again in your script if you need too.

So you can jsut set time zones and market hours in assetList, and not worry about AssetMarketStart/End/Zone, unless you need to override that in your script for whatever reason.

The next thing is how and when to generate the bars, i.e. daily sessions (i.e. market hours), weekends, etc. This is determined by BarMode (among other things). For example, to generate bars during market hours only (i.e. 10:30-15:00) and no weekends, you set BarMode = BR_MARKET | BR_WEEKENDS. If you want bars 24hour a day but no weekends, BarMode = BR_FLAT | BR_WEEKEND, and bars for 24/7 BarMode = BR_FLAT, etc.

The weekend is determined by StartWeek and EndWeek, whihc you can leave to default or change in the script.

BR_LCOAL is special (to me anyways laugh as it sets Start/EndMarket to the local asset time zone and market hours, read from AssetMarketStart/End/Zone (and converted to your time zone ref, i.e. BarZone), and of course AssetMarketStart/End/Zone is either set in the script directly or read from assetList, as mentioned above.

As an example, I was interested in intraday 1min data for the SP500 future, which trades around the clock with daily session 09:30-17:00 EST. My 1-min historical data is in UTC, and I am in EST, and I am interrested in day seesion only. So, my doe is

BarPeriod = 1;
StartDate = 20221201;
EndDate = 20221205; // short range for verification
BarZone = EST;
BarMode = BR_LOCAL | BR_WEEKEND | BR_MARKET;

and in the assetList, I have EST:09:30-17:00. WeekStart/End defaults are just fine. This will generate bars Mon-Fri, from 09:30 to 16:59 EST. BEcause I have BR_LOCAL flag set, Start/EndMarket will automatically be updated to the market hours from AssetMarketStart/End/Zone, which in turn are read from assetList (and I do not need to change them in the script).

I hope this helps. It is very flexible and powerful and allows you to deal with many scenarios. With flexibility comes some complexity though.

Again, I may not be a 100% correct, but that is what I figured. I would love to hear any corrections/additions, as understanding this (and actually verifying it) is critical if you do intraday trading that explores time-of-day price behaviour.



Last edited by aelagha; 01/29/23 07:48.
Re: I don't understand time zones and BarZone at all [Re: bigsmack] #487154
01/29/23 07:54
01/29/23 07:54
Joined: Apr 2019
Posts: 53
Canada
A
aelagha Offline
Junior Member
aelagha  Offline
Junior Member
A

Joined: Apr 2019
Posts: 53
Canada
Correction:

I actually set WeekStart/End to:
StartWeek = 10001;
EndWeek = 52359;

to give me Mon to Fri only (the default StartWeek is on Sun).

Re: I don't understand time zones and BarZone at all [Re: bigsmack] #487155
01/29/23 08:04
01/29/23 08:04
Joined: Apr 2019
Posts: 53
Canada
A
aelagha Offline
Junior Member
aelagha  Offline
Junior Member
A

Joined: Apr 2019
Posts: 53
Canada
Another thing:

The reason I set asset time zones and market hours in the assetList is because I tried setting them in the script directly using AssetMarketStart/End/Zone, and I have the BR_LOCAL flag set, but the bars are geenerated according to the default market hours 9:30-15:59 (although according to the manual, it is supposed to work). I verified that when I do so, Start/Endaarket gets updated to the new hours, but still the default market hours are used. I posted a question on the forum, as I am not sure if it is a bug or if I am missing something. However, I found setting these in the aasetList file works whish is good for now till I figure out why it does not in the script.

Re: I don't understand time zones and BarZone at all [Re: aelagha] #487181
02/02/23 13:02
02/02/23 13:02
Joined: Nov 2022
Posts: 13
Tampa Bay
B
bigsmack Offline OP
Newbie
bigsmack  Offline OP
Newbie
B

Joined: Nov 2022
Posts: 13
Tampa Bay
Thank you so much aelagha for your detailed explanation! I'm sure your this will help many in the future. It surely helps me to understand these important concepts. I could just feel myself making it harder than it should be. So far so good with your advice :-)


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1