First question: why are you normalizing the price (at all), and particularly to 4 digits? JPY crosses are 2 or 3 digits.
Second question: are you using this code on a different chart to USDJPY?
Hi,
I get the same result with plain old Ask,-slippage,.....
Yes, the code is being used on a AUDUSD chart, along with a couple of other pairs that don't cause any problems.
Hi,
I get the same result with plain old Ask,-slippage,.....
Yes, the code is being used on a AUDUSD chart, along with a couple of other pairs that don't cause any problems.
You can't use Ask to place an order on USDJPY if the EA is running on AUDUSD. Please read the documentation.
You have to use MarketInfo() to get USDJPY price.
You can't use Ask to place an order on USDJPY if the EA is running on AUDUSD. Please read the documentation.
You have to use MarketInfo() to get USDJPY price.
Ok ...I'll do that now.
I'm curious though, why would the other pairs work properly?
Hi,
I get the same result with plain old Ask,-slippage,.....
Yes, the code is being used on a AUDUSD chart, along with a couple of other pairs that don't cause any problems.
When you use the predefined variables of Bid and Ask, they relate to the chart the code is running on.
So, if you are running this code on the AUDUSD chart, then you are trying to open a Buy order on USDJPY at the Ask price of AUDUSD.
You need to use the correct price. You can either get all the current info on the latest USDJPY tick using:
SymbolInfoTick("USDJPY",tick);
and then access the appropriate value e.g.
Or you can retrieve just the value you need:
or the older way:
The documentation on SymbolInfoDouble() suggests that SymbolInfoTick() is preferable in this scenario but I haven't encountered the issues using SymbolInfoDouble():
Note
It is recommended to use SymbolInfoTick() if the function is used for getting information about the last tick. It may well be that not a single quote has appeared yet since the terminal is connected to a trading account. In such a case, the requested value will be indefinite.
In most cases, it is enough to use SymbolInfoTick() function allowing a user to receive the values of Ask, Bid, Last, Volume and the time of the last tick's arrival during a single call.
MrMonty: he code is being used on a AUDUSD chart, along with a couple of other pairs that don't cause any problems.
- This is why I recommendDo not trade multiple currencies in one EA
- You can't use any predefined variables, can't use the tester, must poll (not OnTick,) and usually other problems.
- Code it to trade the chart pair only. Look at the others if you must.
- Then put it on other charts to trade the other pairs. Done.
- 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.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
Why in the world does this
_ticket=OrderSend("USDJPY",OP_BUY,_lotsize,NormalizeDouble(Ask,4),_slippage,_stop,_prof,_comment,_magic,_expiry,_arrow);
always fail with error 4107 in my demo account?