Wednesday, 26 December 2012

SuperTrend 2

int trade() 
{
double trend4 = iCustom(NULL,0,"SuperTrend",5,1.5,1,3); //achat -> vente
double trend1 = iCustom(NULL,0,"SuperTrend",5,1.5,0,2); //achat -> vente


double trend3 = iCustom(NULL,0,"SuperTrend",5,1.5,1,2); //vente -> achat
double trend2 = iCustom(NULL,0,"SuperTrend",5,1.5,0,3); //vente -> achat

int total = OrdersTotal();
double ordre1;
double ordre2;


if(trend2 < 5 && trend3 < 5 && total == 0)//vente
{
ordre1 = OrderSend(Symbol(),OP_SELL,0.08,Bid,3,Bid+(5000*Point),Bid-(5000*Point),"EA de Greg3395",1,0,Red);
}

  if(trend2 > 5 && trend3 > 5 && total == 1) //achat
{
   if(OrderSelect(ordre1, SELECT_BY_TICKET))
  {
   if(OrderType()==OP_SELL)
   {
   OrderClose(OrderTicket(), 0.08, Bid, 3, CLR_NONE);
   }  
  } 



if(trend1 < 5 && trend4 < 5 && total == 0) //achat
{
ordre2 = OrderSend(Symbol(),OP_BUY,0.08,Ask,3,Ask-(5000*Point),Ask+(5000*Point),"EA de Greg3395",2,0,Blue);



if(trend1 > 5 && trend4 > 5 && total == 1) //achat
{
   if(OrderSelect(ordre2, SELECT_BY_TICKET))
  {
    if(OrderType()==OP_BUY)
    {
    OrderClose(OrderTicket(), 0.08, Ask, 3, CLR_NONE);
    }
  }
}

return(0);
}

No comments:

Post a Comment