Sometimes the function OrderOpenPrice return number with more digits than it should be and that's make problem because when i use that number inside of if statement like
"Ask==OrderOpenPrice+50*pips" it doesn't make
I attached photos for these examples
I try the fuction "NormalizeDouble"
- No it does not, Floating point has infinite number of digits. It's your not understanding floating point and that some numbers can't be represented exactly. (like 1/10.) Double-precision floating-point format - Wikipedia, the free encyclopedia
- You can't compare doubles for equality and price could easily move from below to above and never be equal. The == operand. - MQL4 forum
- Don't attach a image, insert the image
- 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.
- No it does not, Floating point has infinite number of digits. It's your not understanding floating point and that some numbers can't be represented exactly. (like 1/10.) Double-precision floating-point format - Wikipedia, the free encyclopedia
- You can't compare doubles for equality and price could easily move from below to above and never be equal. The == operand. - MQL4 forum
- Don't attach a image, insert the image
- 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.
Understand the links in The == operand. - MQL4 forum Ask >= OOP+n could be true because of round off at Ask >= OOP+n - 0.000005 and could be false at Ask >= OOP+n + 0.000005.
If the equality is important use (must be true at Ask == OOP+n) Use "definitely >=": Ask - (OOP+n) > -_Point/2. // Note the minus
If the equality is important use (must be false at Ask == OOP+n) Use "definitely >" Ask - (OOP+n) > _Point/2.
If the equality is not important (false when equal or true when not) just use Ask > OOP+n
- No it does not, Floating point has infinite number of digits. It's your not understanding floating point and that some numbers can't be represented exactly. (like 1/10.) Double-precision floating-point format - Wikipedia, the free encyclopedia
- You can't compare doubles for equality and price could easily move from below to above and never be equal. The == operand. - MQL4 forum
- Don't attach a image, insert the image
- 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.
whn i take a buy trade..the order opens above the ask price everytime..bt whn it comes to sell the order opens perfectlt at the marketprice..wht need to be corrected with ordersend function..can someone help me plz..
Sometimes the function OrderOpenPrice return number with more digits than it should be and that's make problem because when i use that number inside of if statement like "Ask==OrderOpenPrice+50*pips" it doesn't make true the condition to execute the code at the brackets of if statement.I try the fuction "NormalizeDouble" but the problem remain .
Below is the code to see the price that open the position (OrderOpenPrice) and x is variable to see that price after using the NormalizeDouble with 1 digit.
Sometimes the results of the Comment function are like : 85.31100000000001 85.3
Sometimes are : 86.59 86.59999999999999
I attached photos for these examples
it's like sometimes the fuction OrderOpenPrice doesn't work and sometimes the NormalizeDouble doesn't work.
it doesn't make any sense.
So guys if you have any idea please help me!
Thanks !
if(OrderSelect(OrdersTotal()-1, SELECT_BY_POS, MODE_TRADES)) { if(OrderType() == OP_SELL && OrderMagicNumber()==MagicNumber) { double x = NormalizeDouble(OrderOpenPrice(),Digits); Comment(StringFormat(string(OrderOpenPrice()),Digits)+" "+StringFormat(string(x),Digits)); } } }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Below is the code to see the price that open the position (OrderOpenPrice) and x is variable to see that price after using the NormalizeDouble with 1 digit.
Sometimes are : 86.59 86.59999999999999
I attached photos for these examples
it's like sometimes the fuction OrderOpenPrice doesn't work and sometimes the NormalizeDouble doesn't work.
it doesn't make any sense.
So guys if you have any idea please help me!
Thanks !