Download MetaTrader 5

DRAW_FILLING type indicator buffers mixed up?

To add comments, please log in or register
Tom Clayson
215
Tom Clayson  

I am trying to get my indicator, to, among other things, display the next likely support and resistance levels as a coloured band. The buffers placed above the DRAW_FILL declarations behave as expected, and the support levels display, but not the resistance levels. The values are correctly set in the buffers as seen in the data window. Can anyone see what is wrong? Extracts from the top of the code and OnInit() are below.

#property indicator_buffers 16
#property indicator_plots   6

//SPs
#property indicator_color1  clrYellow,clrViolet
#property indicator_type1   DRAW_COLOR_ARROW
#property indicator_color2  clrYellow,clrViolet
#property indicator_type2   DRAW_COLOR_ARROW
//TrendBase
#property indicator_color3  clrGray
#property indicator_type3   DRAW_LINE
//Trend Limit
#property indicator_color4  clrAliceBlue
#property indicator_type4   DRAW_LINE
//resistance band
#property indicator_color5  clrRed
#property indicator_type5   DRAW_FILLING
//support band
#property indicator_color6  clrGreen
#property indicator_type6  DRAW_FILLING

#property indicator_label1  "SH_Points"
#property indicator_label2  "SL_Points"
#property indicator_label3  "TrendBase"
#property indicator_label4  "TrendLimit"
#property indicator_label5  "Next_Resistance_Span"
#property indicator_label6  "Next_Support_Span"

#property indicator_width1  4
#property indicator_width2  4
#property indicator_width3  1
#property indicator_width4  1
#property indicator_width5  1
#property indicator_width6  1

OnInit() 
{
// swing points indicated by a small square
        SetIndexBuffer(0,SH_Points,INDICATOR_DATA); 
        PlotIndexSetInteger(0,PLOT_ARROW,250);  
        PlotIndexSetInteger(0,PLOT_COLOR_INDEXES,2); 
        SetIndexBuffer(1,SH_Points_color,INDICATOR_COLOR_INDEX);        
        PlotIndexSetInteger(1,PLOT_ARROW,250);  
        
        SetIndexBuffer(2,SL_Points,INDICATOR_DATA); 
        PlotIndexSetInteger(2,PLOT_ARROW,250);
        PlotIndexSetInteger(2,PLOT_COLOR_INDEXES,2);      
        SetIndexBuffer(3,SL_Points_color,INDICATOR_COLOR_INDEX);                
        PlotIndexSetInteger(3,PLOT_ARROW,250);  
        
        SetIndexBuffer(4,TrendBase,INDICATOR_DATA); 
        SetIndexBuffer(5,TrendLimit,INDICATOR_DATA);
   
        SetIndexBuffer(6,Next_Resistance_Span,INDICATOR_DATA); 
        SetIndexBuffer(7,Next_Resistance,INDICATOR_DATA); 
        SetIndexBuffer(8,Next_Support_Span,INDICATOR_DATA);
        SetIndexBuffer(9,Next_Support,INDICATOR_DATA); 
 
        // buffers for data storage only
        SetIndexBuffer(10,SH_Levels,INDICATOR_CALCULATIONS); 
        SetIndexBuffer(11,SL_Levels,INDICATOR_CALCULATIONS); 
        SetIndexBuffer(12,RoundedO,INDICATOR_CALCULATIONS);
        SetIndexBuffer(13,RoundedH,INDICATOR_CALCULATIONS);
        SetIndexBuffer(14,RoundedL,INDICATOR_CALCULATIONS);                     
        SetIndexBuffer(15,RoundedC,INDICATOR_CALCULATIONS);
   
   PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,EMPTY_VALUE);
   PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,EMPTY_VALUE);
   PlotIndexSetDouble(2,PLOT_EMPTY_VALUE,EMPTY_VALUE);
   PlotIndexSetDouble(3,PLOT_EMPTY_VALUE,EMPTY_VALUE);  
   PlotIndexSetDouble(4,PLOT_EMPTY_VALUE,EMPTY_VALUE);
   PlotIndexSetDouble(5,PLOT_EMPTY_VALUE,EMPTY_VALUE);    
   PlotIndexSetDouble(6,PLOT_EMPTY_VALUE,0);
   PlotIndexSetDouble(7,PLOT_EMPTY_VALUE,0);  
   PlotIndexSetDouble(8,PLOT_EMPTY_VALUE,0);
   PlotIndexSetDouble(9,PLOT_EMPTY_VALUE,0);
   PlotIndexSetDouble(10,PLOT_EMPTY_VALUE,EMPTY_VALUE);
   PlotIndexSetDouble(11,PLOT_EMPTY_VALUE,EMPTY_VALUE);  
   PlotIndexSetDouble(12,PLOT_EMPTY_VALUE,EMPTY_VALUE);
   PlotIndexSetDouble(13,PLOT_EMPTY_VALUE,EMPTY_VALUE);
   PlotIndexSetDouble(14,PLOT_EMPTY_VALUE,EMPTY_VALUE);
   PlotIndexSetDouble(15,PLOT_EMPTY_VALUE,EMPTY_VALUE);      
}
Tom Clayson
215
Tom Clayson  
whitebloodcell:

I am trying to get my indicator, to, among other things, display the next likely support and resistance levels as a coloured band. The buffers placed above the DRAW_FILL declarations behave as expected, and the support levels display, but not the resistance levels. The values are correctly set in the buffers as seen in the data window. Can anyone see what is wrong? Extracts from the top of the code and OnInit() are below.

Updated the post after fixing the code that sets the values, the only issue should be something to do with the buffer assignments now.
Tom Clayson
215
Tom Clayson  
Anyone?
To add comments, please log in or register