Download MetaTrader 5
To add comments, please log in or register
Manage agents in your profile. It is easy!
forexistence
285
forexistence 2010.09.30 21:15 

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
Alexey Da
Moderator
6566
Alexey Da 2010.09.30 22:37  

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
forexistence
285
forexistence 2010.09.30 22:49  
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.. 

/
To add comments, please log in or register