Removing Irrelevant Line Color Options from Menu - Custom Indicator

To add comments, please log in or register
R87.FX
46
R87.FX  

I have a custom indicator that uses some buffers for calculations to create objects (horizontal lines in the indicator window).  I have used SetIndexBuffer(n,DRAW_NONE) and it all performs correctly.  But in the indicator's Properties menu under the 'Color' tab there is still the option to choose line color, width and type for each, even though these settings are meaningless.  Is there a way to remove these from the Properties menu while still keeping everything else the same?

P.S. I realize I could probably remove these calculations from the buffers completely and still be able to draw the lines I want but I like having the data displayed in the Data Window.

Relevant code and screenshot attached below.

Indicator Color Menu

The first 2 buffers (0 & 1) plot and therefore their settings are relevant.  The rest do/are not.


int init()
  {
//---- indicator buffers mapping
   SetIndexBuffer(0,ExtRVIBuffer);
   SetIndexBuffer(1,ExtRVISignalBuffer);
   SetIndexBuffer(2,ExtRVI_MaxBar_Buffer);  
   SetIndexBuffer(3,ExtRVI_MinBar_Buffer);     
   SetIndexBuffer(4,ExtRVI_Max_Buffer);
   SetIndexBuffer(5,ExtRVI_UL_Buffer);
   SetIndexBuffer(6,ExtRVI_Mid_Buffer);
   SetIndexBuffer(7,ExtRVI_LL_Buffer);
   SetIndexBuffer(8,ExtRVI_Min_Buffer);
   
//---- indicator line
   SetIndexStyle(0,DRAW_LINE,2,2,clrBlack);
   SetIndexStyle(1,DRAW_LINE,2,2,clrRed);
   SetIndexStyle(2,DRAW_NONE);
   SetIndexStyle(3,DRAW_NONE);   
   SetIndexStyle(4,DRAW_NONE);
   SetIndexStyle(5,DRAW_NONE);
   SetIndexStyle(6,DRAW_NONE);
   SetIndexStyle(7,DRAW_NONE);
   SetIndexStyle(8,DRAW_NONE);
   SetIndexStyle(9,DRAW_NONE);
  
//---- drawing settings  (Only for Buffers that draw)
   SetIndexDrawBegin(0,ExtRVIPeriod+3);   
   SetIndexDrawBegin(1,ExtRVIPeriod+7); 
R87.FX
46
R87.FX  
In the end I just removed these buffers all together since they are not really needed in any calculations and the indicator window displays the same information more clearly. However I am still curious to know if removing non-drawn buffers from the ‘Colors’ tab.
whroeder1
17987
whroeder1  
  1. You said they were drawn buffers. Reduce your indicator_buffers (to what is drawn) and add non-drawn buffers in OnInit
              IndicatorBuffers - Custom Indicators - MQL4 Reference

  2. Start using the new Event Handling Functions.
              Event Handling Functions - Functions - Language Basics - MQL4 Reference

R87.FX
46
R87.FX  
Thank you, I now see that "#property indicator_buffers" and "IndicatorBuffers()" are specifying different things despite their similar names. With this fix everything appears as it should in the data window and the colors tab.  I will also begin using the new Event Handling Functions per your suggestion.

I also wanted to say that your advice on past posts has been invaluable for my learning MQL4.  This indicator would not even compile if it were not for your extensive posts about arrays, object and syntax to others on this forum.  Thank you whroeder1.
To add comments, please log in or register