Download MetaTrader 5

_Period above M30 causes problems

To add comments, please log in or register
Marcus Riemenschneider
175
Marcus Riemenschneider  

Hello all,

can somebody tell me why this small script returns totally wrong numbers when applying it on a timeframe > M30?

void OnStart()
  {
   Alert((string)_Period);
  }
Alain Verleyen
Moderator
32808
Alain Verleyen  
Marcus Riemenschneider:

Hello all,

can somebody tell me why this small script returns totally wrong numbers when applying it on a timeframe > M30?

There is no wrong value, but a wrong usage.

Try :

Alert(EnumToString(Period()));
whroeder1
15706
whroeder1  
Checkup / Period - Reference on algorithmic/automated trading language for MetaTrader 5
Period - Checkup - MQL4 Reference

Period

Returns the current chart timeframe.

ENUM_TIMEFRAMES  Period();

Period

Returns the current chart timeframe.

int  Period();

Marcus Riemenschneider
175
Marcus Riemenschneider  
whroeder1:
Checkup / Period - Reference on algorithmic/automated trading language for MetaTrader 5
Period - Checkup - MQL4 Reference

Period

Returns the current chart timeframe.

ENUM_TIMEFRAMES  Period();

Period

Returns the current chart timeframe.

int  Period();


Thanks guys... moving from MQL4 to MQL5 can really be very painful...
To add comments, please log in or register