extern string sym1 = "" ;
extern string sym2 = "" ;
extern double lot = 1;
void OnTick()
{
double Profit = 0 ;
bool result = false;
if (OrderSend(sym1,OP_BUY,lot,MarketInfo(sym1,MODE_ASK),0,0,0,NULL,1,0,clrGreen));
else Print("OrderSent Eror Code : ",GetLastError());
if (OrderSend(sym2,OP_BUY,lot,MarketInfo(sym2,MODE_ASK),0,0,0,NULL,2,0,clrBlue));
else Print("OrderSent Eror Code : ",GetLastError());
for(int i=0 ;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS))
{
Profit =+ OrderProfit() ;
}
else Print("Order Eror");
}
Print ("Profit = ",Profit);
do
{
if(Profit>1)
{
for(int p=-1 ;p<=OrdersTotal();p++)
{
if(OrderSelect(p,SELECT_BY_POS,MODE_TRADES))
{
result = OrderClose(OrderTicket(),lot,OrderClosePrice(),0,clrNONE);
}
}
}else Print("Profit = ",Profit);
}while(Profit>1);
}