Entry when market is closed

Posted By: Chaosfreak

Entry when market is closed - 05/31/14 20:58

Hi,

I often have the problem with "Can't open" messages from Zorro because market is closed, especially on GER30 and UK100. I'm currently coding a strategy with BarPeriod 1440, so signals occur at midnight where those markets are closed.

I set "Entry = 10 * PIP" and wrote a TMF function which returns 2 to enter pending trades as I thought the TMF is executed only when ticks arrive and so when the market is open, but I still get these message and Zorro doesn't open the trade.

@jcl: Can you tell us how the Z strategies enter trades? As I see in the log it is always entered with a pending trade (Entry limit). With the Z strategies I never get a "Can't open" message. Can you post a piece of code how the Z's enter trades?
Posted By: jcl

Re: Entry when market is closed - 06/02/14 06:33

Arriving ticks does not mean that you can trade. "Can't open" can also happen within market hours and also with the Z systems, but rarely because they trade inside market hours. With BarPeriod 1440, use a bar offset for trading when the market is open.

The Z systems use a function like this for determining market hours:

Code:
bool isMarketOpen()
{
	int h = hour()+dst(0); // Greenwich local time
	
	if(Asset == "GER30") {
		if(h+CET < 9 || h+CET > 16)
			return false;
	}
	else if(Asset == "UK100") {
		if(h < 9 || h > 16) 
			return false;
	}
	else if...
	...
	return true;
}

Posted By: Chaosfreak

Re: Entry when market is closed - 06/02/14 11:56

Okay, thanks. It would be nice if Zorro would automatically retry to open these trade like it is with closing trades. Can you set this on the todo?
Posted By: jcl

Re: Entry when market is closed - 06/04/14 06:37

Doing that automatically would be dangerous. If a trade is rejected because the market is closed, the strategy must decide if the conditions for the trade are still valid when the market opens again.
© 2024 lite-C Forums