object of trendline

 

the objprop   ray_right can set  the line to right cornor

but can't ray to left cornor , how to do this

 
kuolung1967:

the objprop   ray_right can set  the line to right cornor

but can't ray to left cornor , how to do this

The easiest way... 
#include <ChartObjects\ChartObjectsLines.mqh>
void OnStart()
{
   CChartObjectTrend trend;
   trend.Create(0,"trend",0,Time[0],Low[0],Time[20],High[20]);
   trend.RayLeft(true);
}

Calling ObjectSet...

ObjectSetInteger(m_chart_id,m_name,OBJPROP_RAY_LEFT,true)
 
nicholishen:
The easiest way... 

Calling ObjectSet...

Need to add, at the end :

   trend.Detach();


 
Alain Verleyen:

Need to add, at the end :


Only if you want the line to persist on the chart after the program ends. Most of the time I'm using these in an expert or indicator and I want objects to delete themselves.