Download MetaTrader 5
To add comments, please log in or register
Download MQL5 library codes via MetaTrader. It is convenient!
Toast
220
Toast 2014.02.28 00:07 

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!!

Toast
220
Toast 2014.02.28 00:10  

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);
qjol
3243
qjol 2014.02.28 01:28  

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

Toast
220
Toast 2014.02.28 10:44  

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).

qjol
3243
qjol 2014.02.28 10:58  
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)
Toast
220
Toast 2014.02.28 18:06  
qjol:
i think it doesnt (only in MQ5)


Thank you very much - that has saved me some time!
/
To add comments, please log in or register