-
Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your difficulty.
No free help (2017)Or pay someone. Top of every page is the link Freelance.
Hiring to write script - General - MQL5 programming forum (2018)We're not going to code it for you (although it could happen if you are lucky or the issue is interesting).
No free help (2017) -
Enable mouse tracking, in OnChartEvent when mouse move, take the coordinates and convert to price/time. What's the problem?
See my GUI/Trade Assistant EA
Indicators: Money Manager Graphic Tool - Risk Management - Articles, Library comments - MQL5 programming forum - Page 8 #80 (2022.02.16).
hi everybody
I need to get the index of the bar when the mouse hovers over that bar.
I am using MT4
Does anyone have help?
Thanks.
Try this example :
#property strict /* first you need to store the previous coordinates of the mouse */ int previous_x=0,previous_y=0,previous_click=0; int OnInit() { //reset on init previous_x=0;previous_y=0;previous_click=0; //enable the mouse track ChartSetInteger(ChartID(),CHART_EVENT_MOUSE_MOVE,true); return(INIT_SUCCEEDED); } void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { //--- //when the mouse moves if(id==CHARTEVENT_MOUSE_MOVE){ //grab the x y and click int x=(int)lparam,y=(int)dparam,click=(int)StringToInteger(sparam); //if the x or the y are different you are interested if(x!=previous_x||y!=previous_y){ //you need to get the time where the x axis of the mouse is pointing at datetime time_result=0; double price_result=0.0; int subwindow_result=0; ChartXYToTimePrice(ChartID(),x,y,subwindow_result,time_result,price_result); //now you have the time at the location of the x // the price at the location of the y // and the subwindow # /* So , if the time returned is <= Time[0] */ if(time_result<=Time[0]){ //then look for the bar index int barTarget=iBarShift(_Symbol,_Period,time_result,true); Comment("Bar["+IntegerToString(barTarget)+"]"); }else{ Comment("No Bar"); } } //pass the x y and click to the previous for recalling later previous_x=x; previous_y=y; previous_click=click; } } void OnTick() { }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi everybody
I need to get the index of the bar when the mouse hovers over that bar.
I am using MT4
Does anyone have help?
Thanks.