Drawing too many buffer lines

 

I have 100 index buffers. I only want to draw 8 lines. The rest are there for calculation. How to I only draw 8. I have the ones I want to draw set to the first 8 indexes (0-7) I dont know how to stop the rest from drawing other than opening up the indicator settings window and setting the color to None. There must be an easier way in code.

I was thinking something like this but I dont know the correct syntax.


  if(SetIndexBuffer > 7){
  clrNONE;
  }
 
SirFency:

I have 100 index buffers. I only want to draw 8 lines. The rest are there for calculation. How to I only draw 8. I have the ones I want to draw set to the first 8 indexes (0-7) I dont know how to stop the rest from drawing other than opening up the indicator settings window and setting the color to None. There must be an easier way in code.

I was thinking something like this but I dont know the correct syntax.


Hello friend,

Post your indicator code so we can all learn something.

 
GrumpyDuckMan:

Hello friend,

Post your indicator code so we can all learn something.

The code is getting pretty big. I'll attach it.

 
SirFency:

The code is getting pretty big. I'll attach it.

//
//-- first set the number of buffers that are going to be drawn
//

#property indicator_buffers 8

//
//--- change the start of OnInit() to this - increasing the total number of run-time used buffers to 100
//

int OnInit()
  {
  IndicatorBuffers(100);
  
 
#property indicator_buffers 10000000
#property indicator_plots 8
Also the plots should be the first 8 buffers and (in OnInit) should be defined as indicator_calculations.
 
I appreciate the help guys but Neither of these suggestions solved the issue. I have tried both suggestions individually and then started playing with different combinations of the two suggestions and each time when I apply the indicator to my chart when the little window pops up I go to the colors tab. I see the first 8 colors are correct (0-7) then I see all the other buffers are showing up and black (8-99).
 
SirFency:
I appreciate the help guys but Neither of these suggestions solved the issue. I have tried both suggestions individually and then started playing with different combinations of the two suggestions and each time when I apply the indicator to my chart when the little window pops up I go to the colors tab. I see the first 8 colors are correct (0-7) then I see all the other buffers are showing up and black (8-99).

Did you (try)?


all the best

 
Mladen Rakic:

Did you (try)?


all the best

Well I'm dumbfounded. Both my file and your file are exactly the same Mladen. Yours works great. Mine still has all the black lines. I dont understand that at all. I went through both files side by side to make sure each line matched perfectly and they do. My file must be corrupted somehow.

 
kypa: Also the plots should be the first 8 buffers and (in OnInit) should be defined as indicator_calculations.

Please stop posting MT5 code in the MT4 forum. There is no indicator_plots.

 
whroeder1:

Please stop posting MT5 code in the MT4 forum. There is no indicator_plots.

Thank you. I was losing my mind trying to find this in my documentation.

 
SirFency:

I have 100 index buffers. I only want to draw 8 lines. The rest are there for calculation. How to I only draw 8. I have the ones I want to draw set to the first 8 indexes (0-7) I dont know how to stop the rest from drawing other than opening up the indicator settings window and setting the color to None. There must be an easier way in code.

I was thinking something like this but I dont know the correct syntax.


Add this to all buffers you don't want to draw the black line
SetIndexStyle(9, DRAW_NONE);
Reason: