[127] Code generation for MQ5 is adding some Indicator buffer indexes definitions despite it is not expected



The following is added to each MQ5 code when it is generated from strategy. It is not added in MQ4 or Pseudocode


#define HEIKENASHI_1 7     //iCustom(NULL,0, "SqHeikenAshi")
Attachments
No attachments
  • Votes 0
  • Project AlgoWizard
  • Type Bug
  • Status Fixed
  • Priority Normal

History

p
#1

pitro

18.05.2020 21:13

Task created

p
#2

pitro

18.05.2020 21:14

Subject changed from Code generation for MQ5 is adding some Indicator buffer indexes definitions despite it is not expected to [127] Code generation for MQ5 is adding some Indicator buffer indexes definitions despite it is not expected

TB
#3

Tomas Brynda

19.05.2020 06:55

Status changed from New to Waiting for information

Hi Pitro,

MQL5 is different from other source codes, the indicators must be initialized at start to be able to use them later.


The only indicator handle which is being added everytime regardless if it is used in strategy logic or not is the HeikenAshi.

Other indicators are added depending on strategy rules.


Please attach some of the problematic strategies and I will check that.


Best regards,

Tomaas

p
#4

pitro

20.05.2020 23:52

Attachment B5_EA_v352.mq5 added

Attachment Indicators_in_Tester.jpg added

Hi Tomas.


Please see section below in mq5 file.


int indicatorHandles[];


//Indicator buffer indexes definitions

#define BOLLINGERBANDS_1 0     //iBands(NULL,0, BollingerBandsPeriod, 0, BollingerBandsDvt, PRICE_CLOSE)

#define LOWEST_1 1     //iCustom(NULL,0, "SqLowest", LongLowestPeriod, PRICE_LOW)

#define BOLLINGERBANDS_2 2     //iBands(NULL,0, LongBollingerBndPrd, 0, LongBollingerBndDvt, PRICE_CLOSE)

#define HIGHEST_1 3     //iCustom(NULL,0, "SqHighest", ShortHighestPeriod, PRICE_HIGH)

#define BOLLINGERBANDS_3 4     //iBands(NULL,0, ShortBollingerBndPrd, 0, ShortBollingerBndDvt, PRICE_CLOSE)

#define HEIKENASHI_1 5     //iCustom(NULL,0, "SqHeikenAshi")


I use Bollinger and Lowest/Highest indicators in the strategy indeed. The case is, when I run MQ5 Strategy Tester it is showing all of them each time. Following this I need to remve them or change the template each time.


At some stage they started to appear even twice....






TB
#5

Tomas Brynda

21.05.2020 07:56

Status changed from Waiting for information to Fixed

Hi Pitro,

ok, now I understand what you mean. The problem is the tester shows the indicator graphs automatically.

The indexes definitions that you posted is just a constants initialization. It does not have an effect on showing/hiding the indicator plots.

It is just an internal indexes definition that is used when getting values.


If you want to hide the indicators plots, you can add an IndicatorRelease() function into the MQL code - here is a link https://www.mql5.com/en/docs/runtime/testing#indicatorrelease


Best regards,

Tomas


p
#6

pitro

21.05.2020 20:55
OK Thank You!

Votes: 0

Drop files to upload

or

choose files

Max size: 5MB

Not allowed: exe, msi, application, reg, php, js, htaccess, htpasswd, gitignore

...
Wait please