- The result is not negative. Your problem is elsewhere. Print your variables.
- Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it.
It's use is always wrong
- SL/TP (stops) need to be normalized to tick size (not Point.) (On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 forum) and abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 forum
- Open price for pending orders need to be adjusted. On Currencies, Point == TickSize, so you will get the same answer, but it won't work on Metals. So do it right: Trailing Bar Entry EA - MQL4 forum or Bid/Ask: (No Need) to use NormalizeDouble in OrderSend - MQL4 forum
- Lot size must also be adjusted to a multiple of LotStep. If that is not a power of 1/10 then NormalizeDouble is wrong. Do it right.
Hello, traders!
This is my first forum post on this forum but I really need this one. I'm having pretty peculiar trouble with the function MathAbs int MQL4. It returns a NEGATIVE number. I have two edits of the particular line and it still returns negative. Here it is.
The original one:
And after getting negative by this one I used MathAbs one more time:
The later should in theory make an absolute of the resulting number (although it SHOULD be absolute too). To my rising anger the result is still negative.
Any help will be much appreciated, thanks in advance!
Hi Buddy
I have a very similar issue - i tried everything ... eventually i used MathAbs for the overall formula.
My parameters were one positive and one the result of a difference.
Initially I was doing something like: ArrVolPosTrigger[i] = 1000*PositionTrigger/(MacdUp-MacdDn) - and the result was sometimes (not even consistently negative).
PositionTrigger is just an addition of parameters. Should never be negative and isn't - i checked them with Alert.
My only workaround to date is this: ArrVolPosTrigger[i] = MathAbs(1000*PositionTrigger/(MacdUp-MacdDn)).
Are you saying that not even the workaround works for you ?
Regards
CB
Hi Buddy
I have a very similar issue - i tried everything ... eventually i used MathAbs for the overall formula.
My parameters were one positive and one the result of a difference.
Initially I was doing something like: ArrVolPosTrigger[i] = 1000*PositionTrigger/(MacdUp-MacdDn) - and the result was sometimes (not even consistently negative).
PositionTrigger is just an addition of parameters. Should never be negative and isn't - i checked them with Alert.
My only workaround to date is this: ArrVolPosTrigger[i] = MathAbs(1000*PositionTrigger/(MacdUp-MacdDn)).
Are you saying that not even the workaround works for you ?
Regards
CB

- 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, traders!
This is my first forum post on this forum but I really need this one. I'm having pretty peculiar trouble with the function MathAbs int MQL4. It returns a NEGATIVE number. I have two edits of the particular line and it still returns negative. Here it is.
The original one:
And after getting negative by this one I used MathAbs one more time:
The later should in theory make an absolute of the resulting number (although it SHOULD be absolute too). To my rising anger the result is still negative.
Any help will be much appreciated, thanks in advance!