SetIndexStyle -- DRAW_NONE

 

I have been experimenting with adding an additional index array to a modified iAO(). The new index is not intended to draw anything. Instead, I want that index to return a 1 if the "up" buffer has received the MACD value, and -1 if the "down" buffer has received the MACD. My thought was that, since the style is set to DRAW_NONE, that the visual presentation of the modified iAO would not by altered. Sounds OK on paper, I thought...


The problem is that adding a DRAW_NONE index array to the scheme has the effect of making the histogram render only little red and green dots across the middle of the separate indicator window. Why? The original indexes are unchanged, so why does the addition of a DRAW_NONE index affect their rendering in any way? It does not seem to matter if the new index is at index 0 or at index 3 (iAO has normally indexes 0-2, with index 0 being DRAW_NONE and receiving the MACD value). Is there some special dependency between these index buffers that I am unaware of?


Thanks,


RS

 

Hi RhythmStar

I suggest you look at zigzag.mq4. It has what you want, I think.

If you want to use an indicator buffer just for calculation, you can do this:


// on global scope:
#property indicator_buffers 1 // Sets the number of visible buffers, in this case 1

// Declare arrays for all the indicator buffers you want, e.g.
double VisibleBuffer[];
double Buffer2[];
double Buffer3[];


init()
{
   ...
   IndicatorBuffers(3); // to set the total number of indicator buffers, i.e. visible + non-visible, in this case 3.
   SetIndexBuffer(0, VisibleBuffer);
   SetIndexBuffer(1, Buffer2);
   SetIndexBuffer(2, Buffer3);
   ...
}

Buffer2[] & Buffer3[] will not draw, but behave as indicator buffers.

Hope this helps.

Jellybean

 

Hi Jellybean,

what do you do if the buffers are not in increasing order?

Say buffer1 is based on buffer0, but you don't want to show buffer0?

I tried the obvious answer: changing the numeration of the buffers but for some reason that didn't work.

Reason: