Problem with setting Fibo retracement levels

 

I have created a Fibo retracement object but I need to use customized levels, I use below code but all lines are showing beside each other.

   if(Fibonacci_Retracement(0,"fibo",0,fibtime1,fibprice1,fibtime2,fibprice2,clrWhite))
     {
      ObjectSetInteger(0,"fibo",OBJPROP_LEVELS,fiblevel);

      for(int i=0; i<fiblevel; i++)
        {
         fiblevelvalue[i]=fibprice1-(fibprice1-fibprice2)*fiblevelfactor[i]*0.01;

         Print(DoubleToString(fiblevelfactor[i],1),"value",fiblevelvalue[i]);


         ObjectSetDouble(0,"fibo",OBJPROP_LEVELVALUE,i,fiblevelvalue[i]);
         ObjectSetString(0,"fibo",OBJPROP_LEVELTEXT,i,DoubleToString(fiblevelfactor[i],1));
        }

fibo is drawn correctly but the result levels are as attached image.


fiblevelvalues is a double array result are correct and its price of each level.

could any one help and tell me where am I wrong?

MQL5.community - User Memo
MQL5.community - User Memo
  • www.mql5.com
You can now not only read articles and download MQL5 programs, but you can also join discussions on the forum, leave comments on articles and source codes, rate MQL5 programs and share your own developments in the Code Base, and even publish articles for a decent fee (see Become an Author at MQL5.com!). MQL5.com services are constantly...
 
Taher Halimi:

I have created a Fibo retracement object but I need to use customized levels, I use below code but all lines are showing beside each other.

fibo is drawn correctly but the result levels are as attached image.

fiblevelvalues is a double array result are correct and its price of each level.

could any one help and tell me where am I wrong?

Try changing this line:

fiblevelvalue[i]=fibprice1-(fibprice1-fibprice2)*fiblevelfactor[i]*0.01;

to 

fiblevelvalue[i]=fiblevelfactor[i];
 
Seng Joo Thio:

Try changing this line:

to 

thank you very much friend, yes you are right, I have to use factors, not the prices.

Reason: