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
3 registered members (AndrewAMD, Nymphodora, Quad), 923 guests, and 5 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
Asset traded only few hours a day #464776
03/10/17 13:20
03/10/17 13:20
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,
is there a way to test in advance if the selected asset is tradable before opening a trade?

I know that I can check if I am within the market hours but it deals to an hard to be maintained c code in a multiasset script.

Thank you

Re: Asset traded only few hours a day [Re: MatPed] #464828
03/14/17 08:46
03/14/17 08:46
Joined: Feb 2017
Posts: 8
Veli Offline
Newbie
Veli  Offline
Newbie

Joined: Feb 2017
Posts: 8
Hi MatPet smile

I'm checking for the trading hours of the market insinde the asset loop with an if statement. I don't think that the code is hard to maintain. But i may have missend an issure with it. In this case i'd be happy to get informed wink

Code:
function run()
{
	int start = 0;
	int end = 0;
	
	while(asset(loop("GER30", "SPX500")))
	{
		if(Asset == "GER30")
		{
			start = 900;
			end = 1700;
		}
		else if(Asset == "SPX500")
		{
			start = 1100;
			end = 1900;
		}
		
		if(ltod(CET) >= start && ltod(CET) <= end)
		{
			yourStrategy();
		}
	}
}



If there is a better way i'd also like to know smile

Best wishes

Veli

Re: Asset traded only few hours a day [Re: Veli] #464832
03/14/17 13:02
03/14/17 13:02
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline OP
User
MatPed  Offline OP
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
Ciao,
my script is based on 13 assets on different time frames, and I am doing something similar to your code, but what happen, for instance, if the market is closed for an national holiday during a trading day?
Your code, as mine, is not able to track that event. Having the opportunity to check if an asset is tradable right before to open a position could help a lot.

In Multichart the trading time is listed in the platform, so I guess that could be possible to gather such information from the broker.
I hoped this could be possible in Zorro.

Naturally nobody can guarantee that your order will be 100% executed, but this will reduce the number of exceptions.

Ciao

Re: Asset traded only few hours a day [Re: MatPed] #464958
03/20/17 12:44
03/20/17 12:44
Joined: Feb 2017
Posts: 8
Veli Offline
Newbie
Veli  Offline
Newbie

Joined: Feb 2017
Posts: 8
You're right. These are indeed problems with the solution.
I would be happy for a different one aswell wink

If i one day stumble across a better solution, I'll inform you and would be happy, if you would do the same wink

Until then i've not given up hope that one of the really clever members of this forum writes an answer to this Thread laugh


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