How to obtain period current and account name of the attached EA in chart?

 

Dear. I want simply to print(or alert) the current account name and current period of the EA attached to the chart.

About the name no problem, i solved with:

string account=AccountInfoString(ACCOUNT_NAME);

Alert("account:"+account);

 

But for the current chart timeframe i am not able..

No matter how the output of the "function" will be, if it string or integer,

the important is that it differs from timeframe to timefreame (i.e. period 5m printed as 5, and period 1h printed as 60);

 

I've tried: 

ENUM_TIMEFRAMES per=PERIOD_CURRENT;

string peri=IntegerToString(per);

Alert("currentperiod:"+per);

Alert(currentperiod:"+peri);

but none of both give me the expected results..

Do you know how to obtain?

It is possible to convert ENUM_TIMEFRAMES into integer or string

as we do for IntegerToString or StringToInteger? (something "like"  ENUM_TIMEFRAMEStoInteger ??)

Thanks

Documentation on MQL5: Standard Constants, Enumerations and Structures / Chart Constants / Chart Timeframes
  • www.mql5.com
Standard Constants, Enumerations and Structures / Chart Constants / Chart Timeframes - Documentation on MQL5
 

We have already fixed this problem. Just wait for future build.

At this moment you can try this code.

string tmp=AccountInfoString(ACCOUNT_NAME);
Alert(tmp+" "+(string)_Period);
Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Symbol Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Symbol Properties - Documentation on MQL5
 
alexvd:

We have already fixed this problem. Just wait for future build.

At this moment you can try this code.



I haven't supposed it was a problem, just i thinked was my ingnorancy..

But what is the problem? The PERIOD_CURRENT cannot actually be converted into integers or strings?

 

Thanks for the code of course, i will try..