Hello. I want always have rates of daily timeframe in an array to use it in my custom indicator.
I write it in this way to copy all daily rates in first run, and update only last day's rate in every next OnCalculate() call. But it seems this is not the correct way. Can anyone help me?
Limit = rates_total - 1; CopyRates(Symbol(), PERIOD_D1, time[Limit], time[0], Rates);
-
On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
Download history in MQL4 EA - MQL4 programming forum - Page 3 #26.4 (2019) -
In MT4, buffers and MT4 predefined arrays are all ordered AsSeries. There is a difference between the arrays passed to OnCalculate (e.g. low[]) and the MT4 predefined variables (e.g. Low[].) The passed arrays have no default direction, just like MT5.
To determine the indexing direction of time[], open[], high[], low[], close[], tick_volume[], volume[] and spread[], call ArrayGetAsSeries(). In order not to depend on default values, you should unconditionally call the ArraySetAsSeries() function for those arrays, which are expected to work with.
Event Handling Functions - Functions - Language Basics - MQL4 Reference
On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
Download history in MQL4 EA - MQL4 programming forum - Page 3 #26.4 (2019)

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello. I want always have rates of daily timeframe in an array to use it in my custom indicator.
I write it in this way to copy all daily rates in first run, and update only last day's rate in every next OnCalculate() call. But it seems this is not the correct way. Can anyone help me?