how to modify an Object? (FibonacciRetracement)

Created at 20 Oct 2021, 20:50
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
IG

ignacio.martinez.i

Joined 22.05.2021

how to modify an Object? (FibonacciRetracement)
20 Oct 2021, 20:50


Hi guys, I'm working on my Cbot and I want to draw a Fibonacci retracement, I know how to draw it but it came with the default configurations.

Chart.DrawFibonacciRetracement("x", Bars.OpenTimes.Last(1), Bars.ClosePrices.Last(1), Bars.OpenTimes.Last(0), Bars.ClosePrices.Last(1) - (50 / 10), Color.Lime);

the questions is: Can I modify the levels, values, etc.?

this is how I done it in MT4, but I don't know how to do it in Calgo.

ObjectCreate(ChartID(),TimeToString(OrderOpenTime()),OBJ_FIBO,0,Time[0],OrderOpenPrice(),Time[1],(OrderOpenPrice()+(50/10)));
                           ObjectSetInteger(ChartID(),TimeToString(OrderOpenTime()),OBJPROP_LEVELS,5);       
                           ObjectSetInteger(ChartID(),TimeToString(OrderOpenTime()),OBJPROP_LEVELCOLOR,0,clrLime); //--- level color 
                           ObjectSetInteger(ChartID(),TimeToString(OrderOpenTime()),OBJPROP_LEVELSTYLE,0,STYLE_SOLID);  //--- level style
                           ObjectSetInteger(ChartID(),TimeToString(OrderOpenTime()),OBJPROP_LEVELWIDTH,0,1); //--- level width  
                           ObjectSetInteger(ChartID(),TimeToString(OrderOpenTime()),OBJPROP_RAY_RIGHT,False);
                                               
                           ObjectSetDouble(ChartID(),TimeToString(OrderOpenTime()),OBJPROP_LEVELVALUE,0,0); //--- level value                            
                           ObjectSetString(ChartID(),TimeToString(OrderOpenTime()),OBJPROP_LEVELTEXT,0,"COMPRA (%$)");//--- level description
                           
                           ObjectSetDouble(ChartID(),TimeToString(OrderOpenTime()),OBJPROP_LEVELVALUE,1,1); //--- level value 
                           ObjectSetString(ChartID(),TimeToString(OrderOpenTime()),OBJPROP_LEVELTEXT,1,"INICIO (%$)");//--- level description
                           
                           ObjectSetDouble(ChartID(),TimeToString(OrderOpenTime()),OBJPROP_LEVELVALUE,2,2); //--- level value 
                           ObjectSetString(ChartID(),TimeToString(OrderOpenTime()),OBJPROP_LEVELTEXT,2,"VENTA (%$)");//--- level description
                            
                            ObjectSetDouble(ChartID(),TimeToString(OrderOpenTime()),OBJPROP_LEVELVALUE,3,3); //--- level value 
                           ObjectSetString(ChartID(),TimeToString(OrderOpenTime()),OBJPROP_LEVELTEXT,3,"Nivel2");//--- level description
                            
                            ObjectSetDouble(ChartID(),TimeToString(OrderOpenTime()),OBJPROP_LEVELVALUE,4,4); //--- level value 
                           ObjectSetString(ChartID(),TimeToString(OrderOpenTime()),OBJPROP_LEVELTEXT,4,"Nivel3");//--- level description

 

thanks!!

                        

 


@ignacio.martinez.i
Replies

amusleh
21 Oct 2021, 09:47

Hi,

Please check our code example for Fibonacci retracement: cAlgo API Reference - ChartFibonacciRetracement Interface (ctrader.com)

Or check our Fibonacci drawing indicator code: 

 


@amusleh