title: How to make OnCalculate() function in Custom Indicator use GPU in MQL5 / OpenCL?
body: <p>I have created an Indicator using MQL5.</p>
  
  <p>After Profiling, the program I read that 99% of my CPU is used by my <code>OnCalculate()</code>.</p>
  
  <p>Here is my function:  </p>
  
  <pre><code>int OnCalculate( const int     rates_total,
                   const int     prev_calculated,
                   const int     begin,
                   const double &amp;price[]
                   )
    {
  //--- check for bars count
        float tempprice[];
        ArrayResize( tempprice, ArraySize( price ) );
        if (  rates_total &lt;  InpMAPeriod - 1 + begin ) return( 0 ); // not enough bars for calculation
  //--- first calculation or number of bars was changed
        if (  prev_calculated == 0 ) ArrayInitialize( ExtLineBuffer, 0 );
  
        ArrayCopy( tempprice, price );
  //--- sets first bar from what index will be draw
        PlotIndexSetInteger( 0, PLOT_DRAW_BEGIN, InpMAPeriod - 1 + begin );
  
        switch( InpMAMethod )
        {
           case MODE_EMA:  Execute_Me( price,
                                      "CalculateEMA",
                                       rates_total,
                                       prev_calculated,
                                       begin
                                       );
                           break;
           case MODE_LWMA: Execute_Me( price,
                                      "CalculateLWMA",
                                       rates_total,
                                       prev_calculated,
                                       begin
                                       );
                           break;
           case MODE_SMMA: Execute_Me( price,
                                      "CalculateSmoothedMA",
                                       rates_total,
                                       prev_calculated,
                                       begin
                                       );
                           break;
           case MODE_SMA:  Execute_Me( price,
                                      "CalculateSimpleMA",
                                       rates_total,
                                       prev_calculated,
                                       begin
                                       );
                           break;
       }
       return( rates_total );
    }
  </code></pre>
  
  <p>Here is the result of profiling: 
  <a href="https://i.stack.imgur.com/pwFVG.png" rel="noreferrer"><img src="https://i.stack.imgur.com/pwFVG.png" alt="profiling result"></a>   </p>
  
  <p>Kindly, let me know, how I can make the <code>OnCalculate()</code> work on GPU instead of CPU.</p>