make it faster

 
created an indicator to move the obj by chartevent mouse move.

problem is that object is moving asynchronously and lagging. how to make it faster?


#property strict
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_plots 0

double tmpPrice;datetime tmpTime=-1;int subWindow=0;

int OnInit(){
ResetLastError();
   ChartSetInteger(0,CHART_EVENT_MOUSE_MOVE,1);
return(INIT_SUCCEEDED);
}



void OnDeinit(const int reason){

}



int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[]){
   
return(rates_total);
}




void OnChartEvent(const int id,const long& lparam,const double& dparam,const string& sparam){
   if(id==CHARTEVENT_MOUSE_MOVE){    
      ChartXYToTimePrice(0,(int)lparam,(int)dparam,subWindow,tmpTime,tmpPrice);
      ObjectSetDouble(0,1234,OBJPROP_PRICE,tmpPrice);
      ObjectSetInteger(0,1234,OBJPROP_TIME,tmpTime);
      ChartRedraw();
   }
}
 
Your topic has been moved to the section: Technical Indicators
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893