1 registered members (AndrewAMD),
1,248
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Market hours for Globex
#469789
12/08/17 17:37
12/08/17 17:37
|
Joined: Jul 2017
Posts: 785
Zheka
OP
User
|
OP
User
Joined: Jul 2017
Posts: 785
|
What's the correct way to set-up in Zorro a Globex session - which starts at 1800 ET and ends at 1700 ET.? BarPeriod=20; AssetMarket=ET; StartMarket=1800; EndMarket=1700; does not work - market(ET,0) is always false. Would be great if Zorro could internally recognize and correctly handle situations when StartMarket>EndMarket. BarPeriod=20; FrameOffset=18*3;
AssetMarket=ET; TimeFrame=AssetFrame; does not work either.. regardless of FrameOffset market(ET,0) equals true for a period from 9:20 to 15:40.. Please help.
|
|
|
Re: Market hours for Globex
[Re: jcl]
#470358
01/09/18 20:43
01/09/18 20:43
|
Joined: Jul 2017
Posts: 785
Zheka
OP
User
|
OP
User
Joined: Jul 2017
Posts: 785
|
JCL, to work around the EndM>StartM limitation, I have played with StartMarket/EndMarket as follows: StartMarket=000; EndMarket=1701; if (time>=1716) { StartMarket= 1717; EndMarket=2359;} AssetMarket=ET; Weekend=1+8;
TimeFrame=AssetFrame; It works and correctly handles 1700 ET close -> 1715 ET start transition. But then the first bar of the new day - 015 ET- is skipped for some reason. [490: Wed 16-05-11 03:55] (123.89)n AssetFrame=1 ET Time=2355, O= 123.93600, C= 123.89200
[491: Wed 16-05-11 04:15] (123.89) [492: Wed 16-05-11 04:35] (123.86)n AssetFrame=-1 ET Time=35, O= 123.89200, C= 123.86300
[493: Wed 16-05-11 04:55] (123.82)n AssetFrame=1 ET Time=55, O= 123.86300, C= 123.81700
Interestingly, if I only leave the session as 000-1701, the first frame/bar is indeed 015, as expected.
|
|
|
Re: Market hours for Globex
[Re: Zheka]
#470363
01/09/18 23:06
01/09/18 23:06
|
Joined: Jul 2017
Posts: 785
Zheka
OP
User
|
OP
User
Joined: Jul 2017
Posts: 785
|
I added one debugging line to the above code: TimeFrame=AssetFrame; if (time==016) printf("#TimeFrame: %i, ET Time: %i, StartMarket: %i, EndMarket: %i",TimeFrame,time,StartMarket,EndMarket); Despite time being in between Start- and EndMarket, AssetFrame somehow is =0. [491: Wed 16-05-11 03:56] (123.88)n AssetFrame=1 ET Time=2356, O= 123.95100, C= 123.87800
[492: Wed 16-05-11 04:16] (123.89)TimeFrame: 0, ET Time: 16, StartMarket: 0, EndMarket: 1701
[493: Wed 16-05-11 04:36] (123.86)n AssetFrame=-1 ET Time=36, O= 123.87800, C= 123.85700 This looks incorrect.
|
|
|
Re: Market hours for Globex
[Re: Zheka]
#470368
01/10/18 11:14
01/10/18 11:14
|
Joined: Jul 2000
Posts: 27,987 Frankfurt
jcl
Chief Engineer
|
Chief Engineer
Joined: Jul 2000
Posts: 27,987
Frankfurt
|
It is not clear what you want to do. Do you want to skip bars outside market hours, or do you want not to trade outside market hours? If you want to skip bars, then do not change StartMarket and EndMarket, or else you will of course get strange results when you do that in the middle of a frame. If you just want not to trade, then do not set TimeFrame, since that skips bars. All about skipping bars and using TimeFrame can be read here: http://manual.zorro-project.com/barperiod.htm. You can skip any time period on any market condition that you want when you understood the mechanism.
|
|
|
Re: Market hours for Globex
[Re: jcl]
#470371
01/10/18 16:27
01/10/18 16:27
|
Joined: Jul 2017
Posts: 785
Zheka
OP
User
|
OP
User
Joined: Jul 2017
Posts: 785
|
JCL, I want to correctly construct bars and higher "timeframe" bars - this feeds all system calculations. For a portfolio of systems with different bar periods, I need to set the BarPeriod to the "largest common divisor" of all systems and simulate the needed ones with timeframes. All my systems also need a secondary time frame (daily) in their calculations. Now, for FX (IB), there are M1 bars from 1715 to 1700 ET, but I only want to base my calculations on data from 1716 to 1645(-58) ET. After 2.5 days of trying, I am still unable to achieve what I want: 1) TF>1 just counts *TF number of bars*. But because there are no M1 bars from 1700-1715 and because there is a bug with Weekend>2+ (it still creates a weekend bar) - all Frames get continuously shifted and are incorrect. Also, there is still a bug with StartWeek: with Weekend=2-3, setting StartWeek<2200 does not work - week starts from 2200+ in any case 2) BarPeriod=5 - frameSync(4) almost works. But there is an unneeded frame ending 1716 which covers 1656-1716. Skipping bars to avoid is not helping - frameSync somehow behaves unpredictably.. [855: Wed 16-05-11 20:56] (123.88)n FrameOffset: 3, SkipBars: 0, AssetFrame=-3 ET Time=1656, O= 123.89500, C= 123.87600 [856: Wed 16-05-11 21:01] (123.90) Skiping.. Time= 1701, skipBars= -1 [857: Wed 16-05-11 21:16] (123.87) Skiping.. Time= 1716, skipBars= -2 [858: Wed 16-05-11 21:21] (123.93) Skiping.. Time= 1721, skipBars= -3 [859: Wed 16-05-11 21:26] (123.88) Skiping.. Time= 1726, skipBars= -4 [860: Wed 16-05-11 21:31] (123.92) Skiping.. Time= 1731, skipBars= -5
[861: Wed 16-05-11 21:36] (123.93)n FrameOffset: 3, SkipBars: -5, AssetFrame=-3 ET Time=1736, O= 123.87400, C= 123.93200
[862: Wed 16-05-11 21:41] (123.90)n FrameOffset: 3, SkipBars: 0, AssetFrame=-5 ET Time=1741, O= 123.95000, C= 123.90500- ?? WHY?
[863: Wed 16-05-11 21:46] (123.91) [864: Wed 16-05-11 21:51] (123.91) [865: Wed 16-05-11 21:56] (123.91)n FrameOffset: 3, SkipBars: 0, AssetFrame=-3 ET Time=1756, O= 123.93200, C= 123.91200 3) AssetFrame requires setting BarPeriod=desired TF, but can be suitable. But AssetFrame doesnt work as expected. Start/EndMarket are just variables and changing them is ok and practically works. Please review my previous message. 4) "Skipping bars mechanism does not work as intended - Skipping bars only works when TF=1(BarPeriod). Higher TF do not work in practice - see p1, nor using frameSync - see p2. - there is a key bug with frame formation. Open/highs/lows of skipped bars are not really skipped, still counted in the veeery long TF. Please, answer my other post. - most importantly and critically, setting a TF to a negative value after skipping bars technically creates a new frame (frame(0)=1). which has open= close of previous frame (current,incorrect) or open of 'TimeFrame' minutes ago (correct) close=current bar close; High/Low = within the period from Open to close; What shall one do with this extra Frame which covers unneeded hours? How can it be skipped? May I suggest that setting TimeFrame to a negative number just starts the Frame and at this moment frame(0) returns 0? Daily TF.Assuming there are M1 data 24/5, what's the way to construct a series of *Daily* bars (as a secondary TF in a system with BarPeriod=5) which only cover Regular Trading Hours, say, from 8:30 to 15:30ET? Your advise is highly appreciated.
|
|
|
Re: Market hours for Globex
[Re: jcl]
#470400
01/11/18 16:50
01/11/18 16:50
|
Joined: Jul 2017
Posts: 785
Zheka
OP
User
|
OP
User
Joined: Jul 2017
Posts: 785
|
Ok! This code function run() { set(LOGFILE); BarOffset=1; BarPeriod=5; StartWeek=72000; EndWeek=52100; Weekend=1; } generates this output with Weekend=1 [1868: Fri 16-05-13 20:56] (122.82)n FrameOffset: 0, timeFrame=1 ET Time=1656, O= 122.80200, C= 122.82400
[1869: Fri 16-05-13 21:01] (122.99)n FrameOffset: 0, timeFrame=1 ET Time=1701, O= 122.82400, C= 122.98700
[1870: Sun 16-05-15 21:21] (122.85)n FrameOffset: 0, timeFrame=1 ET Time=1721, O= 122.94500, C= 122.84800
[1871: Sun 16-05-15 21:26] (122.86)n FrameOffset: 0, timeFrame=1 ET Time=1726, O= 122.86400, C= 122.86400 and this - with Weekend=2; [1858: Fri 16-05-13 20:51] (122.80)n FrameOffset: 0, timeFrame=1 ET Time=1651, O= 122.80300, C= 122.80200
[1859: Fri 16-05-13 20:56] (122.82)n FrameOffset: 0, timeFrame=1 ET Time=1656, O= 122.80200, C= 122.82400
[1860: Sun 16-05-15 22:01] (122.87)n FrameOffset: 0, timeFrame=1 ET Time=1801, O= 122.82400, C= 122.87300
[1861: Sun 16-05-15 22:06] (122.85)n FrameOffset: 0, timeFrame=1 ET Time=1806, O= 122.84600, C= 122.84700 1) StartWeek with Weekend=2 keeps its default value of 2200. 2) There is indeed no extra weekend bar; must have been fixed in the new ver. 3) It will be very useful to have StartWeek/EndWeek precision down to a minute. Why not? There needs to be an ability to "end the week" at the desired time: close all bars/timeframes at that time, not generate any bars nor timeframes during the weekend, and similarly start the week at StartWeek ( start the first bar at StartWeek) Would it be possible to add such a mode to Weekend? Together with StartMarket/EndMarket, this would help emulate the concept of "Sessions" commonly used in other software.
|
|
|
|