How to set global Asset,Bar Zone or AssetFrame?

Posted By: TedMar

How to set global Asset,Bar Zone or AssetFrame? - 06/11/20 23:38

Hi, i looking for resolve a simple resolution to set Zone,Bars and Market in EST (New York)
i.e.
load History t.6 from SPY with UTC Time Stamps
Local Maschine is CEST (UTC +2)

Code
function run() 
{
	
	StartDate = 20200301;
        EndDate = 20200314;
	
        AssetZone = EST;
	AssetMarket = EST;
	BarZone = EST;
	
	StartMarket = 0930;
	EndMarket = 1600;
	
	BarMode = BR_MARKET;


	set(LOGFILE+PLOTNOW);
	setf(PlotMode, PL_FINE);
	
	// HistoryZone = UTC;
	
        BarPeriod = 5;
	
	asset("SPY");

	vars Prices = series(priceClose());


}


code NOT WORKS for me...

i would like see every Day start Market at 9:30 before and after Daylight Saving switch too (9 March)

How i can set SPY in EST zone?




v2.27.7b




Posted By: Spirit

Re: How to set global Asset,Bar Zone or AssetFrame? - 06/12/20 09:43

Variables beginning with "Asset..." are for the selected asset, so they make not much sense in your code before selecting an asset. But BarZone is ok.

https://manual.zorro-project.com/assetzone.htm

Posted By: TedMar

Re: How to set global Asset,Bar Zone or AssetFrame? - 06/12/20 12:21

Originally Posted by Spirit
Variables beginning with "Asset..." are for the selected asset, so they make not much sense in your code before selecting an asset. But BarZone is ok.

https://manual.zorro-project.com/assetzone.htm


im not clear about it, if i set AssetZone in Asset block , can't see any changes.
is possible u write down an example?
THX
Posted By: Grat

Re: How to set global Asset,Bar Zone or AssetFrame? - 06/12/20 12:37

try this...
Code
function run() 
{
	
	StartDate = 20200301;
        EndDate = 20200314;
	
	BarZone = EST;
        BarPeriod = 5;
	BarMode = BR_MARKET;
	
	StartMarket = 0930;
	EndMarket = 1600;
	set(LOGFILE+PLOTNOW);
	setf(PlotMode, PL_FINE);
	
	// HistoryZone = UTC;
	
	
	asset("SPY");
        AssetZone = EST;
	AssetMarket = EST;

	vars Prices = series(priceClose());
}
Posted By: Grat

Re: How to set global Asset,Bar Zone or AssetFrame? - 06/12/20 12:38

AssetZone

Time zone of the current asset, used for setting AssetFrame to a daily TimeFrame that begins at FrameOffset in local time. When your strategy contains a portfolio of different assets that you want to trade daily at different times, use this parameter to define the time frames of individual assets.
Posted By: TedMar

Re: How to set global Asset,Bar Zone or AssetFrame? - 06/12/20 15:08

Originally Posted by Grat
AssetZone

Time zone of the current asset, used for setting AssetFrame to a daily TimeFrame that begins at FrameOffset in local time. When your strategy contains a portfolio of different assets that you want to trade daily at different times, use this parameter to define the time frames of individual assets.

Grat u code not works , i changed time frame to 30 for better log.
Code

