Late take profit on tester



I am a newbie having a hard time understanding what is going on with this TP. Order #2 is executed correctly with TP=36.29, then nothing happens until partial realization order #3 is issued and executed. For some reason this triggers #4, which is the TP based on order #2. However, I suppose it should have been triggered long ago, several days before.

Why the TP was not executed before? What kept it dormant for so many days when the price had obviously been reached? There is no spread issue here since tp price has been far exceeded.

I understood from that the problem might be carrying the position overnight. Nevertheless, other tests make me believe I am misreading the explanation because the behaviour is not always this.

  • On the exchange market, when a position is moved to the next trading day (the swap), as well as when moved to another account or during delivery, the levels of Stop Loss and Take Profit are reset.

I'm using MT5 version 5, build 2560 (Jul 2020). Timeframe is H1. All is happening in OnTimer() event when market is closed. Position accounting system is netting.

Thank you for your time and help!

Basic Principles - Trading Operations - MetaTrader 5 Help
Basic Principles - Trading Operations - MetaTrader 5 Help
is an instruction given to a broker to buy or sell a financial instrument. There are two main types of orders: Market and Pending. In addition, there are special Take Profit and Stop Loss levels. is the commercial exchange (buying or selling) of a financial security. Buying is executed at the demand price (Ask), and Sell is performed at the...
orders.png  35 kb
chart.png  20 kb