Download MetaTrader 5

Any way to detect if current scope is EA or Indicator?

To add comments, please log in or register
selnomeria
254
selnomeria  

Hi. I want to have a variable/code in my library, that will tell if current script (it is used in) is EA or INDICATOR...


what code can be used?

honest_knave
Moderator
2318
honest_knave  
MQLInfoInteger(MQL_PROGRAM_TYPE);
Running MQL4 Program Properties - Environment State - Standard Constants, Enumerations and Structures - MQL4 Reference
Running MQL4 Program Properties - Environment State - Standard Constants, Enumerations and Structures - MQL4 Reference
  • docs.mql4.com
Running MQL4 Program Properties - Environment State - Standard Constants, Enumerations and Structures - MQL4 Reference
selnomeria
254
selnomeria  
honest_knave:

THANKS!!!!!!!!  p.s. in documentation there is not stated the returning values... I tested and 2 is for EA. 
honest_knave
Moderator
2318
honest_knave  

ENUM_PROGRAM_TYPE

Identifier

Description

PROGRAM_SCRIPT

Script

PROGRAM_EXPERT

Expert

PROGRAM_INDICATOR

Indicator

To add comments, please log in or register