stanislass: How would it be possible that "iClose (pair [i], FastUnit, FastNumb-1" return zero?
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:
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
stanislass:
On my Pc W7 pro this code runs without problem.
On a VPS W2008R2 it causes a "zero divide".
Even broker, account different.
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;
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
How would it be possible that "iClose (pair [i], FastUnit, FastNumb-1" return zero?