Hello everyone, can anyone help me with any method to group one object that positioning relative to a chart (Horizontal Line) with another that positioning relative to a security window (E dit) as shown in the picture?
What?
Perhaps you should read the manual. ObjectSetDouble → ENUM_OBJECT_PROPERTY_DOUBLE → OBJPROP_PRICE
How To Ask Questions The Smart Way. (2004)
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
.
Your idea is to get the value of the Y_DISTANCE coordinate of Horizontal Line returned by the OnChartEvent function (in CHARTEVENT_MOUSE_MOVE), but there is a problem that when Ishrink or stretch the chart (CHARTEVENT_CHART_CHANGE), that value does not return the correct y coordinate of the price bar.
Can you have any other idea that I can get the Horizontal Line's Y coordinate, or convert the price, time coordinate to x,y coordinate for example
//+------------------------------------------------------------------+ //| ChartEvent function | //+------------------------------------------------------------------+ void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { //--- static datetime time; static double price; if(sparam=="1" && id==CHARTEVENT_MOUSE_MOVE && labl.Price(0)!=line.Price(0)) { labl.Price(0,line.Price(0)); edit.X_Distance((int)lparam); edit.Y_Distance((int)dparam); int wnd; ChartXYToTimePrice(ChartID(),(int)lparam,(int)dparam,wnd,time,price); ChartRedraw(); } //--- if(id==CHARTEVENT_CHART_CHANGE) { int x,y; ChartTimePriceToXY(ChartID(),0,time,price,x,y); edit.X_Distance(x); edit.Y_Distance(y); ChartRedraw(); } } //+------------------------------------------------------------------+
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello everyone, can anyone help me with any method to group one object that positioning relative to a chart (Horizontal Line) with another that positioning relative to a security window (Edit) as shown in the picture?