iClose return 0 ???
for(int i =0;i <=27; i++){ RefreshRates(); vari[i]=((iClose(pair[i],FastUnit,0)/iClose(pair[i],FastUnit,FastNumb-1))-1)*10000; }
- You must handle 4066/4073 errors. See Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum
- No need for the RefreshRates. That only updates:
You aren't using any of them.
Refreshing of data in pre-defined variables and series arrays.
RefreshRates - Timeseries and Indicators Access - MQL4 Reference
Predefined variables are: _Digits, _LastError, _Period, _Point, _RandomSeed, _StopFlag, _Symbol, _UninitReason, Ask, Bars, Bid, Close[], Digits, High[], Low[], Open[], Point, Time[], Volume[]
Predefined Variables - MQL4 Reference
Also updates: Hour, Minute, and Seconds
Minute() returns wrong values - or am I wrong? - MQL4 and MetaTrader 4 - MQL4 programming forum
- Don't hard code numbers. If you ever change the size of pair, your code breaks. ArraySize
- Don't hard code numbers. Code breaks on JPY pairs and metals. If you want the value in points divide by _Point
Yes, it's ok with the history;
thank you
How would it be possible that "iClose (pair [i], FastUnit, FastNumb-1" return zero?
double abc=iClose(pair[i],FastUnit,FastNumb-1); if (abc==0) abc=1; // Print (i," ",pair[i]," ",iClose(pair[i],FastUnit,FastNumb-1)); vari[i]=((iClose(pair[i],FastUnit,0)/abc)-1)*10000;
How would it be possible that "iClose (pair [i], FastUnit, FastNumb-1" return zero?