Indicator Level

 
Hey,

I have this indicator that needs to do X-thing when it falls below -0.50 which is also a level on a separate window.

For some reason, MetaTrader (or C) doesn't like if statements with negative numbers.

Here's what I'm trying to do.....

if (array[x] < -0.50) { do stuff }

but it doesn't like to use the negative number.

So... I tried storing it as a variable

double pieceofshit = -0.50;

if (array[x] < pieceofshit) { do stuff }

No go..... any ideas?

Maybe an if (array[x] < indicator_level2) { or something }

Thanks in advance.
 

MT4 ( and certainly not C language) has no problem with negative numbers as you wish to use them.

Print the value of array[x] and see what you have stored there.

Looking again, you may need to put the -0.50 in parenthesis to separate the operators:

if (array[x] < (-0.50)) { do stuff }

That doesn't affect your

if (array[x] < pieceofshit) { do stuff }


...so I suspect the value stored in your array is not what you think it is.

Reason: