Hello, I have a problem with EMPTY_VALUE constant. I have created an indicator which assigns a value to an element in a buffer or it assigns an EMPPTY_VALUE, but when I check the value in expert advisor its value is 2147483647.0000.
So in the "if" statement if(value == EMPTY_VALUE) resolves to false when it should be true. How can I fix the problem?
Thanks, I read the threads and I found useful answers on comparing doubles. But unfortunately I still don't have answer why EMPTY_VALUE gets the value of maximum 32bit integer which is 2147483647. So I can compare doubles with A - B > 0 rather than A > B (or NormalizeDoubles) but the problem I have is that the value is enormously high which makes no sense to compare.
Thanks I got the answer. So what can I use instead of EMPTY_VALUE in indicator? If I use -1 it draws unclear lines, I want it to have a value of null or something like that in order to draw a clear line.
Thanks, and one last question, could you briefly explain why if(value > EMPTY_VALUE - Point) returns true if value is indeed EMPTY_VALUE?
I thought I already did . . . didn't I ?
Comparing double values can often show that value != value read this thread: Can price != price ?
![](https://c.mql5.com/mql4/forum/2013/08/yes_6.gif)
Not very well. A - B > 0 and A > B and NormalizeDoubles(A-B) > 0 are all identical. The == operand. - MQL4 forum
double value = iCustom(...); Print("if( " +value +" == " +EMPTY_VALUE +" ) -> " + (value == EMPTY_VALUE)");
double slope_up = iCustom(Symb, MajorPeriod, "Slope__Line", SlopePeriod, SlopeMethod, SlopePrice, 0, 0);
double slope_dn = iCustom(Symb, MajorPeriod, "Slope_Line", SlopePeriod, SlopeMethod, SlopePrice, 1, 0);
if(slope_up != EMPTY_VALUE && slope_dn == EMPTY_VALUE)
{
//do something here...
}
I actually return the value with Comment("slope_up: " + slope_up + " slope_dn" + slope_dn) and the value of slope_up is 1.3860 (which is calculated correctly) and slope_dn = 2147483647 and the if scope is skipped because slope_dn is not considered equal to EMPTY_VALUE.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello, I have a problem with EMPTY_VALUE constant. I have created an indicator which assigns a value to an element in a buffer or it assigns an EMPPTY_VALUE, but when I check the value in expert advisor its value is 2147483647.0000.
So in the "if" statement if(value == EMPTY_VALUE) resolves to false when it should be true. How can I fix the problem?
Thanks in advance.