Which folder should I place .mqh files to be recognised by my EA?

 
I created some .mqh files and left them in the Include folder (not a subfolder of the Include folder). I tried calling a class from the .mqh in my Expect Advisor but I keep getting a "undeclared identifier" error. Where should I place my .mqh files to be recognised by my Expert Advisor?
 
Pipillioniare:
I created some .mqh files and left them in the Include folder (not a subfolder of the Include folder). I tried calling a class from the .mqh in my Expect Advisor but I keep getting a "undeclared identifier" error. Where should I place my .mqh files to be recognised by my Expert Advisor?

Most of my .mqh files are in MQL5\Include\.

I have some in a sub-directory of MQL5\Expert\.

Shouldn't matter so long as you have your #include lines correct in the calling .mq5 file.

 
Anthony Garot:

Most of my .mqh files are in MQL5\Include\.

I have some in a sub-directory of MQL5\Expert\.

Shouldn't matter so long as you have your #include lines correct in the calling .mq5 file.

What should the #include path be?
 
Pipillioniare:
What should the #include path be?

Depends upon where the .mqh file is.

These are all valid. I know this because I just copied out of a working EA. As you can see, I mix and match angle brackets with double quotes as needed.

And note that you can include .mq5 files as well.

#include <clsTimeSeriesData.mqh>
#include <clsTradeMetrics.mqh>
#include <clsOkToTrade.mqh>
#include "..\..\libraries\clsMoneyManagement.mq5"
//#include "..\..\libraries\clsInternalAverages.mq5"
#include <clsShowStatistics.mqh>
#include "TimeSeries.mqh"
#include "RSquare.mqh"
#include <clsStrategy.mqh>
#include <clsRange.mqh>

Read this link for specific details: https://www.mql5.com/en/docs/basis/preprosessor/include

Documentation on MQL5: Language Basics / Preprocessor / Including Files (#include)
Documentation on MQL5: Language Basics / Preprocessor / Including Files (#include)
  • www.mql5.com
with the content of the file WinUser32.mqh. Angle brackets indicate that the WinUser32.mqh file will be taken from the standard directory (usually it is If the file name is enclosed in...
 
Anthony Garot:

Depends upon where the .mqh file is.

These are all valid. I know this because I just copied out of a working EA. As you can see, I mix and match angle brackets with double quotes as needed.

And note that you can include .mq5 files as well.

Read this link for specific details: https://www.mql5.com/en/docs/basis/preprosessor/include

Thanks, that solves it.