[169: Thu 20-03-05 20:00] (302.34)
[170: Thu 20-03-05 20:30] (300.65)
[171: Fri 20-03-06 14:30] (293.18)  // pre Daylight Saving    (14:30)
[172: Fri 20-03-06 15:00] (293.34)
[173: Fri 20-03-06 15:30] (296.42)
[174: Fri 20-03-06 16:00] (297.09)
[175: Fri 20-03-06 16:30] (295.14)
[176: Fri 20-03-06 17:00] (294.94)
[177: Fri 20-03-06 17:30] (293.21)
[178: Fri 20-03-06 18:00] (294.56)
[179: Fri 20-03-06 18:30] (295.59)
[180: Fri 20-03-06 19:00] (293.66)
[181: Fri 20-03-06 19:30] (293.46)
[182: Fri 20-03-06 20:00] (291.01)
[183: Fri 20-03-06 20:30] (292.19)
[184: Sat 20-03-07 14:30] (282.81)  //  Sat?
[185: Mon 20-03-09 13:30] (275.30) // after Daylight Saving (13:30)
[186: Mon 20-03-09 14:00] (279.87)
[187: Mon 20-03-09 14:30] (280.75)
[188: Mon 20-03-09 15:00] (278.62)
[189: Mon 20-03-09 15:30] (281.06)
[190: Mon 20-03-09 16:00] (282.70)
[191: Mon 20-03-09 16:30] (281.02)
[192: Mon 20-03-09 17:00] (279.72)
[193: Mon 20-03-09 17:30] (278.61)
[194: Mon 20-03-09 18:00] (275.83)
[195: Mon 20-03-09 18:30] (274.95)
[196: Mon 20-03-09 19:00] (276.62)
[197: Mon 20-03-09 19:30] (277.91)
[198: Tue 20-03-10 13:30] (284.64)   // after Daylight Saving 
[199: Tue 20-03-10 14:00] (282.64)


How i get 9:30 start Session?
Posted By: Spirit

Re: How to set global Asset,Bar Zone or AssetFrame? - 06/13/20 08:43

All this is wrong, here is it fixed:

Code
function run() 
{
	StartDate = 20200301;
        EndDate = 20200314;
	
	BarZone = EST;
        BarPeriod = 5;
	setf(BarMode,BR_MARKET);
	
	StartMarket = 0930;
	EndMarket = 1600;
	set(LOGFILE+PLOTNOW);
	
	asset("SPY");
	vars Prices = series(priceClose());
}
Posted By: TedMar

Re: How to set global Asset,Bar Zone or AssetFrame? - 06/13/20 14:38

Originally Posted by Spirit
All this is wrong, here is it fixed:


?? Result is same , No session start @ 9:30 , and shift @ Daylight Saving

Code
function run() 
{
	StartDate = 20200305;
        EndDate = 20200311;
	
	BarZone = EST;
        BarPeriod = 30;
	setf(BarMode,BR_MARKET);
	
	StartMarket = 0930;
	EndMarket = 1600;
	set(LOGFILE+PLOTNOW);
	
	asset("SPY");
	vars Prices = series(priceClose());
}



Log
Code
End of lookback period

