signals[i].Signalperc = (iClose(TradePairs[i], 1, 0) - iClose(TradePairs[i], trigger_TF_HM1, 1)) / iClose(TradePairs[i], trigger_TF_HM1, 1) * 100;
The divisor must be nonzero.
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 - Forex Calendar - MQL4 programming forum - Page 3 #26.4 (2019)
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 - Forex Calendar - MQL4 programming forum - Page 3 #26.4 (2019)
That is exactly the point! You are not checking for those errors.
ResetLastError(); double dbClose = iClose( TradePairs[i], trigger_TF_HM1, 1 ); if( _LastError == ERR_NO_ERROR ) { // proceed with calculations } else { PrintFormat("Error code %d obtaining close price for %s", _LastError, TradePairs[i] ); // Handle the situation; };
It seems you don't understand. The reason you are getting a zero divide error is because:
- You are not checking your divisor
- You are not checking you return value from iClose
- You not checking for returned errors
- You are not synchronising your data for multi-symbol
I gave you sample code to check the iClose and the error code.
You said that you got "Unexpected token ". I said show your new code with that compile error.
Do you understand that?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
when i compile i have zero errors but when i run the ea i see this sometimes pop up
and in Metaeditor Debugger it highlights this section of code. i will post it below.
line 1186 is
so i am confused at how to fix this error any help would be much appreciated. thank you for all the help community