Download MetaTrader 5

M45 - undeclared identifier

To add comments, please log in or register
Sell products right in MetaTrader. Millions of traders are waiting for this!
EQGGG
62
EQGGG 2017.03.21 06:02 

Hi, could somebody tell me why I cannot compile an Mt4 EA with an M45 period while I can compile it with an H2 period? M45 chart was created offline with period converter and still it doesnt work. So I can it compile for H2??

Thanks!

Carl Schreiber
6591
Carl Schreiber 2017.03.21 08:20  
EQGGG:

Hi, could somebody tell me why I cannot compile an Mt4 EA with an M45 period while I can compile it with an H2 period? M45 chart was created offline with period converter and still it doesnt work. So I can it compile for H2??

Thanks!

In Mt4 (MQL4) the H2 timeframe does not exist! In MQL5 it exists.
EQGGG
62
EQGGG 2017.03.21 08:44  
well that's strange in MQL4 my H2 timeframe compile but not my M45 timeframe...
Marco vd Heijden
Moderator
4704
Marco vd Heijden 2017.03.21 08:49  
Show the code.
honest_knave
Moderator
2214
honest_knave 2017.03.21 09:16  

PERIOD_H2 is a valid constant of a non-standard timeframe.

PERIOD_M45 is not.

Please see the list here 

Chart Timeframes - Chart Constants - Standard Constants, Enumerations and Structures - MQL4 Reference
Chart Timeframes - Chart Constants - Standard Constants, Enumerations and Structures - MQL4 Reference
  • docs.mql4.com
Chart Timeframes - Chart Constants - Standard Constants, Enumerations and Structures - MQL4 Reference
EQGGG
62
EQGGG 2017.03.21 09:54  

Well thanks a lot honest_knave that explains the non-compiling of the EA... so no way to compile M45 in MQL4 right?

honest_knave
Moderator
2214
honest_knave 2017.03.21 10:02  
EQGGG:
Well thanks a lot honest_knave that explains the non-compiling of the EA...  so for non-standard timeframe I can solely compile using constants right?


You have the option to use #define statement e.g.

#define PERIOD_M45 45
EQGGG
62
EQGGG 2017.03.21 10:06  
Great thanks for the help!!
To add comments, please log in or register