Davidafx:
Have you tried using ArrayCopyRates() ?
I want to load data history to table/array but I don't know how to do. Can you help me, and explain each step of program ? I'm an amatteur.
Others, I want to get result in Alert tipps for verifying date and closed price . Thanks.
Davidafx: I want to load data history to table/array but I don't know how to do.
- If you're asking about your own array, look at https://www.mql5.com/en/forum/138127
- Such as:
#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 acr.arr[][ACR_COUNT]; int init(){ : // https://forum.mql4.com/36470/page2 says ArrayCopyRates is a non- // reentrant, 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(acr.arr, chart.symbol, Period()); // I'm in Init. } int GetBars(){ return( ArrayRange (acr.arr, 0 ) ); } int iGetShift(datetime tm){ #define iCB 0 // Current Bar int iLimit = GetBars(); #define iPB 1 // Previous Bar for (int iTm=iCB; iTm < iLimit; iTm++) if (GetTime(iTm) <= tm) return(iTm); return(iLimit-1); } double GetVal( int eACR, int iBar=iCB){ return( acr.arr[iBar][eACR] ); } datetime GetTime( int iBar=iCB){ return( GetVal( ACR_TIME, iBar) ); } //double GetOpen( int iBar=iCB){ return( GetVal( ACR_OPEN, iBar) ); } double GetHigh( int iBar=iCB){ return( GetVal( ACR_HIGH, iBar) ); } double GetLow( int iBar=iCB){ return( GetVal( ACR_LOW, iBar) ); } double GetClose( int iBar=iCB){ return( GetVal( ACR_CLOSE, iBar) ); } //double GetVolume(int iBar=iCB){ return( GetVal( ACR_VOLUME, iBar) ); }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I want to load data history to table/array but I don't know how to do. Can you help me, and explain each step of program ? I'm an amatteur.
Others, I want to get result in Alert tipps for verifying date and closed price . Thanks.