Finding buffer in source code of indicator
-
Hi
I have done a trace on an indicator, but that returns "EMPTY_VALUE (BUFFER 0)" error messages for the 3 buffers.
The indicator works in mt5 both on live and backtesting charts. It also seems to work in fxdreema, in that it recognizes both input and the 3 buffer values in the source code.
But for some reason it registers the 3 values as empty. Buffer 0 and 1 are for painting the candles, and buffer 2 are for plotting a line. Perhaps this is the reason behind the empty values?
I looked through the tutorial and it states that "property" indicates where the buffers are located in the program code (source code), so I copy pasted that part of the source code below, hope it is the right place to find the error in the buffers
As can be seen in the code, the indicator have only 3 buffers, which fxdreema finds seemingly correctly.Hope you can help
The code:
#property indicator_chart_window
#property indicator_buffers 12
#property indicator_plots 3
#property indicator_label1 "Trend bars"
#property indicator_type1 DRAW_COLOR_BARS
#property indicator_color1 clrDarkGray,clrDeepSkyBlue,clrSandyBrown
#property indicator_label2 "Trend candles"
#property indicator_type2 DRAW_COLOR_CANDLES
#property indicator_color2 clrDarkGray,clrDeepSkyBlue,clrSandyBrown
#property indicator_label3 "Trend line"
#property indicator_type3 DRAW_COLOR_LINE
#property indicator_color3 clrDarkGray,clrDeepSkyBlue,clrSandyBrown
#property indicator_style3 STYLE_DOT -
Another question for real programmers! Any volunteering here?
-
you have to edit the buffer
-
your indicator buffers should start like this also
IndicatorBuffers(5);
SetIndexBuffer(0,histou);
SetIndexStyle(0,ShowBars ? DRAW_HISTOGRAM : DRAW_NONE);
SetIndexBuffer(1,histod);
SetIndexStyle(1,ShowBars ? DRAW_HISTOGRAM : DRAW_NONE);
SetIndexBuffer(2,limu);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(3,limd);
SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(4,fillu);
SetIndexStyle(4,DRAW_LINE);according to the buffers starting from 0 to 2
and also replace
#property indicator_buffers 12
to
#property indicator_buffers 3
since its 3 buffers totalif still doesn't work then you have to input the buffers manually
like this
-
Not being a programmer, I couldnt get this to work.
Seems that the person who programmed this went a totally different route than the one suggested here. He did this:
//--- indicator buffers mapping
SetIndexBuffer(0,baro,INDICATOR_DATA);
SetIndexBuffer(1,barh,INDICATOR_DATA);
SetIndexBuffer(2,barl,INDICATOR_DATA);
SetIndexBuffer(3,barc,INDICATOR_DATA);
SetIndexBuffer(4,barcl,INDICATOR_COLOR_INDEX);
SetIndexBuffer(5,cano,INDICATOR_DATA);
SetIndexBuffer(6,canh,INDICATOR_DATA);
SetIndexBuffer(7,canl,INDICATOR_DATA);
SetIndexBuffer(8,canc,INDICATOR_DATA);
SetIndexBuffer(9,cancl,INDICATOR_COLOR_INDEX);
SetIndexBuffer(10,line,INDICATOR_DATA);
SetIndexBuffer(11,linecl,INDICATOR_COLOR_INDEX);
//---So if I change #property indicator_buffers 12 to 3, it will mess up the above code for 12 (0-11) internal buffers, of which 3 are shown?
-
@simharr Can you share the indicator? An what exactly is the problem? There can be empty buffers as their values may not be required for painting anything, but for further calculations. Do you need values other than the painted ones?