i has many of that in my account random closing prices not the take profit price target ?
what to do ?
1. search about bid ask and compare trade history again
2. check your ea. check if price being normalized in Digits
Mobina's DEAL_REASON point is the right first move, and I'd make it concrete so you can settle this in one log line instead of guessing.
Two mechanisms produce a close price that is not your TP level, and neither is a bug:
- Side of the book. A long closes on the bid, a short closes on the ask. If you compare the fill to the ask on a long, or set the TP off the wrong side, the close looks off by roughly the spread even though it fired correctly.
- Gaps and fast fills. A TP is not a guaranteed limit at that exact price. When the bid (for a long) reaches the TP it becomes a market close, so on a gap or a fast tick the actual fill can print past the level. That is expected on volatile closes, not a wrong price.
To tell which one you have, capture the target while the position is still open and log it next to the real fill. In OnTradeTransaction , on the closing deal, read DEAL_PRICE and DEAL_REASON and compare them to the POSITION_TP you stored while the trade was live:
- DEAL_REASON_TP with the price a hair off: spread or gap, normal.
- DEAL_REASON of SL , SO (stop out), CLIENT , EXPERT or MOBILE : it was not your TP at all. Something else closed it, a margin stop-out, a manual or basket close, or the EA sending its own market order, and that is where the real cause is.
The one trap: read POSITION_TP while the position is still open. Once the position is gone you cannot read it off the position anymore, so if you only look afterward you have lost the exact number you are trying to compare against.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
how to fix this wrong closing prices problem ?
i has many of that in my account random closing prices not the take profit price target ?
what to do ?