[143: Thu 20-03-05 14:30] (304.99)
[144: Thu 20-03-05 15:00] (304.59)
[145: Thu 20-03-05 15:30] (305.55)
[146: Thu 20-03-05 16:00] (306.03)
[147: Thu 20-03-05 16:30] (307.94)
[148: Thu 20-03-05 17:00] (305.75)
[149: Thu 20-03-05 17:30] (304.47)
[150: Thu 20-03-05 18:00] (302.49)
[151: Thu 20-03-05 18:30] (303.08)
[152: Thu 20-03-05 19:00] (303.50)
[153: Thu 20-03-05 19:30] (301.43)
[154: Thu 20-03-05 20:00] (302.34)
[155: Thu 20-03-05 20:30] (300.65)
[156: Fri 20-03-06 14:30] (293.18)       //14:30 Winter (Daylight Saving)
[157: Fri 20-03-06 15:00] (293.34)
[158: Fri 20-03-06 15:30] (296.42)
[159: Fri 20-03-06 16:00] (297.09)
[160: Fri 20-03-06 16:30] (295.14)
[161: Fri 20-03-06 17:00] (294.94)
[162: Fri 20-03-06 17:30] (293.21)
[163: Fri 20-03-06 18:00] (294.56)
[164: Fri 20-03-06 18:30] (295.59)
[165: Fri 20-03-06 19:00] (293.66)
[166: Fri 20-03-06 19:30] (293.46)
[167: Fri 20-03-06 20:00] (291.01)
[168: Fri 20-03-06 20:30] (292.19)
[169: Mon 20-03-09 13:30] (275.30)  //13:30 Summer (Daylight Saving)
[170: Mon 20-03-09 14:00] (279.87)
[171: Mon 20-03-09 14:30] (280.75)
[172: Mon 20-03-09 15:00] (278.62)
[173: Mon 20-03-09 15:30] (281.06)
[174: Mon 20-03-09 16:00] (282.70)
[175: Mon 20-03-09 16:30] (281.02)
[176: Mon 20-03-09 17:00] (279.72)
[177: Mon 20-03-09 17:30] (278.61)
[178: Mon 20-03-09 18:00] (275.83)
[179: Mon 20-03-09 18:30] (274.95)
[180: Mon 20-03-09 19:00] (276.62)
[181: Mon 20-03-09 19:30] (277.91)
[182: Tue 20-03-10 13:30] (284.64)
[183: Tue 20-03-10 14:00] (282.64)
[184: Tue 20-03-10 14:30] (282.36)
[185: Tue 20-03-10 15:00] (278.61)
[186: Tue 20-03-10 15:30] (274.91)
[187: Tue 20-03-10 16:00] (275.47)
[188: Tue 20-03-10 16:30] (277.59)
[189: Tue 20-03-10 17:00] (278.37)


Any idea more to resolve them?

Attached picture 2020-06-13 16_32_26-Window.png
Posted By: Grat

Re: How to set global Asset,Bar Zone or AssetFrame? - 06/13/20 17:39

Ok,

question, you are downloaded data from?
Posted By: TedMar

Re: How to set global Asset,Bar Zone or AssetFrame? - 06/13/20 19:20

Originally Posted by Grat
Ok,

question, you are downloaded data from?


https://zorro-project.com/download.php

Historical Data Archives

SPY M1 & EOD Options 2011+ - Price & option chain history (t6/t8 formats, 150 MB, free)
Posted By: Grat

Re: How to set global Asset,Bar Zone or AssetFrame? - 06/14/20 04:32

Try source data with ZhistoryEditor
Posted By: TedMar

Re: How to set global Asset,Bar Zone or AssetFrame? - 06/14/20 07:45

Originally Posted by Grat
Try source data with ZhistoryEditor

sorry i not understand, what is your idea. Hunderts of assets to Edit?

in fact the quest is very simple. I'm surprised it's so hard to set such simple adjustments.
Posted By: Spirit

Re: How to set global Asset,Bar Zone or AssetFrame? - 06/14/20 08:06

Maybe its unclear what you want to adjust. Bar zone and market time are already set, so what is still the problem?

If there is a bar or not at a certain hour has nothing to do with your code, but with the historical data.
Posted By: TedMar

Re: How to set global Asset,Bar Zone or AssetFrame? - 06/14/20 08:16

@Spirt , u have idea why i don't get bar Result Session start 9:30? U have result 9:30 with this code and SPY datafeed from Zorro Download page?
Posted By: Spirit

Re: How to set global Asset,Bar Zone or AssetFrame? - 06/14/20 08:21

Do you mean 9:30 in the log? The log is UTC.
Posted By: TedMar

Re: How to set global Asset,Bar Zone or AssetFrame? - 06/14/20 08:59

Originally Posted by Spirit
Do you mean 9:30 in the log? The log is UTC.

Result log, yes

I confused now laugh , if i leave BarZone from code , result is TimeStamp is ok, but DATA is UTC + 1 ,+2 (wrong)

Code

function run() 
{
	StartDate = 20200305;
        EndDate = 20200311;
	
	// BarZone = EST;       
        BarPeriod = 30;
	setf(BarMode,BR_MARKET);
	
	StartMarket = 0930;
	EndMarket = 1600;
	set(LOGFILE+PLOTNOW);
	
	asset("SPY");
	vars Prices = series(priceClose());
}






