int buy()
{
int sum=0;
for(int i=0; i<OrdersHistoryTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
{
if(OrderSymbol()==Symbol() &&OrderType()==0 )
{
sum=iBarShift(NULL,PERIOD_M5,OrderCloseTime(),false);
}
}
}
return(sum);
}
int sell()
{
int sum=0;
for(int i=0; i<OrdersHistoryTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
{
if(OrderSymbol()==Symbol() &&OrderType()==1 )
{
sum=iBarShift(NULL,PERIOD_M5,OrderCloseTime(),false);
}
}
}
return(sum);
}