Export data to file of metatrader and calculate a value to each line with specific indicator

 
I need to force indicator calculate values for indicators with buffer array of quotes customized.
This link show how can I export basic information of all  quote and symbols of metatrader, https://www.mql5.com/en/articles/502
but this example only show how I can export a basic data like Open, close, High Volume.

But for example I need get calculate a result of indicator of each line 
below a example to be more specific

"Date"         "Time"  "Open"  "High"   "Low"   "Close"   "Volume" "average21" "MACD21" "RSI21"
2011.11.30  11:00    10.00        9.00     9.50    1000              ?????             ????           ?????      ????
2011.11.31  10:00      9.00       8.00     8.50     1000               ????              ???             ???        ???

How can I get value of average21 of this line for example???

How to Prepare MetaTrader 5 Quotes for Other Applications
How to Prepare MetaTrader 5 Quotes for Other Applications
  • 2013.01.02
  • Anatoli Kazharski
  • www.mql5.com
The article describes the examples of creating directories, copying data, filing, working with the symbols in Market Watch or the common list, as well as the examples of handling errors, etc. All these elements can eventually be gathered in a single script for filing the data in a user-defined format.
 

You only have to modify that script, by adding access to indicator handles that you want (through iCustom() function). Then, have to copy indicator(s) buffer to an array (through CopyBuffer() function) and to add the suitable column(s) to the file with its / their data.


Regards.

 
Jose Francisco Casado Fernandez:

You only have to modify that script, by adding access to indicator handles that you want (through iCustom() function). Then, have to copy indicator(s) buffer to an array (through CopyBuffer() function) and to add the suitable column(s) to the file with its / their data.


Regards.


but the problem is : I have all quotes loaded in custom array named as Rate How I can pass the custom quotes to Icustom and make calc of average I try do It


  double close[];
   ArrayResize(_ma1,ArraySize(rates));
   
   for (int i = 0;i<= ArraySize(rates)-1;i++)
   {
       _ma1[i] = rates[i].close;  
       
   }
   
   SetIndexBuffer(0,_ma1,INDICATOR_DATA);
 
   int MA1 = iCustom(NULL,0,"Examples\Custom Moving Average",
                          3,         // Period
                          0,          // Offset
                          MODE_SMA,   // Calculation method
                          PRICE_CLOSE); // Calculating on Close prices


   CopyBuffer(MA1,0,0,ArraySize(rates),_ma1);
   ArraySetAsSeries(_ma1,true);
      
   for (int i=0;i< ArraySize(_ma1)-1;i++)
   {
     Print("data " + TimeToString( rates[i].time) + " valor " + rates[i].close +" ma " + DoubleToString(_ma1[i]));    
   
   }
  

}
Reason: