EA31337 / EA31337-indicators-common

Collection of common indicators used for EA31337 strategies.
5 stars 3 forks source link

[MT4][SOLVED] MA mq5 include Error #18

Closed cgava closed 4 months ago

cgava commented 4 months ago

When trying to compile the MA.mt5.mq4 Indicator, the following lines cause a compilation (can't open Custom Moving Average.mq5) input file.

// Includes MQL5 version of indicator.
#include <../Indicators\Examples\Custom Moving Average.mq5>

Can be solved by :

// Includes MQL5 version of indicator.
#include "MA.mq5"

Question: Why do we include the "Custom Moving Average.mq5" which is a Metaquote include, and should have no relation with EA31337?

Configuration statement

MT4 4.0 build 1415
The issue is visible on both:
Classes: v2.013.1                   /Common Indicator: v0.013
Classes: v3.001-dev-new       /Common Indicator: dev (19a01e6)

The cloning of EA31337 repo in MQL4 folder is:

[submodule "MQL4/Include/classes"]
    path = MQL4/Include/classes
    url = https://github.com/EA31337/EA31337-classes
[submodule "MQL4/Indicators/EA31337-indicators"]
    path = MQL4/Indicators/EA31337-indicators
    url = git@github.com:EA31337/EA31337-indicators.git
kenorb commented 4 months ago

Why do we include the "Custom Moving Average.mq5" which is a Metaquote include, and should have no relation with EA31337?

Indicator got ENUM_IDATA_SOURCE_TYPE InpSourceType input param which controls calculation method. So we can pick internal calculation of MA within EA31337 codebase.

Different values of calculations are defined in the following enum (IndicatorData.enum.h):

enum ENUM_IDATA_SOURCE_TYPE {
  IDATA_BUILTIN = 0,     // Platform built-in
  IDATA_CHART,           // Chart calculation
  IDATA_ICUSTOM,         // iCustom: Custom indicator file
  IDATA_ICUSTOM_LEGACY,  // iCustom: Custom, legacy, provided by MT indicator file
  IDATA_INDICATOR,       // OnIndicator: Another indicator as a source of data
  IDATA_ONCALCULATE,     // OnCalculate: Custom calculation function
  IDATA_MATH             // Math-based indicator
};

So if you pick IDATA_BUILTIN (Platform built-in), it's using iMA() platform builtin, and for IDATA_ICUSTOM_LEGACY it's going to use values from platform's indicator example file.

The aim of different methods is to compare the data for consistency and find problems when dealing with different type of calculations of indicators (GH-20 is a good example of it). And you can't compare how platform is calculating their own data without including their indicators from the Example folder. I hope that make sense.