Download MetaTrader 5

Can't open include mqh file or Libraries

To add comments, please log in or register
chevanton1988
64
chevanton1988  

Hi,

 

i create mqh. file with Statistical formulas which I want to use in my EA or script. At first I try to tested them and I include my Statistical.mqh into my script. But without success. I have an error "can't open "C:\Program Files\MetaTrader 5 \MQL5\Scripts\Statistical.mqh" include file test.mq5"

 

test.mq5 is script, and  Statistical.mqh is my new header file. it is the same problem when I use Statistical library. I can see my .mqh file in windows Program files system and when I double click it open me in a MetaEditor. 

 

Also I tried this with Object.mqh  which is included in MetaEditor by installation and result is the same.

 

 

Please help.  

 

Thank you 


Snelle Moda
625
Snelle Moda  

Hi

Your "Statistical.mqh" file is in the wrong directory map, you should put it in the "include" folder.

A "mqh" file should be put in the "include" folder and not in "scripts".

chevanton1988
64
chevanton1988  
snelle_moda:

Hi

Your "Statistical.mqh" file is in the wrong directory map, you should put it in the "include" folder.

A "mqh" file should be put in the "include" folder and not in "scripts".

 

My Statistical.mqh is in include folder.  

chevanton1988
64
chevanton1988  
Finnaly I success. i don't know why but program immidietly put itself in Script folder. i must put complete path to include file. Why do i need to do this? In this way libraries and include headers don't make sense. if i must put mqh file or library into folder where is my script. Path which i need put in #include function is big and doesn't make sense.
Alain Verleyen
Moderator
33504
Alain Verleyen  
chevanton1988:
Finnaly I success. i don't know why but program immidietly put itself in Script folder. i must put complete path to include file. Why do i need to do this? In this way libraries and include headers don't make sense. if i must put mqh file or library into folder where is my script. Path which i need put in #include function is big and doesn't make sense.
#include <Statistical.mqh>

Please read the documentation.

Documentation on MQL5: Language Basics / Preprocessor / Including Files (#include)
Documentation on MQL5: Language Basics / Preprocessor / Including Files (#include)
  • www.mql5.com
Language Basics / Preprocessor / Including Files (#include) - Reference on algorithmic/automated trading language for MetaTrader 5
chevanton1988
64
chevanton1988  
angevoyageur:

Please read the documentation.

Thanks Angevoyageur,

If is your header file in the same folder like your program (script, EA or indicator) then include file must have quotation marks (#include "Statistical.mqh"). if is it in another folder (include or libraries) then it must be in angle brackets (#include <Statistical.mqh>).

To add comments, please log in or register