Download MetaTrader 5

Fib Levels

To add comments, please log in or register
honest_knave
Moderator
2423
honest_knave  

The documentation now gives an example where the individual fib levels can be set (color, style, width, value).

Anyone managed to get this working? For me, it is the same as it's always been, namely all levels take the same color, style and width.

Excerpt from the documentation:

   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));
     }
Peter Bočan
89
Peter Bočan  
You have to redraw the chart.
honest_knave
Moderator
2423
honest_knave  

Thanks for the reply - that makes no difference.

The levels are redrawn, but all levels take the last color, style and width set in the arrays.

Simon Gniadkowski
Moderator
18003
Simon Gniadkowski  
honest_knave:

The documentation now gives an example where the individual fib levels can be set (color, style, width, value).

Anyone managed to get this working? For me, it is the same as it's always been, namely all levels take the same color, style and width.

Excerpt from the documentation:

 

 

There is no OBJPROP_LEVELCOLOR + n

 

https://docs.mql4.com/constants/objectconstants/enum_object_property 

honest_knave
Moderator
2423
honest_knave  
RaptorUK:

There is no OBJPROP_LEVELCOLOR + n

 

https://docs.mql4.com/constants/objectconstants/enum_object_property 

Hello RaptorUK - you need to scroll down the list a little further and you'll see the modifier:

 

Simon Gniadkowski
Moderator
18003
Simon Gniadkowski  
honest_knave:

Hello RaptorUK - you need to scroll down the list a little further and you'll see the modifier:

 

Nope,  it is still not there . . .  but I understand what you are referring to.  Interestingly in the example code you pointed to the function that sets the level colours is never called.

honest_knave
Moderator
2423
honest_knave  

Hi RaptorUK - that screenshot above is directly from the link you posted. You need to scroll down to the ENUM_OBJECT_PROPERTY_INTEGER section, and you'll find it listed there.

(Note: I'm referring to application through ObjectSetInteger() not ObjectSet() here)

Does anyone know if this functionality is supported in MQL5? In which case, there is slightly more hope...

Alain Verleyen
Moderator
31185
Alain Verleyen  
honest_knave:

Thanks for the reply - that makes no difference.

The levels are redrawn, but all levels take the last color, style and width set in the arrays.

You can't set a different color, style and with for the fibo levels.
honest_knave
Moderator
2423
honest_knave  

Hello angevoyageur, 

I understand that has always been the case.

But doesn't it seem a little odd that they have recently written an example about how to do exactly that? And there are appropriate members of the enumeration family? 

Alain Verleyen
Moderator
31185
Alain Verleyen  
honest_knave:

Hello angevoyageur, 

I understand that has always been the case.

But doesn't it seem a little odd that they have recently written an example about how to do exactly that? 

Yes I know, it's a copy/paste from mql5 documentation. And it does not work with MQL5 either.

You can try your chance with ServiceDesk

honest_knave
Moderator
2423
honest_knave  

Well if it doesn't work in MQL5, then I'm not going to hold my breath!

Thanks for clarifying the situation with MQL5.

I'll go back to using excessive numbers of objects and code to achieve a seemingly simple task. 

12
To add comments, please log in or register