Hi
I have a problem where the spread data in the OnCalculate() parameters sometimes is equal to -bid. It behaves as though the ask value is zero.
When I calculate the spread using the MqlTick values I have no error.
I will attach my test indicator and the output in Experts tab.
Do others have this problem?
Have I coded something wrong?
Is it a bug?
Any help appreciated.
Cheers
Jellybean
Looks like a bug to me.
The -146962 is clearly wrong. For the others, to properly check if Ask-Bid is exactly equal to spread[0], you should use (int)Mathround(SpreadPrice/_Point), since sometimes SpreadPrice/_Point will come up with an answer like 12.9999999999999
Looks like a bug to me.
The -146962 is clearly wrong. For the others, to properly check if Ask-Bid is exactly equal to spread[0], you should use (int)Mathround(SpreadPrice/_Point), since sometimes SpreadPrice/_Point will come up with an answer like 12.9999999999999
Thanks Paul
I guessed that rounding was the reason for the 'good' values not being equal, but thanks for the tip on how to do it.
Any comments from MetaQuotes on the negative spread values?
Cheers
Jellybean
Fixed
Tests fine now. Thank you.
Jellybean

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi
I have a problem where the spread data in the OnCalculate() parameters sometimes is equal to -bid. It behaves as though the ask value is zero.
When I calculate the spread using the MqlTick values I have no error.
I will attach my test indicator and the output in Experts tab.
Do others have this problem?
Have I coded something wrong?
Is it a bug?
Any help appreciated.
Cheers
Jellybean