Hello There how to draw Trendline

Created at 03 Jan 2021, 07:22
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!
IM

imrealfighter

Joined 09.11.2020

Hello There how to draw Trendline
03 Jan 2021, 07:22


Hello There Need I little bit of help here ! 

how we draw trendline by our cbot
on like meta4 they have function like ObjectCreate() that have parameter like this

bool  ObjectCreate(
   string        object_name,   // object name
   ENUM_OBJECT   object_type,   // object type
   int           sub_window,    // window index
   datetime      time1,         // time of the first anchor point
   double        price1,        // price of the first anchor point
   datetime      time2=0,       // time of the second anchor point
   double        price2=0,      // price of the second anchor point
   datetime      time3=0,       // time of the third anchor point
   double        price3=0       // price of the third anchor point
   );


so on cBot how could we do it. I try to search on API and I found Chart.DrawTrendLine() and it has parameter in the same way 
public ChartTrendLine DrawTrendLine(string name, DateTime time1, double y1, DateTime time2, double y2, Color color, int thickness, LineStyle lineStyle)

my question is how do we set time1 and time2 I've try to search DateTime class but found nothing so don't know how to assign it. 

Thank you.


@imrealfighter
Replies

imrealfighter
04 Jan 2021, 06:52

Hello There again.

Just tried more and figure it out that Datetime is a built-in function from C# so now I could Create Trendline. 

Thx

 


@imrealfighter