Indicator Plots

 

Hello all,

I'm trying to get my head around indicator plots and buffers. I've done quite a bit of reading, but there are a few things I'm still trying to figure out.

Let's say I'm using 6 buffers... 2 of which I want to plot as lines.

All the examples I see have the plots first, then the rest:

SetIndexBuffer(0,Plot1,INDICATOR_DATA);
SetIndexBuffer(1,Plot2,INDICATOR_DATA);
SetIndexBuffer(2,Calc1,INDICATOR_CALCULATIONS);
SetIndexBuffer(3,Calc2,INDICATOR_CALCULATIONS);
SetIndexBuffer(4,Calc3,INDICATOR_CALCULATIONS);
SetIndexBuffer(5,Calc4,INDICATOR_CALCULATIONS);

Is this necessary? For example, is it acceptable to do the following (I would like them in a certain order to standardize the iCustom calls from an EA).

SetIndexBuffer(0,Plot1,INDICATOR_DATA);
SetIndexBuffer(1,Calc1,INDICATOR_CALCULATIONS);
SetIndexBuffer(2,Calc2,INDICATOR_CALCULATIONS);
SetIndexBuffer(3,Plot2,INDICATOR_DATA);
SetIndexBuffer(4,Calc3,INDICATOR_CALCULATIONS);
SetIndexBuffer(5,Calc4,INDICATOR_CALCULATIONS);

If this is OK, how to I refer to Plot2? It is in the fourth index buffer, but the second plot. So is the correct syntax:

#property indicator_type2  DRAW_LINE
or

#property indicator_type4  DRAW_LINE

Many thanks in advance for any pointers!!

 

Sorry, I forgot another question... Can you miss out index buffers (again, this is to do with standardizing iCustom calls from an EA)

Example: (note: missing Index Buffer 2)

SetIndexBuffer(0,Plot1,INDICATOR_DATA);
SetIndexBuffer(1,Calc1,INDICATOR_CALCULATIONS);
SetIndexBuffer(3,Plot2,INDICATOR_DATA);
SetIndexBuffer(4,Calc3,INDICATOR_CALCULATIONS);
SetIndexBuffer(5,Calc4,INDICATOR_CALCULATIONS);
 

toast:

is it acceptable to do the following (I would like them in a certain order to standardize the iCustom calls from an EA).

SetIndexBuffer(0,Plot1,INDICATOR_DATA);
SetIndexBuffer(1,Calc1,INDICATOR_CALCULATIONS);
SetIndexBuffer(2,Calc2,INDICATOR_CALCULATIONS);
SetIndexBuffer(3,Plot2,INDICATOR_DATA);
SetIndexBuffer(4,Calc3,INDICATOR_CALCULATIONS);
SetIndexBuffer(5,Calc4,INDICATOR_CALCULATIONS);

no problem at all

If this is OK, how to I refer to Plot2? It is in the fourth index buffer, but the second plot. So is the correct syntax:

#property indicator_type4 DRAW_LINE

 

Thank you very much for the reply!

Just to clarify.. since the recent updates to MQL4, are all the PlotIndexSetInteger supposed to be working? For example, I can't get this to work:

PlotIndexSetInteger(0, PLOT_ARROW_SHIFT,20);

It compiles without error, but it doesn't do anything (no matter what value I add to the shift).

 
toast:

Just to clarify.. since the recent updates to MQL4, are all the PlotIndexSetInteger supposed to be working?

i think it doesnt (only in MQ5)
 
qjol:
i think it doesnt (only in MQ5)


Thank you very much - that has saved me some time!