drinkyd: 1st question: Does 1 and 2 provide the same outcome for ShortBuffer [i]?
CurtaBuffer [i] /= MediaBuffer [i]; // 1) ////////////////////////////////////////// int i = 1; // 2) int A = CurtaBuffer [i] / MediaBuffer [i]; CurtaBuffer [i] = A;
2nd question:
In the code below I received this error: Didi_Index USDCHF, Daily; zero deivide in 'Didi_Index.mq4' (75,25) when I use it with my EA code. What could be causing that? Could it be that some of my tick data is incorrect?
- You didn't provide anything about ShortBuffer[i]
- Please edit your (original) post and use the CODE
button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Messages Editor - double/double is not the same as int/int. № one and № two would be identical if A was a
double.
On MT4 v434, division quotient don't give floating point values(Bug??) - MQL4 programming forum 2012.09.18 -
for(int i = 1; i <= Bars; i++){ CurtaBuffer[i] = iMA(_Symbol, 0, Curta, 0, CurtaMethod, CurtaAppliedPrice, i); MediaBuffer[i] = iMA(_Symbol, 0, Media, 0, MediaMethod, MediaAppliedPrice, i);
There are Bars candles on the chart. Their indexes are [0 … Bars-1]. When i equalsBars you got zeros from iMA, thus your "zero divide." You would know that if you had used strict.Always use strict. Fixing the warnings will save you hours of debugging.
- In addition you can't get the moving average(length) until you have length bars.
How to do your lookbacks correctly.

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
Hi,
I'm trying to understand the Didi_index indicator
1st question: Does 1 and 2 provide the same outcome for CurtaBuffer [i]?
2nd question:
In the code below I received this error: Didi_Index USDCHF, Daily; zero deivide in 'Didi_Index.mq4' (75,25) when I use it with my EA code. What could be causing that? Could it be that some of my tick data is incorrect?