Market Open?

 

Can an EA check to see if a broker is open for trading before executing a trade?

I'm working on a hedging program between 2 brokers, and I don't want just one leg to be executed because one broker is open and the other is not.

I am mostly interested in the times around the makets opening and closing. Some brokers close at different times than others.

Thanks for any feed back.

 
mrchuckw:

Can an EA check to see if a broker is open for trading before executing a trade?

I'm working on a hedging program between 2 brokers, and I don't want just one leg to be executed because one broker is open and the other is not.

I am mostly interested in the times around the makets opening and closing. Some brokers close at different times than others.

On the Open it is easy, just measure the time from the last tick. That won't work on the close though.
 

Come to think of it, there is no way to tell about the broker closing. Suppose you had a function AreYouOpenForTrades() and it returns YES! Well 1ms later when you place the trade the answer could be NO. There is no "WillYouBeOpenForTheNextFiveMinutes() function possible.

You could be more cautious around hour boundaries,

you could program an array of closing times for each broker,

and you could put your hedge on in 10 equal parts to limit the hedge exposure to 1/10th the previous value.

Reason: