Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (Nymphodora, AndrewAMD, TipmyPip, Quad, Imhotep), 824 guests, and 4 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
Page 1 of 3 1 2 3
Market hours for Globex #469789
12/08/17 17:37
12/08/17 17:37
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
What's the correct way to set-up in Zorro a Globex session - which starts at 1800 ET and ends at 1700 ET.?
Quote:
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.

Quote:
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: Zheka] #469808
12/09/17 08:47
12/09/17 08:47
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
The start time must be earlier than the end time. You could work around the problem by selecting a different time zone where this is the case. Alternatively, set TimeFrame directly for skipping the hour at 17:00.

Re: Market hours for Globex [Re: jcl] #470358
01/09/18 20:43
01/09/18 20:43
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
JCL,
to work around the EndM>StartM limitation, I have played with StartMarket/EndMarket as follows:
Quote:
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.

Quote:
[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: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
I added one debugging line to the above code:

Quote:
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.
Quote:
[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,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
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: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
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..
Quote:
[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: Zheka] #470387
01/11/18 12:01
01/11/18 12:01
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Ok. For avoiding a complete confusion with your multitude of issues in as many threads, let's systematically address your problems one after the other, starting here with the first one.

>>1) TF>1 just counts *TF number of bars*. <<

Right.

>>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.<<

Can you explain that "bug with Weekend>2+", possibly with a reproducible example?

Re: Market hours for Globex [Re: jcl] #470400
01/11/18 16:50
01/11/18 16:50
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
Ok!

This code
Quote:
function run()
{
set(LOGFILE);
BarOffset=1;
BarPeriod=5;

StartWeek=72000;
EndWeek=52100;


Weekend=1;
}

generates this output with Weekend=1
Quote:
[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;
Quote:
[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.

Re: Market hours for Globex [Re: Zheka] #470405
01/12/18 10:19
01/12/18 10:19
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
http://manual.zorro-project.com/bars.htm

The duration of a 5 minutes bar is 5 minutes. If it's weekend or if the history contains no prices, the bar ends at the next multiple of 5 minutes. I think for most users this is not very surprising. Nothing wrong with StartWeek. If you want a bar to start at a particular minute, use either 1 minutes bars, or a bar offset. For doing something exactly at market open, I would not tamper with bars anyway, but just compare the time.

Your next issue: >>BarPeriod=5 - frameSync(4) almost works.<<

This works not almost, it works not at all. frameSync() is for synchronizing to full hours. frameSync(4) is not a full hour. frameSync(12) would be a full hour. Again the manual is your friend: http://manual.zorro-project.com/frame.htm

Re: Market hours for Globex [Re: jcl] #470406
01/12/18 12:02
01/12/18 12:02
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
Let's finish with StartWeek.

The script sets StartWeek to 2000. The M1 bars are available from 2115 and Weekend=1 shows that.
Why with Weekend=2 the first bar on Sunday is 2201? And not 2116 or 2121?

Page 1 of 3 1 2 3

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