is this the only way to check if an order has been closed out by TP or SL?
if ( OrderCloseTime() != 0 )
if ( OrderCloseTime() != 0 )
How to find if any EA order has been closed by TP 57 replies
Order Comment blank after order closed 4 replies
datetime LastTradeStoppedOut()
{
int cnt, total;
datetime NextTime;
bool Stopped=false;
NextTime = 0;
total = HistoryTotal();
for (cnt = total - 1; cnt >= 0; cnt--)
{
OrderSelect (cnt, SELECT_BY_POS, MODE_HISTORY);
if(OrderSymbol()==Symbol() && OrderMagicNumber() == MagicNumber)
{
Stopped = false;
if (OrderType() == OP_BUY)
{
if (OrderClosePrice() - OrderOpenPrice() < 0)
{
Stopped = true;
}
cnt = 0;
}
if (OrderType() == OP_SELL)
{
if (OrderOpenPrice() - OrderClosePrice() < 0)
{
Stopped = true;
}
cnt = 0;
}
}
}
if (Stopped)
{
StopTime = OrderCloseTime() + MinutesToDelay*60;
}
return (Stopped);
}