Code
154: Thu 20-03-05 15:00] (304.59)
[155: Thu 20-03-05 15:30] (305.55)
[156: Fri 20-03-06 09:30] (298.14) // ok
[157: Fri 20-03-06 10:00] (295.84)
[158: Fri 20-03-06 10:30] (294.21)
[159: Fri 20-03-06 11:00] (294.40)
[160: Fri 20-03-06 11:30] (293.79)
[161: Fri 20-03-06 12:00] (294.51)
[162: Fri 20-03-06 12:30] (293.79)
[163: Fri 20-03-06 13:00] (293.32)
[164: Fri 20-03-06 13:30] (293.35)
[165: Fri 20-03-06 14:00] (293.34)
[166: Fri 20-03-06 14:30] (293.18)
[167: Fri 20-03-06 15:00] (293.34)
[168: Fri 20-03-06 15:30] (296.42)
[169: Mon 20-03-09 09:30] (281.97)  // ok
[170: Mon 20-03-09 10:00] (279.99)
[171: Mon 20-03-09 10:30] (280.70)
[172: Mon 20-03-09 11:00] (279.75)
[173: Mon 20-03-09 11:30] (278.30)
[174: Mon 20-03-09 12:00] (278.49)
[175: Mon 20-03-09 12:30] (276.18)
[176: Mon 20-03-09 13:00] (277.38)
[177: Mon 20-03-09 13:30] (275.30)
[178: Mon 20-03-09 14:00] (279.87)
[179: Mon 20-03-09 14:30] (280.75)
[180: Mon 20-03-09 15:00] (278.62)
[181: Mon 20-03-09 15:30] (281.06)
[182: Tue 20-03-10 09:30] (286.40) 
[183: Tue 20-03-10 10:00] (288.05)
[184: Tue 20-03-10 10:30] (287.35)
[185: Tue 20-03-10 11:00] (288.01)
[186: Tue 20-03-10 11:30] (286.20)
[187: Tue 20-03-10 12:00] (286.00)
[188: Tue 20-03-10 12:30] (283.78)
[189: Tue 20-03-10 13:00] (284.38)
[190: Tue 20-03-10 13:30] (284.64)
[191: Tue 20-03-10 14:00] (282.64)
[192: Tue 20-03-10 14:30] (282.36)
[193: Tue 20-03-10 15:00] (278.61)



i try now with other Instrument and history
Posted By: Zheka

Re: How to set global Asset,Bar Zone or AssetFrame? - 06/14/20 09:41

The log is in UTC, while StartMarket/EndMarket are in EST (BarZone=ET). So, all is *mostly* correct in the log.

Except Zorro treats end times as "exclusive of" the specified time, i.e. EndMarket=1600 will NOT include the bar ending at 16:00; you have to set EndMarket=1601 to include the last 30-min bar into the day. (this logic is technically correct for ticks, but not for bars- which are timestamped by Zorro itself by the end time "inclusive of ").

Also, StartMarket=9:30 does NOT mean that your trading day will start from 9:30 (as you would expect). Rather, this is a timestamp(=END) of the first bar in a trading day.
And where it starts depends on the BarMode, EndMarket and available price history in the file (with the current script you get an "overnight" bar spanning 15:30-9:30).

Set Verbose=3 to see bar open and close prices and construct the "price candles" the way you need .
Posted By: TedMar

Re: How to set global Asset,Bar Zone or AssetFrame? - 06/14/20 16:15

The Session Start  @9:30 is in Zorro default , then TimeStamp in log is correct , but data is from local Machine (CET +1 /CEST +2) @9:30  
if set BarZone to EST , this changed session start in UTC.
Im totally confused. 
Please.... I would like set EST Zone Time+Data (New York) MARKET i environment with correct Data  from UTC History only. 

 How?
© 2024 lite-C Forums