Download MetaTrader 5

M45 - undeclared identifier

To add comments, please log in or register
EQGGG
62
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!

Carl Schreiber
6777
Carl Schreiber  
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  
well that's strange in MQL4 my H2 timeframe compile but not my M45 timeframe...
Marco vd Heijden
Moderator
4798
Marco vd Heijden  
Show the code.
honest_knave
Moderator
2417
honest_knave  

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  

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
2417
honest_knave  
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  
Great thanks for the help!!
To add comments, please log in or register