Download MetaTrader 5

How to turn positive number to negative number vice versa?

To add comments, please log in or register
Articles have already helped many traders. Come and read them!
Musngi
301
Musngi 2016.10.12 17:40 
How to turn positive number to negative number vice versa? I created indicator when EUR is down it means the USD is up, I computed the price in EUR/USD.
honest_knave
Moderator
2225
honest_knave 2016.10.12 20:02  

Just use a minus sign.

    int myVal1 = 4;
    int myVal2 = -myVal1;
    int myVal3 = -myVal2;
    printf("myVal1=%+i myVal2=%+i myVal3=%+i",myVal1,myVal2,myVal3);

 

To add comments, please log in or register