negative numbers

 
dev = dev * 1.0;

Why does the above line compile, but if I add a negative sign (below) then I get a compile error '-' unexpected token?

dev = dev * -1.0;
 
jshumaker:

Why does the above line compile, but if I add a negative sign (below) then I get a compile error '-' unexpected token?

Because - is an operator and the compiler struggles with operator operator at least that is what I think is happening . . . I get round this issue by doing this . . .

dev = -1.0 * dev ;

or you could do this, it should work . . .

dev = dev * ( -1.0 );
 
jshumaker:

Why does the above line compile, but if I add a negative sign (below) then I get a compile error '-' unexpected token?

This is a limitation of mql4 compiler. The mql5 compiler doesn't have this issue, so the future mql4 compiler won't have this limitation.

Additionally to RaptorUK alternatives, you can also use :

dev *= -1.0;