I want to get coordinates of begin and end of a trendline(or other type of lines) that user draw on a chart.
I use OnChartEvent
callback function. This function called when user do some changes on chart, like draw a trendline.
When user draw a line, this callback called with value of id CHARTEVENT_OBJECT_CREATE
, but other fields like lparam
and dparam
is zero and I don't know how to get coordinates of line when line created.
void OnChartEvent(const int id,
const long &lparam,
const double &dparam,
const string &sparam)
{
switch(id)
{
case CHARTEVENT_OBJECT_CREATE :
Print("Object Created, lparam: ", lparam, " dparam: ", dparam, " sparam: ", sparam);
break;
}
}
when I draw a line in result I see:
2019.08.02 12:48:38.480 example (EURUSD,H1) Object Created, lparam: 0 dparam: 0.0 sparam: H1 Trendline 33638
But I need to get x,y of line in my robot.