ChartSetSymbolPeriod()

 

Asynchronous functions are obviously placed in the queue of other events in the chart, is it possible to view the all message queue of the chart and figure out how much time is left until the function is executed?

bool  ChartSetSymbolPeriod( 
   long             chart_id,     // ID del Grafico 
   string           symbol,       // Nome del Simbolo 
   ENUM_TIMEFRAMES  period        // Periodo 
   );

Changes the symbol and period for the specified graph. The function is asynchronous, that is, it sends the command and does not wait for its completion. The command is added to the message queue of the chart and will be executed after all previous commands have been processed.

 
fly7680: Asynchronous functions are obviously placed in the queue of other events in the chart, is it possible to view the all message queue of the chart and figure out how much time is left until the function is executed?

Changes the symbol and period for the specified graph. The function is asynchronous, that is, it sends the command and does not wait for its completion. The command is added to the message queue of the chart and will be executed after all previous commands have been processed.

Unfortunately MetaQuotes has not provided any MQL functionality for directly handling the chart event queue or interrogating its status.
 

Fernando Carreiro thanks for the response!

It's a shame because often with articulated codes it would be helpful to understand this!

 
Try this approach.
void FreeChartQueue( const long Chart = 0 )
{
  const color ColorStopLevel = (color)::ChartGetInteger(Chart, CHART_COLOR_STOP_LEVEL);
  
  ChartSetInteger(Chart, CHART_COLOR_STOP_LEVEL, ColorStopLevel + 1);    
  
  while (!IsStopped() && (::ChartGetInteger(Chart, CHART_COLOR_STOP_LEVEL) != ColorStopLevel + 1))
    Sleep(0);
    
  ChartSetInteger(Chart, CHART_COLOR_STOP_LEVEL, ColorStopLevel);        

  // ChartRedraw(Chart);
}
 
fxsaber #: Try this approach.

I doubt that will work for the current chart. Until you return from OnTick/OnChartEvent, nothing will be done with the queue.

 
William Roeder #:

I doubt that will work for the current chart. Until you return from OnTick/OnChartEvent, nothing will be done with the queue.

Try it.