I saw it once, something that takes a positive value of a variable and change it to negative (and vice versa).
who can help?
who can help?
Assign imported indicator value into variable 4 replies
Assigning a bid value to a fixed variable 7 replies
How to get an MA value of first indicators value? 2 replies
Could RSI value show most update value on eur/usd chart? 6 replies
How to test for blank OR unitialized string variable value? 0 replies
MyVariable = -MyVariable;
int MyVariable = 3;
MyVariable = -MyVariable;
int MyVariable = 3; int MyOtherVar = -MyVariable;
DislikedNo, you only need to do it once. So if you write: int MyVariable = 3; The value of MyVariable will be +3 until you change it. If you then write: MyVariable = -MyVariable; The value of MyVariable gets changed to -3. MyVariable will remain -3 until you change it again. If you don't want to change the value, but just temporarily use it with a reversed sign you can also do so. int MyVariable = 3; int MyOtherVar = -MyVariable; In this case, MyVariable is +3 and MyOtherVar is -3 Hope that makes sense.Ignored
DislikedNo, you only need to do it once. So if you write: int MyVariable = 3; The value of MyVariable will be +3 until you change it. If you then write: MyVariable = -MyVariable; The value of MyVariable gets changed to -3. MyVariable will remain -3 until you change it again. If you don't want to change the value, but just temporarily use it with a reversed sign you can also do so. int MyVariable = 3; int MyOtherVar = -MyVariable; In this case, MyVariable is +3 and MyOtherVar is -3 Hope that makes sense.Ignored
Disliked{quote} if for exemple: int Variable=3; Variable= -Variable; and later I want to assign another value to "Variable": Variable=5; will it be "-5", or the past is forgotten?Ignored
int MyVariable = 5; MyVariable = -MyVariable; // is the same as writing MyVariable = -5;