ENUM_PROGRAM_TYPE from MQL_PROGRAM_TYPE
Get the value using MqlInfoString
Example from doc:
ENUM_PROGRAM_TYPE mql_program=(ENUM_PROGRAM_TYPE)MQLInfoInteger(MQL_PROGRAM_TYPE); switch(mql_program) { case PROGRAM_SCRIPT: { Print(__FILE__+" is script"); break; } case PROGRAM_EXPERT: { Print(__FILE__+" is Expert Advisor"); break; } case PROGRAM_INDICATOR: { Print(__FILE__+" is custom indicator"); break; } default:Print("MQL5 program type value is ",mql_program); }
Thanks - I have found it.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
is there a more elegant way of an object to know 'for what it is' used?
A class should know whether it is part of an EA, an indicator or a script so that e.g. it knows how it should deal with e.g. sleep which does not work in indicators and must be treated differently.
Neither in the help of (Mql4 nor in) Mql5 I could find any thing that returns this info so I created this solution.
Normally (I guess) the OOP files with the classes are in various mqh files so that the use of the simple __PATH__ does not give any meaningful result.
So this results in a bit unpleasant solution as it requires a call in Oninit() while I would prefer a direct call in the initialization of the class.
Any idea of a better solution?