How to delete a Fibonacci-Level after creating an OBJ_FIBO?

 

Hey guys,

in the docs I didn''t find how to delete a fibo level after creating an OBJ_FIBO. I don't need the 23.6 level and so I want to delete it from my chart. Is that somehow possible?

 

Hi Marcus,

The best way is to create Fibo without the 23.6 level. The OBJPROP here after could be used :

//--- set the number of levels 
   ObjectSetInteger(chart_ID,name,OBJPROP_LEVELS,levels); 
//--- set the properties of levels in the loop 
   for(int i=0;i<levels;i++) 
     { 
      //--- level value 
      ObjectSetDouble(chart_ID,name,OBJPROP_LEVELVALUE,i,values[i]); 
      //--- level color 
      ObjectSetInteger(chart_ID,name,OBJPROP_LEVELCOLOR,i,colors[i]); 
      //--- level style 
      ObjectSetInteger(chart_ID,name,OBJPROP_LEVELSTYLE,i,styles[i]); 
      //--- level width 
      ObjectSetInteger(chart_ID,name,OBJPROP_LEVELWIDTH,i,widths[i]); 
      //--- level description 
      ObjectSetString(chart_ID,name,OBJPROP_LEVELTEXT,i,DoubleToString(100*values[i],1)); 
     } 

If you really want to delete a specific level, maybe you could change its color according to your background color ? (ObjectSetInteger(chart_ID,name,OBJPROP_LEVELCOLOR,i,colors[i]);)

An other way maybe is to use these object property : OBJPROP_FIBOLEVELS and OBJPROP_FIRSTLEVEL+n : https://www.mql5.com/en/forum/134775


Ghen

OBJ_FIBO lines
OBJ_FIBO lines
  • 2011.07.26
  • www.mql5.com
MQL4 and MetaTrader 4: OBJ_FIBO lines
 
ghendar:

Hi Marcus,

The best way is to create Fibo without the 23.6 level. The OBJPROP here after could be used :

//--- set the number of levels 
   ObjectSetInteger(chart_ID,name,OBJPROP_LEVELS,levels); 
//--- set the properties of levels in the loop 
   for(int i=0;i<levels;i++) 
     { 
      //--- level value 
      ObjectSetDouble(chart_ID,name,OBJPROP_LEVELVALUE,i,values[i]); 
      //--- level color 
      ObjectSetInteger(chart_ID,name,OBJPROP_LEVELCOLOR,i,colors[i]); 
      //--- level style 
      ObjectSetInteger(chart_ID,name,OBJPROP_LEVELSTYLE,i,styles[i]); 
      //--- level width 
      ObjectSetInteger(chart_ID,name,OBJPROP_LEVELWIDTH,i,widths[i]); 
      //--- level description 
      ObjectSetString(chart_ID,name,OBJPROP_LEVELTEXT,i,DoubleToString(100*values[i],1)); 
     } 

If you really want to delete a specific level, maybe you could change its color according to your background color ? (ObjectSetInteger(chart_ID,name,OBJPROP_LEVELCOLOR,i,colors[i]);)

An other way maybe is to use these object property : OBJPROP_FIBOLEVELS and OBJPROP_FIRSTLEVEL+n : https://www.mql5.com/en/forum/134775


Ghen

Hello Ghen,

Good idea! I think the best and easiest way is setting unwanted fib-level(s) to the background color. 

Thank you!

 
Marcus Riemenschneider:

Hello Ghen,

Good idea! I think the best and easiest way is setting unwanted fib-level(s) to the background color. 

Thank you!


I just found that you can't set diffrent colors to specific fibo-levels. 

it sets same color for all levels, no matter how you try.

Is this a bug of mql or i'm missing something?

Reason: