Download MetaTrader 5

How to get future market start time correctly?

To add comments, please log in or register
Somsri Sarkar
3383
Somsri Sarkar  

Hi,

I tried coding it with following:

datetime futuretime = (datetime) MarketInfo(Symbol(),MODE_STARTING);

 But it showing 0:00 where as future starts at 1:00 then how can correct start time of Future instruments, CFD & Metals?

 Thank you in advance.

Regards 

Keith Watford
Moderator
10651
Keith Watford  
Somsri Sarkar:

Hi,

I tried coding it with following:

datetime futuretime = (datetime) MarketInfo(Symbol(),MODE_STARTING);

 But it showing 0:00 where as future starts at 1:00 then how can correct start time of Future instruments, CFD & Metals?

 Thank you in advance.

Regards 

I have never used this, but the documentation says that it returns market starting date not the time the market opens on a daily basis.
Somsri Sarkar
3383
Somsri Sarkar  
Keith Watford:
I have never used this, but the documentation says that it returns market starting date not the time the market opens on a daily basis.

Is there any way to detect Future Contract market opening time in both mql4 & mql5?

Thank you 

honest_knave
Moderator
2326
honest_knave  

You can view the information from the Market Watch by right-clicking the instrument and selecting Specification:

 

 

I have never managed to retrieve that information in code.

At best (and this involves some risky presumptions) you can extract the time from contract start and contract end. The presumption is that the contract starts at the market open on the first day, and the contract ends at the market close on the last day. This is a risky and possibly erroneous conclusion, depending on the contract.

Here is an example on the DAX:

   datetime begin=(datetime)SymbolInfoInteger(NULL,SYMBOL_START_TIME),
            end  =(datetime)SymbolInfoInteger(NULL,SYMBOL_EXPIRATION_TIME);
   printf("Start: %s // End: %s",TimeToStr(begin),TimeToStr(end));

The outcome:

Start: 1970.01.01 00:00 // End: 2017.03.16 22:00  

So the contract ends at 22:00 on 16 March... presumption is that the market closes at 22:00 each day (it does, on this contract).

Unfortunately, the "begin" datetime doesn't return a valid start date on this broker. 

Somsri Sarkar
3383
Somsri Sarkar  
honest_knave:

You can view the information from the Market Watch by right-clicking the instrument and selecting Specification:

 

 

I have never managed to retrieve that information in code.

At best (and this involves some risky presumptions) you can extract the time from contract start and contract end. The presumption is that the contract starts at the market open on the first day, and the contract ends at the market close on the last day. This is a risky and possibly erroneous conclusion, depending on the contract.

Here is an example on the DAX:

   datetime begin=(datetime)SymbolInfoInteger(NULL,SYMBOL_START_TIME),
            end  =(datetime)SymbolInfoInteger(NULL,SYMBOL_EXPIRATION_TIME);
   printf("Start: %s // End: %s",TimeToStr(begin),TimeToStr(end));

The outcome:

So the contract ends at 22:00 on 16 March... presumption is that the market closes at 22:00 each day (it does, on this contract).

Unfortunately, the "begin" datetime doesn't return a valid start date on this broker. 

Hello honest_knave,

Thank you for the explanation. Actually I also did find 1970 start date. But no start time, So realises its not going to happen & added manual option for user to input future start time. But MetaQute should add a code for this.

Regards

Thanks again. 

To add comments, please log in or register