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
1 registered members (degenerate_762), 1,098 guests, and 2 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 2 1 2
Trading Hours again using latest add-on... #471572
03/10/18 10:52
03/10/18 10:52
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline OP
User
MatPed  Offline OP
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
Hi,
I would like to trade an asset only during the allowed frame. The asset is US-SPX-500 and, accordingly with my broker Oanda can be traded:
Sun-Thu: 23:00 - 21:14; 21:30 - 21:59
Thu-Fri: 23:00 - 21:14; 21:30 - 21:59
GMT Time
Code:
WeekEnd = 4+8;
AssetFrame = UTC;
StartMarket = 23; (or StartMarket = 0; ?)
EndMarket = 2159;


Now if the barperiod is high the gap between 21:14 and 21:30 is not relevant and
Code:
if(!suspended()) enterLong();


should make the trick.

Questions:
- in a multi-asset TS is the approach correct?
- StartMarket 23 o 0?
- to handle the trading gap between the only way is to check the time with lhour() and minute()?

Thank you in advance

Last edited by MatPed; 03/10/18 10:54.
Re: Trading Hours again using latest add-on... [Re: MatPed] #471578
03/10/18 12:44
03/10/18 12:44
Joined: Jul 2017
Posts: 783
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 783
It is a US-traded asset, so use AssetMarket=ET - which will take care of DST.
In your example, StartMarket=2300 (why 23??). Since market() does not work correctly when Start>End, you will have to dynamically change StartMarket depending on the hour/minute.
I did not test if suspended() would do the trick in such a case.

Also, be aware that in Zorro EndMarket=2159 excludes 2159 (despite the whole world around works otherwise). You will have to set it to +1min to make it work as expected.
This will be important to handle bar construction around weekend.

If you use the same BarPeriod across assets, then working with AssetMarket/AssetFrame will be ok.
However, since your data contains gaps, standard frame construction(which just counts bars) will produce incorrect frames (unless you use full-hour frames and framesync() them to start from the same hour every 24-hrs).

If different StartMarket/EndMarket per asset in the same zone will work correctly - I am not sure; probably not.

If end of your Bar/Frame falls onto the gap - you will then have to use lhour() and minute(). What's wrong with it?

Re: Trading Hours again using latest add-on... [Re: Zheka] #471584
03/10/18 15:45
03/10/18 15:45
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline OP
User
MatPed  Offline OP
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
Zheka, thank you for your reply, but I do not understand.
The US SPX 500 can be traded.

Sun-Thu: 23:00 - 21:14; 21:30 - 21:59
Thu-Fri: 23:00 - 21:14; 21:30 - 21:59
GMT Time

or (is equivalent)

Sun-Thu: 17:00 - 15:14; 15:30 - 15:59
Thu-Fri: 17:00 - 15:14; 15:30 - 15:59
Chicago Time not ET

can you suggest me how to properly set:
- Weekend
- AssetMarket
- StartMarket
- EndMarket

Thank You





Last edited by MatPed; 03/10/18 15:45.
Re: Trading Hours again using latest add-on... [Re: MatPed] #471588
03/10/18 17:02
03/10/18 17:02
Joined: Jul 2017
Posts: 783
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 783
It will be 18:00 - 17:00 ET, isnt' it?

StartWeek=72100;
EndWeek=52200;
Weekend=1+8;

If you only plan to trade US assets/FX and trade during all of the open hours, then there is no need for setting AssetMarket/StartMarket.

If you want to restrict your trading to stock exchange trading hours (while there are bars available for 23 hours), then you would use:

AssetMarket=ET;
StartMarket=900;
EndMarket=1500;

Re: Trading Hours again using latest add-on... [Re: Zheka] #471590
03/10/18 17:21
03/10/18 17:21
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline OP
User
MatPed  Offline OP
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
I don't think it will work.
I am trading several assets with different market time. The VPS and the broker's server is UTC time. Oanda stops the server during weekend. For stability purposes is better to use Weekend = 4 I guess that start week will mess up everything. I do not want to restrict trading to stock Exchange Trading Hours.

Zheka, have you experienced with this setting in a TS Live? I want to fine tune a 23 assets TS already live. Zorro syncronize all the orders placed outside market hours, but the broker server send me a lot of error messages. On top of that the broker is aware, in advance, what I am willing to do. Oanda is a MM...


Last edited by MatPed; 03/10/18 17:22.
Re: Trading Hours again using latest add-on... [Re: MatPed] #471592
03/10/18 17:42
03/10/18 17:42
Joined: Jul 2017
Posts: 783
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 783
What I wrote is "conceptual" and should work in Test mode.
VPS/broker's server actual time zone has no bearing on your system.
Since you trade different time zones, just use ltod,etc with the zone of the respective asset.
I do not have experience trading through Oanda live and tuning systems for that.

Re: Trading Hours again using latest add-on... [Re: Zheka] #471593
03/10/18 17:55
03/10/18 17:55
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline OP
User
MatPed  Offline OP
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
Thank you for your help and honesty.

From the manual:
Make sure that the time and the time zone of the VPS is set up correctly. It does not matter which time zone - you can either use your PC's time zone, or the VPS time zone, or any other time zone - but the VPS time must be correct and match the zone. If it is wrong, Zorro will display a wrong UTC time in the server window, and strategies based on market open and close times - such as gap trading - won't work anymore. If in doubt, set the VPS to the time and time zone of your PC at home.

Re: Trading Hours again using latest add-on... [Re: MatPed] #471602
03/10/18 19:50
03/10/18 19:50
Joined: Jul 2017
Posts: 783
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 783
The manual means that if you specify your VPS time zone as UTC (in Windows), then make sure that the date,hour and the minute actually reflect UTC time.

In live trading Zorro timestamps incoming ticks (and ends bars) as per local computer time (+/- time zone difference vs. UTC).
So, it is quite important to regularly sync your computer clock to the atomic reference.
There are several utilities for that and a number of different servers to sync to. Google is your friend.

Re: Trading Hours again using latest add-on... [Re: Zheka] #471603
03/10/18 20:07
03/10/18 20:07
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline OP
User
MatPed  Offline OP
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
Yes, you said that "VPS/broker's server actual time zone has no bearing on your system", but it is not fully correct.
In order to avoid issue I have aligned, VPS, Zorro and Broker Server Time. On top of this there is the weekend downtime of the server to take in consideration.

I can setup a demo account and test the different settings, but it is time consuming. I was looking for somebody with "live" experience in order to reduce the effort.

Last edited by MatPed; 03/10/18 20:08.
Re: Trading Hours again using latest add-on... [Re: MatPed] #471606
03/10/18 20:38
03/10/18 20:38
Joined: Jul 2017
Posts: 783
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 783
Quote:
VPS/broker's server actual time zone has no bearing on your system.
is in line with
Quote:
It does not matter which time zone - you can either use your PC's time zone, or the VPS time zone, or any other time zone - but the VPS time must be correct and match the zone
Anyway, wishing you a good deal of luck.

Page 1 of 2 1 2

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