extern double Lot=0.1;
extern int Magic=12356;
int start()
{ int total=OrdersTotal();
if(total==0)
{
OrderSend(Symbol(),OP_SELLSTOP,Lot,Bid-Point*10,3,0,0,"EA",Magic,0,Red);
Sleep(1000);
OrderSend(Symbol(),OP_BUYSTOP,Lot,Ask+Point*10,3,0 ,0 ,"EA",Magic,0,Green);
}
if(total==2)
{ int buy ,sell;
for(int i=0;i<total;i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderType()==OP_BUY)
{ buy=buy+1;
}
if(OrderType()==OP_SELL)
{
sell=sell+1;
}
}
if(buy==1 || sell==1)
{
for( i=0;i<total;i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderType()==OP_BUYSTOP)
{ OrderDelete( OrderTicket());
}
if(OrderType()==OP_SELLSTOP)
{
OrderDelete( OrderTicket());
}
}
}
}
return (0);
}