You can use the SYMBOL_EXPIRATION_DATE property. This property returns the expiration date of the financial instrument as a datetime value:
datetime expiration_date = (datetime)SymbolInfoInteger(symbol, SYMBOL_EXPIRATION_DATE);
Replace `symbol` with the symbol of the CFD contract that you want to retrieve the expiration date.
Thank you!
Oleksandr Medviediev #:
You can use the SYMBOL_EXPIRATION_DATE property. This property returns the expiration date of the financial instrument as a datetime value:
Replace `symbol` with the symbol of the CFD contract that you want to retrieve the expiration date.
Why do I get the error:
'SYMBOL_EXPIRATION_DATE' - undeclared identifier
Paul Anscombe #:
context
context
#property copyright "Copyright 2024, MetaQuotes Ltd."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
int OnInit()
{
Print("Symbol=",Symbol());
Print("date:",SymbolInfoInteger(Symbol(), SYMBOL_EXPIRATION_DATE));
return(INIT_SUCCEEDED);
}

通过MQL5社区和服务探索MetaTrader 5的新机遇
- 2024.10.07
- www.mql5.com
MQL5:MetaTrader 5客户端内置的交易策略语言。语言允许编写您自己的自动交易系统,技术指标,脚本和函数程序库
Kai Hua Li #:
int OnInit()
{
Print("Symbol=",Symbol());
Print("date:",SymbolInfoInteger(Symbol(), SYMBOL_EXPIRATION_DATE));
return(INIT_SUCCEEDED);
}
use the correct enum SYMBOL_EXPIRATION_TIME
https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#enum_symbol_info_integer

Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Symbol Properties
- www.mql5.com
To obtain the current market information there are several functions: SymbolInfoInteger() , SymbolInfoDouble() and SymbolInfoString() . The first...

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
HI all, how can I recall CFD expiration date indicated in properties window?
I tried with SYMBOL_EXPIRATION_TIME but I seem it's not correct.
Thank you!