Want to draw a trend line.

 

Hello and wish a very happy new year in advance.

I'm trying to draw a line joining the highest points and lowest points among the last fifty bars, so as to create a channel or a triangle, whatever it may form.

Can anyone simplify the use of ObjectCreate(), ObjectSet(), etc... which will be required here. OBJ_TREND description says, it requires 2 coordinates, which and how to do that!

Thank you.

Regards,

Rohit

 
    High[iHighest(NULL,0,MODE_HIGH,50,0)] //high coordination
    Low[iLowest(NULL,0,MODE_LOW,50,0)]    //low coordination

 
qjol:


Yes, I'm using that to find the highest and lowest values... But how do I join them with a line??

How do I draw the line using an EA???

Thank you

Regards,

Rohit

 
 
ksrohit2712:

Can anyone simplify the use of ObjectCreate(), ObjectSet(), etc... which will be required here. OBJ_TREND description says, it requires 2 coordinates, which and how to do that!


 
ksrohit2712:



if (ObjectFind("TrendTop"+Periode)<0)
{
ObjectCreate("TrendTop"+Periode, OBJ_TREND, 0, swing.date[2],swing.value[2], swing.date[0],swing.value[0]);
ObjectSet("TrendTop"+Periode, OBJPROP_COLOR, LineColor);
}
else
{
ObjectSet("TrendTop"+Periode, OBJPROP_TIME1,swing.date[2]);
ObjectSet("TrendTop"+Periode, OBJPROP_PRICE1,swing.value[2]);
ObjectSet("TrendTop"+Periode, OBJPROP_TIME2,swing.date[0]);
ObjectSet("TrendTop"+Periode, OBJPROP_PRICE2,swing.value[0]);
}

You need coordinate 1 (Date and Price) and coordinate2 (Date and Price), between this the trendline will drawn and continue on the right side.

Reason: