Forum

CPositionInfo pos.Type() always return 0 (POSITION_TYPE_BUY)

I have strange issue. I have this code: #include <Trade\Trade.mqh> CTrade trade; CPositionInfo pos; COrderInfo ord; trade.Sell(0.01, _Symbol, 0, 0, 0, "Test SELL"); // I open sell somewhere in my code, then call myFunct() below to read that void myFunct() { for ( int i = PositionsTotal

How to read yesterday orders by list of tickets and see if order closed by SL or TP

I am trying to code EA/Script, so when I start MT5 it use a list of yesterdays tickets of orders I created. and check each order by ticket to see if order still open or if closed by SL or TP. But no matter what I try I can't find if order closed by TP/SL. This data I can't find in order details