Beginner's questions in MQL5. Professionals don't pass by. - page 5

 

How can I make some indicator buffers not be drawn on the chart, but display their values in the"Data window" of the indicator?

I do so:

#property indicator_label1  "Buff"
#property indicator_type1   DRAW_NONE

int OnInit ()
{
  PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_NONE);
}


but still the indicator draws a buffer.

 
_o0O:

How can I make some indicator buffers not be drawn on the chart, but display their values in the"Data window" of the indicator?

I do so:


but still the indicator draws a buffer.

got it, it does this:

#property indicator_label1  "Buff"
#property indicator_type1   DRAW_NONE

don't need to do this.

And curiously, this buffer should be specified in #property indicator_plots... Although logically it shouldn't, because it's specified in #property indicator_buffers and it doesn't need drawing.


HOWEVER, the buffer name in data window is displayed incorrectly now....specifying it with PlotIndexSetString(0, PLOT_LABEL, "Buff") doesn't help... Anyway, help please.

 

Good afternoon.

I am taking my first steps in mql5. I generated an EA based on RSI M5 and RSI M15 indicators. Can you please advise how to make a deal be executed by triggering of both signals at the same time? The weight for both is 1. If I set 0.5 then no trades will be executed at all. Parameter Signal threshold value to open = 90.

 
_o0O:

it turns out, that's it:

do not need to do.

Curiously, this buffer should be specified in #property indicator_plots... But logically it shouldn't, because it is specified in #property indicator_buffers and drawing is not required.


HOWEVER, the buffer name in data window is displayed incorrectly now....specifying it with PlotIndexSetString(0, PLOT_LABEL, "Buff") doesn't help... Anyway, help please.

help? what kind of help...?

well, all you have to do is specify

#property indicator_label1  "Buff"

and that's all, the buffer will be named in the data window, it will show the values and let you get these values from the EA, and do not draw the values (very convenient to store additional information and do not clutter the chart with buffer lines).

 
_o0O:

it turns out, that's it:

do not need to do.

Curiously, this buffer should be specified in #property indicator_plots... Although logically it shouldn't, because it is specified in #property indicator_buffers and it is not required to be drawn.


SZY but now wrong buffer name is displayed in data window, specifying name with PlotIndexSetString(0, PLOT_LABEL, "Buff") doesn't help... Anyway, help please.

The colour clr_NONE should be used instead of type DRAV_NONE.

Here is the test code

#property indicator_separate_window

#property indicator_buffers 2
#property indicator_plots   2
#property indicator_type1   DRAW_HISTOGRAM
#property indicator_color1  clrRed
#property indicator_width1  2
#property indicator_label1  "clrRed"
#property indicator_type2   DRAW_HISTOGRAM
#property indicator_color2  clrNONE
#property indicator_width2  2
#property indicator_label2  "clrNONE"

/****************indicator buffers****************/
double buf1[], buf2[];
/**************Custom indicator initialization function**************/
int OnInit()
{
    SetIndexBuffer(0, buf1, INDICATOR_DATA);
    SetIndexBuffer(1, buf2, INDICATOR_DATA);
   return(INIT_SUCCEEDED);
}/*******************************************************************/

/****************Custom indicator iteration function*****************/
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
 int i, limit = rates_total-prev_calculated; // Это тупо для примера. В нормальном индикаторе так делать нельзя!
 for(i = 0; i < limit; i++)
  {
   if(i%2 > 0)
    buf1[i] = 1;
   else
    buf2[i] = 1;
  }
 
   return(rates_total);
}/*******************************************************************/
 
Alexey Viktorov:

You don't need to put DRAV_NONE type, but clr_NONE colour.

Here is the test code

all this is unnecessary, you only need to specify the label

#property indicator_label1  "Buff"
 
_o0O:

it's all superfluous, you only need to specify the label

If you're so smart, why did you ask the question?

 
Alexey Viktorov:

If you're so smart, why did you ask the question?

the smart one is not the one who does not ask questions....

Any forum-goer can get to the answers to their questions, but what the hell is the purpose of this forum if not to find answers as quickly as possible?

My way is simpler and more concise, use it.

ZS Stop "poking" strangers, you clever one.

 
_o0O:

the smart one is not the one who does not ask questions....

Any forum-goer can get to the answers to their questions, but what the hell is the purpose of this forum if not to find answers as quickly as possible?

My way is simpler and more succinct, use it.

You're so wrong. Far, far from it.

 
Alexey Viktorov:

Oh, you're so wrong. Far, far from it.

All the more so, not any, hence it follows that any questions are only welcome.

There is no such nuance in the help. DRAW_NONE does not work either #property or in PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_NONE), PlotIndexSetString(0, PLOT_LABEL, "Buff") does not work either, so what exactly is the logic behind specifying clrNONE to achieve the goal?