Errors, bugs, questions - page 1396

 
Ilya Malev:
I made MathRand in the example just to demonstrate how the scale works. In the original I had the calculation of numerical levels there using some trader's author's methodology. At the beginning we wanted to make them from 1 to 5, but even MT4 failed to achieve the adequate scale even with such values in the buffer with DRAW_NONE. After we made them negative and fixed the minimum at 0, the problem was solved. When porting the indicator to MT5 it appeared that this solution would not work either. I had to multiply by Point as Voldemar said.

By the way, I completely forgot. ))

Try it like this:

   SetIndexBuffer(0,buffer1,INDICATOR_DATA);
   SetIndexBuffer(1,buffer2,INDICATOR_CALCULATIONS);

INDICATOR_CALCULATIONS >>>

 
Karputov Vladimir:
Your example is crooked and you don't want to fix it. I will check it when you fix it.

I would fix it if it were code for real use. But this code was created just to demonstrate the problem, which it has successfully done. It's a waste of time to clean it up, because it won't affect the result.

 
Anatoli Kazharski:

By the way, I completely forgot. ))

Try it like this:

Tried both if indicator_plots=1 and withINDICATOR_CALCULATIONS

the second buffer reading just disappears from data window regardless of PlotIndexSetInteger(1, PLOT_SHOW_DATA, true);

 
Anatoli Kazharski:

You can try reporting the error to servicedesk and wait for a response there.

I have done so. If they reply, I'll let you know.) I doubt it's an error though. That's how you'll find out.
 
Ilya Malev:

Tried both with indicator_plots=1 andINDICATOR_CALCULATIONS

the readings of the second buffer just disappear from the data window, regardless of specifying PlotIndexSetInteger(1, PLOT_SHOW_DATA, true);

But the scaling problem is solved in this way. So, you can create a request to servicedesk, that just add the ability to display such buffers in the data window.

And you can also try to do it like this:

//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int    id,      // идентификатор события
                  const long   &lparam, // параметр события типа long
                  const double &dparam, // параметр события типа double
                  const string &sparam) // параметр события типа string
  {
   if(id==CHARTEVENT_MOUSE_MOVE)
     {
      int      subwin =WRONG_VALUE; // Номер окна, в котором находится курсор
      datetime time   =NULL;        // Время соответствующее координате X
      double   level  =0.0;         // Уровень (цена) соответствующий координате Y
      //---
      if(ChartXYToTimePrice(0,(int)lparam,int(dparam),subwin,time,level))
        {
         int bars_total=Bars(Symbol(),Period(),time,TimeCurrent());
         //---
         Comment("x: ",lparam,"; y: ",(int)dparam,"; subwin: ",subwin,"; time: ",time,"; level: ",level,"\n",
                 "indicator value: ",buffer2[bars_total]);
        }
     }
  }

//---

In OnInit() you need to add:

void OnInit()
  {
   ChartSetInteger(0,CHART_EVENT_MOUSE_MOVE,true);
  }
 
Anatoli Kazharski:

So you can create a request to servicedesk to simply add the ability to display such buffers in the data window.

I just described the problem, the logic of DRAW_NONE buffer values is by definition different from the logic of rendered values, they are not graphical values, and therefore scaling with them in mind is not logical. How they want to solve the problem, or whether they want to leave it as it is, is none of my business.

 
Ilya Malev:

I just described the problem, the logic of the DRAW_NONE buffer values is by definition different from the logic of the rendered values, they are not graphical values and therefore scaling with them in mind is not logical. And how they want to solve this problem or want to leave it as it is is none of my business.

Isn't the option in the previous post appropriate? Just in case everything is left as it is. )

Files:
Test.mq5  4 kb
 
Anatoli Kazharski:

Isn't the option in the previous post appropriate? Just in case things remain as they are. )

Of course thanks for the advice, if I wanted to come up with some kind of crutch I'd come up with something too, but firstly we are comfortable looking at the values in the data window. Secondly, we should use this indicator buffer value in other indicators and Expert Advisors, and something tells me that if we make a buffer for calculations, it will be impossible to get its values through iCustom.

As a result, we have solved the problem by multiplying the second buffer value by Point

 
Ilya Malev:

I just described the problem, the logic of the DRAW_NONE buffer values is by definition different from the logic of the rendered values, they are not graphical values and therefore scaling with them in mind is not logical. How they want to solve this problem, or whether they want to leave it as it is, is none of my business.

It all depends on where you want the values to be displayed. If you set the display to a separate window, it doesn't matter if the calculated buffer values are not visible. All values will still fall into this window. Consequently, the scale may break down.

Not logical - I agree, but unlikely to be fixed.

 
Ilya Malev:

Of course thanks for the advice, if I wanted to make some crutch, I would think of something too, but first of all we are comfortable looking at values in the data window. And secondly, we need to use this indicator buffer value in other indicators and Expert Advisors, and something tells me that if we make a buffer for calculations, it will be impossible to get its values through iCustom.

Try it. It is possible to get the values from the colour buffer. So, it's possible to get it out of the calculation buffer as well. After all, it has an index, i.e. it is, theoretically, possible to refer to it.