Gamestudio Links
Zorro Links
Newest Posts
CSV to Tick import problem
by pcz
Today at 16:40
An Introduction to Algorithmic Trading: Basic to Advanced Strate
by yosoytrader
Today at 16:25
Square Root Rule & Additional Investment
by DdlV
Today at 15:15
What are you working on?
by painkiller
Today at 12:55
Support and Resistance Zones/Cluster
by sdh309795gaas
Today at 05:22
AUM Magazine
Latest Screens
Triton Wing
ZeaL
Computer Repair Simulator
Collider (working title)
Space Rider
Who's Online
15 registered (Denn15, painkiller, MatPed, Fiber, alibaba, firecrest, 3dgamelight, Iglarion, Matt_Aufderheide, pcz), 465 Guests and 5 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
Marce, pascalx, SpaceNL, onlinejack, johnnyp
17716 Registered Users
Topic Options
Rate This Topic
#464776 - 03/10/17 14:20 Asset traded only few hours a day
MatPed Online
Senior Member

Registered: 02/28/15
Posts: 352
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 Online
Senior Member

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