ArrayCopyRates

 

Dear Forum,

Is there any example to teach me to handle correctly the function:

int ArrayCopyRates( double&dest_array[], string symbol=NULL, int timeframe=0) 
 

Let's say I need to code the indicator WPR inside DLL, how to pass the parameters to DLL?

Also, is this process slows down the considerably the execution speed?

Thank you.

 
   #define ACR_TIME     0  // Array Copy Rates
   #define ACR_OPEN     1
   #define ACR_LOW      2
   #define ACR_HIGH     3
   #define ACR_CLOSE    4
// #define ACR_VOLUME   5
      #define ACR_COUNT    6
double   m1.acr[][ACR_COUNT];                   // Export to NewTrade/Masar
datetime        analyze.daily.next;
int init(){
   //{https://forum.mql4.com/36470/page2 says ArrayCopyRates is a nonreentrant,
   // non-thread-safe call. Therefor you must put a mutex around the call in
   // case of multiple EAs on multiple charts. Alteratively, since init() is
   // single threaded across all charts, put all ACRs there.
   ArrayCopyRates(m1.acr, market.pair, PERIOD_M1);          // I'm in an OnInit.
   //}
}
int start(){
   int nBars = ArrayRange(m1.acr,0)
   dll(m1.acr, nBars ...
ACR just maps the given array to its internal buffers, no execution overhead at all.
Reason: