int open_sell()
{
if (OrdersTotal()==0) OrderSend(Symbol(),1,0.01,Bid,30,Bid+300*Point,0,"",0,0,Yellow);
if (OrdersTotal()!=0)
for (i=0;i<OrdersTotal();i++)
{
OrderSelect(i,SELECT_BY_POS);
if (OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),Bid,30,Red);
Print(A0);Print(A1);Print(A2);
}
return;
}
int open_buy()
{
if (OrdersTotal()==0) OrderSend(Symbol(),0,0.01,Ask,30,Ask-300*Point,0,"",0,0,Blue);
if (OrdersTotal()!=0)
for (i=0;i<OrdersTotal();i++)
{
OrderSelect(i,SELECT_BY_POS);
if (OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),Ask,30,Green);
extern int MA1 = 3;
extern int MA2 = 21;
extern int i;
double I0,I1,II0,II1,A0,A1,A2;
int start()
{
I0=iMA(NULL,0,MA1,0,3,5,0);
I1=iMA(NULL,0,MA1,0,3,5,1);
II0=iMA(NULL,0,MA2,0,3,5,0);
II1=iMA(NULL,0,MA2,0,3,5,1);
A0=iADX(NULL,0,14,5,0,0);
A1=iADX(NULL,0,14,5,0,1);
A2=iADX(NULL,0,14,5,0,2);
if (I0<=II0 && I1>=II1 && A0>30 && A0>A1 && A1>A2) open_sell();
if (I0>=II0 && I1<=II1 && A0>30 && A0>A1 && A1>A2) open_buy();
return;
}
int open_sell()
{
if (OrdersTotal()==0) OrderSend(Symbol(),1,0.01,Bid,30,Bid+300*Point,0,"",0,0,Yellow);
if (OrdersTotal()!=0)
for (i=0;i<OrdersTotal();i++)
{
OrderSelect(i,SELECT_BY_POS);
if (OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),Bid,30,Red);
Print(A0);Print(A1);Print(A2);
}
return;
}
int open_buy()
{
if (OrdersTotal()==0) OrderSend(Symbol(),0,0.01,Ask,30,Ask-300*Point,0,"",0,0,Blue);
if (OrdersTotal()!=0)
for (i=0;i<OrdersTotal();i++)
{
OrderSelect(i,SELECT_BY_POS);
if (OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),Ask,30,Green);
}
return;
}