Gamestudio Links
Zorro Links
Newest Posts
Starting Zorro
by brax
Yesterday at 21:20
Sam Foster Sound | Experienced Indie Game Composer for Hire
by titanicpiano14
Yesterday at 19:09
Lost Key
by jcl
Yesterday at 13:58
Aum119 is ready
by Iglarion
Yesterday at 13:09
Zorro on Linux
by Nanitek
Yesterday at 11:08
AUM Magazine
Latest Screens
RPG PARTY
Triton Wing now available on Steam
AckCon'17: Lotter vs The World
Triton Wing
ZeaL
Who's Online
13 registered (Ch40zzC0d3r, AndrewAMD, Dico, ezaffa, NeoDumont, jenGs, Realspawn, Hredot, preacherX, jyd), 501 Guests and 4 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
vivekkumar, Hale75, victrades, htj, anufriyev
17781 Registered Users
Topic Options
Rate This Topic
#464776 - 03/10/17 14:20 Asset traded only few hours a day
MatPed Offline
Senior Member

Registered: 02/28/15
Posts: 373
Loc: 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

Top
#464828 - 03/14/17 09:46 Re: Asset traded only few hours a day [Re: MatPed]
Veli Offline
Newbie

Registered: 02/28/17
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

Top
#464832 - 03/14/17 14:02 Re: Asset traded only few hours a day [Re: Veli]
MatPed Offline
Senior Member

Registered: 02/28/15
Posts: 373
Loc: 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

Top
#464958 - 03/20/17 13:44 Re: Asset traded only few hours a day [Re: MatPed]
Veli Offline
Newbie

Registered: 02/28/17
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

Top



Gamestudio download | chip programmers | Zorro platform | shop | resources | magazine | manual | support faq | bugs | beta features

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) 3dgamestudio.net