M45 - undeclared identifier

 

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!

 
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.
 
well that's strange in MQL4 my H2 timeframe compile but not my M45 timeframe...
 
Show the code.
 

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
 

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

 
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
 
Great thanks for the help!!
Reason: