Hello, I used the original code from the RSI indicator provided bei MetaQuotes and tried to adjust it to print two RSI in the same window. I basically copied and pasted the original code and added "_1" and "_2". The first indicator is drawn and seems to work but the other is not and I do not understand why. I have no experience with coding indicators.
SetIndexBuffer(0,ExtRSIBuffer_1,INDICATOR_DATA); SetIndexBuffer(1,ExtPosBuffer_1,INDICATOR_CALCULATIONS); SetIndexBuffer(2,ExtNegBuffer_1,INDICATOR_CALCULATIONS); SetIndexBuffer(3,ExtRSIBuffer_2,INDICATOR_DATA); SetIndexBuffer(4,ExtPosBuffer_2,INDICATOR_CALCULATIONS); SetIndexBuffer(5,ExtNegBuffer_2,INDICATOR_CALCULATIONS);
should be:
SetIndexBuffer(0,ExtRSIBuffer_1,INDICATOR_DATA); SetIndexBuffer(1,ExtRSIBuffer_2,INDICATOR_DATA); SetIndexBuffer(2,ExtPosBuffer_1,INDICATOR_CALCULATIONS); SetIndexBuffer(3,ExtNegBuffer_1,INDICATOR_CALCULATIONS); SetIndexBuffer(4,ExtPosBuffer_2,INDICATOR_CALCULATIONS); SetIndexBuffer(5,ExtNegBuffer_2,INDICATOR_CALCULATIONS);
The buffers required to draw plots need to be the first buffers you index. Since DRAW_LINE plots is plotted with only 1 buffer each, your first 2 indexed buffers need to be the arrays that plot the first and second RSI, in this order. Once the arrays required to draw each buffer are indexed, the order for the other buffers doesn't matter. If the plots required 2 buffers each, like with DRAW_COLOR_LINE, index 0 would be the first RSI plot values, index 1 would be the color index buffer for that plot, index 2 would be the 2nd RSI's plot values, index 3 would be that plot's color index buffer, and then the rest could be in any order you want. That's how buffers need to be indexed to allow MT5 to know what buffers are used to draw each plot.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello, I used the original code from the RSI indicator provided bei MetaQuotes and tried to adjust it to print two RSI in the same window. I basically copied and pasted the original code and added "_1" and "_2". The first indicator is drawn and seems to work but the other is not and I do not understand why. I have no experience with coding indicators.