Gamestudio Links
Zorro Links
Newest Posts
video memory and d3d_texfree
by jcl
Today at 19:17
priceClose() - How to use actual bar close in live trading?
by jcl
Today at 18:50
Exporting data from multiple timeframe
by gtell
Today at 18:46
Trading few minutes before market close
by GreenBoat
Today at 18:21
What are you working on?
by Ayumi
Today at 15:43
AUM Magazine
Latest Screens
Triton Wing
ZeaL
Computer Repair Simulator
Collider (working title)
Space Rider
Who's Online
22 registered (Ayumi, ibne, Ch40zzC0d3r, Dalla, GreenBoat, gtell, alibaba, firecrest, 3 invisible), 434 Guests and 5 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
tonecosta, 3dgamelight, izybikawu, janversa, Unsane
17609 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: 310
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: 310
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