I can't explain it well, but if you program it like this, it should display correctly.
#property indicator_buffers 3 #property indicator_plots 3 //--- plot ExtDataBuffer1 #property indicator_label2 "ExtDataBuffer1" #property indicator_type2 DRAW_ARROW #property indicator_color2 clrGreen #property indicator_style2 STYLE_SOLID #property indicator_width2 1 //--- plot ExtDataBuffer2 #property indicator_label3 "ExtDataBuffer2" #property indicator_type3 DRAW_ARROW #property indicator_color3 clrRed #property indicator_style3 STYLE_SOLID #property indicator_width3 1 SetIndexBuffer(0, ExtCalcBuffer1, INDICATOR_CALCULATIONS); SetIndexBuffer(1, ExtDataBuffer1, INDICATOR_DATA); SetIndexBuffer(2, ExtDataBuffer2, INDICATOR_DATA); PlotIndexSetInteger(1, PLOT_ARROW, 233); PlotIndexSetInteger(2, PLOT_ARROW, 234);
Thank you Naguisa
This does work, but having to declare the number of plots to be 3, which is understandably confusing, when there are only 2. Where is this mentioned in the documentation?
In the relatively short time I've been using MQL5 I must say that the documentation is incredibly lacking. Without these forums to fill up the gaping holes, our life as programmers would be near impossible.
I don't know it.
Typically, the buffer used for plotting is placed before the calculating buffers, and the number of plots is counted from the first to N.
In this case, the number 0 is not plotted, but since the number 1 and 2 is plotted, the total is 3.
Thank you Naguisa
This does work, but having to declare the number of plots to be 3, which is understandably confusing, when there are only 2. Where is this mentioned in the documentation?
In the relatively short time I've been using MQL5 I must say that the documentation is incredibly lacking. Without these forums to fill up the gaping holes, our life as programmers would be near impossible.
The problem of the documentation is not it "is incredibly lacking", the problem is it's scattered and sometimes not well translated (and so
not always perfectly clear).
The other problem is people don't read it, mostly the ones complaining about it.
Documentation (snippet) :
![Documentation on MQL5: Custom Indicators / Indicator Styles in Examples Documentation on MQL5: Custom Indicators / Indicator Styles in Examples](https://c.mql5.com/36/30/documentation-on-mql5-custom-indicators__1.png)
- www.mql5.com
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
For example, the following code works as expected. The first plot, with plot index 0 uses data from buffer 0 and the second plot with index 1 uses data from buffer 1. Does this mean that the plot is associated with it's buffer by it's index number? eg. Plot 0 = Buffer 0, Plot 1 = Buffer 1. Or, is the association made some other way?
What I'm trying to achieve is to use ExtCalcBuffer1 as buffer 0, ExtDataBuffer1 as buffer 1 and ExtDataBuffer2 as buffer 2 in my indicator and refer to ExtCalcBuffer1 as buffer 0 in my EA code - buffer 1 and buffer 2 not being needed. I tried setting ExtCalcBuffer1 as buffer 0, ExtDataBuffer1 as buffer 1 and ExtDataBuffer2 as buffer 2, but only one plot appeared.
Thank you.