Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 693

 
Alexey Viktorov:

The array is only written to a .bin file and to open it for reading by eye... I don't know of such an application, it is unlikely to exist. In order to be able to read what is written, it must be written to .csv or .txt format, respectively, with other functions in a loop, not with FileWriteArray().

Thank you.
 
how to correct the error?
Files:
 
how to correct the error?
Files:
Screenshot_6.png  106 kb
 
02031986dima:
how to correct the error?

Do this.

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   
  }
//+------------------------------------------------------------------+

//+----------------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru                   |
//+----------------------------------------------------------------------------+
//|  Версия   : 07.10.2006                                                     |
//|  Описание : Возвращает экстремум ЗигЗага по его номеру.                    |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    sy - наименование инструмента   (NULL или "" - текущий символ)          |
//|    tf - таймфрейм                  (      0     - текущий ТФ)              |
//|    ne - номер экстремума           (      0     - последний)               |
//|    dp - ExtDepth                                                           |
//|    dv - ExtDeviation                                                       |
//|    bs - ExtBackstep                                                        |
//+----------------------------------------------------------------------------+
double GetExtremumZZPrice(string sy="", int tf=0, int ne=0, int dp=12, int dv=5, int bs=3) {
  if (sy=="" || sy=="0") sy=Symbol();
  double zz;
  int    i, k=iBars(sy, tf), ke=0;

  for (i=0; i<k; i++) {
    zz=iCustom(sy, tf, "ZigZag", dp, dv, bs, 0, i);
    if (zz!=0) {
      ke++;
      if (ke>ne) return(zz);
    }
  }
  Print("GetExtremumZZPrice(): Экстремум ЗигЗага номер ",ne," не найден");
  return(0);
}
 

Hi.

Question: In MT4, is it possible to match the colour of the EZ buffer with the chart, provided the colour of the indicator on the chart has changed?

In the code

#property indicators_color1 clrYellow

***

***

ObjectCreate(.......);

ObjectSetInteger(... indicators_color1);


Problem; when you change colour in the indicator, the buffer line colour changes, but in the chart it is the same as in #property. Needs matching.

So far solved through input color , BUT it's two entries in the code, two changes in the settings, and I would like one setting through the buffer.


Thanks for any feedback.

Diagrammed it from a smartphone.


 
kopeyka2:

Hi.

Question: In MT4, is it possible to match the colour of the EZ buffer with the chart, provided the colour of the indicator on the chart has changed?

In the code

#property indicators_color1 clrYellow

***

***

ObjectCreate(.......);

ObjectSetInteger(... indicators_color1);


Problem; when you change colour in the indicator, the buffer line colour changes, but in the chart it is the same as in #property. Needs matching.

So far solved through input color , BUT it's two entries in the code, two changes in the settings, and I would like one setting through the buffer.


Thanks for any feedback.

Diagrammed it from a smartphone.

It should work. Do you delete the object in OnDeinit() to create a new one when you change the input parameters, with the colour you want ?

 
Taras Slobodyanik:

If you know how to create an exact object name, there is no point in going through all the objects in the graph.
It is enough to go through these (assumed) names.

Thank you.

 

@Vitaly Muzichenko


Different colour

The code is Magenta.

Dots are a buffer. The line is a graphic. This is the problem. The colour from global variable to the lineObjectSetInteger(...indicators_color1) does NOT GET when changing!!!! I think the#property indicators_color1 clrMagenta changes in the attached chart refers ONLY to the buffer... The rest of the value is used in the code as the global variable....


Correct if wrong. SPS

 
Vitaly Muzichenko:

It should work. Are you deleting an object in OnDeinit() to create a new one when the input parameters are changed, with the colour you want ?

I delete TWO times; 1)OnDeinit 2) once in the code body.
 
kopeyka2:

Hi.

Question: In MT4, is it possible to coordinate colour from the buffer with the chart, if the indicator colour is changed on the chart?


NO, CANNOT...

it's funny, but you can NOT get what the user selected in the "Colours" tab inside the indicator

Reason: