How to NOT draw indicator buffers on the chart?

 

If I use indicator buffers, they are always displayed on the chart. How can I NOT display them and still have their values calculated? I need only the values, but not the visible part, but I want still to use the indicator buffers because their size is handled automatically by MT4.

For example, the Barry Support and Resistance indicator.

One way would be to set their color to the background color, but is there a better/cleaner way?

 
Nikolay:

If I use indicator buffers, they are always displayed on the chart. How can I NOT display them and still have their values calculated? I need only the values, but not the visible part, but I want still to use the indicator buffers because their size is handled automatically by MT4.

Yes, if you want 2 buffers drawn and 4 just for calculations

#property version   "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots   2

and when in OnInit

   IndicatorBuffers(6);
//--- indicator buffers mapping
   SetIndexBuffer(0,BuyArrowBuffer);
   SetIndexArrow(0,116);
   SetIndexStyle(0,DRAW_ARROW,EMPTY,ArrowSize,BuyColor);
   SetIndexLabel(0,"Buy");
   SetIndexBuffer(1,SellArrowBuffer);
   SetIndexArrow(1,116);
   SetIndexStyle(1,DRAW_ARROW,EMPTY,ArrowSize,SellColor);
   SetIndexLabel(1,"Sell");

Followed by your other 4 buffers

 
Keith Watford:

Yes, if you want 2 buffers drawn and 4 just for calculations

and when in OnInit

Followed by your other 4 buffers

Thank you Keith! After experimenting with it, it works only if I add a dummy/empty buffer at index 0. And the exact number of IndicatorBuffers() should be set, otherwise they won't be calculated.

Example: 

#property indicator_buffers 0
#property indicator_plots   0

double empty[];
double buf1[];
double buf2[];

// in the init method
SetIndexBuffer(0,empty);
IndicatorBuffers(3);
 
Nikolay:

Thank you Keith! After experimenting with it, it works only if I add a dummy/empty buffer at index 0. 

Example: 

I must admit, I've never tried it with none of the buffers drawing.

 
Keith Watford:

I must admit, I've never tried it with none of the buffers drawing.

It seems that the first buffer at index 0 is always drawn. If left empty, it is not drawn.

 
Nikolay:

If I use indicator buffers, they are always displayed on the chart. How can I NOT display them and still have their values calculated? I need only the values, but not the visible part, but I want still to use the indicator buffers because their size is handled automatically by MT4.

For example, the Barry Support and Resistance indicator.

One way would be to set their color to the background color, but is there a better/cleaner way?

SetIndexStyle(0,DRAW_NONE);

Try this bro

 
vuongtn #:

Try this bro

This is working solution!