Unusual Trades Behavior in MT5 Chart

 

Half of the trades are executed without volume and closed without reaching the take profit or stop loss levels. The trade ticket is not displayed, but on the chart, they appear as a smooth line.

#include <Trade\Trade.mqh>
CTrade trade;

void OnTick()
{
    if (PositionsTotal() == 0)
    {
        double Ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
        double stopLoss = Ask - 100 * _Point;
        double takeProfit = Ask + 100 * _Point;
        
        trade.Buy(0.1, _Symbol, Ask, stopLoss, takeProfit);
       ;
    }
}
 
mansour afshar:

Half of the trades are executed without volume and closed without reaching the take profit or stop loss levels. The trade ticket is not displayed, but on the chart, they appear as a smooth line.

Please explain your problem is such way that a reader of your post is able to understand what you are facing.

Logs, screenshots, full code, things like that help to understand.

Is this MT5? Tester? Demo account?

What settings are used on tester?

I hope you get the point.
 
Dominik Egert #:
Please explain your problem is such way that a reader of your post is able to understand what you are facing.

Logs, screenshots, full code, things like that help to understand.

Is this MT5? Tester? Demo account?

What settings are used on tester?

I hope you get the point.
The images of the chart and the toolbox have been attached to the post. As you can see, between two profitable or losing trades, a trade without volume has been opened in the chart section, and it hasn't been recorded in the ticket section.
 
mansour afshar #:
The images of the chart and the toolbox have been attached to the post. As you can see, between two profitable or losing trades, a trade without volume has been opened in the chart section, and it hasn't been recorded in the ticket section.
I cannot see what you are trying to show..

Please add the logs as well. The relevant parts, especially.
Reason: