EA working in Demo but on real not working!

To add comments, please log in or register
eky_slade
9
eky_slade  

hello,

i have this EA and is not working in real acount, order are not open on real. i have the same broker.

this is the code:

//+------------------------------------------------------------------+

//|                                                        |

//|                   

//|                                                        |

//+------------------------------------------------------------------+

#property copyright "ICS"

#property link      "www.punctepuncte.non"

#property version   "1.00"

#property strict


extern int TakeProfit = 1000;

extern int StopLoss   = 1100;


extern double lot1   =  0.07;

extern double lot2   =  0.14;

extern double lot3   =  0.21;

extern double lot4   =  0.28;

extern double lot5   =  0.35;

extern double lot6   =  0.42;

extern double lot7   =  0.49;

extern double lot8   =  0.56;

extern double lot9   =  0.63;

extern double lot10  =  0.70;

extern double lot11  =  0.77;

extern double lot12  =  0.84;

extern double lot13  =  0.91;

extern double lot14  =  0.98;

extern double lot15  =  1.05;


int MagicN=000001;

//+------------------------------------------------------------------+

//| Expert initialization function                                   |

//+------------------------------------------------------------------+

int OnInit()

  {

//---


//---

   return(INIT_SUCCEEDED);

  }

//+------------------------------------------------------------------+

//| Expert deinitialization function                                 |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

  {

//---


  }

//+------------------------------------------------------------------+

//| Expert tick function                                             |

//+------------------------------------------------------------------+

void OnTick()

  {

//---

   int total=OrdersTotal();

   int i;

   double OpenLongOrders=0,OpenShortOrders=0,PendLongs=0,PendShorts=0;

//---

   if(total==0 && OpenLongOrders==0 && OpenShortOrders==0 && PendLongs==0 && PendShorts==0)

     {

      openbuy();

      sellstop();

     }

//---

   for(i=0;i<total;i++)

     {

      OrderSelect(i,SELECT_BY_POS,MODE_TRADES);

      if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicN)

        {

         int type=OrderType();


         if(type == OP_BUY )       {OpenLongOrders=OpenLongOrders+1;}

         if(type == OP_SELL )      {OpenShortOrders=OpenShortOrders+1;}

         if(type == OP_BUYSTOP )   {PendLongs=PendLongs+1;}

         if(type == OP_SELLSTOP )  {PendShorts=PendShorts+1;}


         if(total==2 && OpenLongOrders==1 && OpenShortOrders==1 && PendLongs==0 && PendShorts==0)

           {

            buystop();

           }

         if(total==3 && OpenLongOrders==2 && OpenShortOrders==1 && PendLongs==0 && PendShorts==0)

           {

            sellstop1();

           }

         if(total==4 && OpenLongOrders==2 && OpenShortOrders==2 && PendLongs==0 && PendShorts==0)

           {

            buystop1();

           }


         if(total==5 && OpenLongOrders==3 && OpenShortOrders==2 && PendLongs==0 && PendShorts==0)

           {

            sellstop2();

           }

         if(total==6 && OpenLongOrders==3 && OpenShortOrders==3 && PendLongs==0 && PendShorts==0)

           {

            buystop2();

           }

         if(total==7 && OpenLongOrders==4 && OpenShortOrders==3 && PendLongs==0 && PendShorts==0)

           {

            sellstop3();

           }

         if(total==8 && OpenLongOrders==4 && OpenShortOrders==4 && PendLongs==0 && PendShorts==0)

           {

            buystop3();

           }

         if(total==9 && OpenLongOrders==5 && OpenShortOrders==4 && PendLongs==0 && PendShorts==0)

           {

            sellstop4();

           }

         if(total==10 && OpenLongOrders==5 && OpenShortOrders==5 && PendLongs==0 && PendShorts==0)

           {

            buystop4();

           }

         if(total==11 && OpenLongOrders==6 && OpenShortOrders==5 && PendLongs==0 && PendShorts==0)

           {

            sellstop5();

           }

         if(total==12 && OpenLongOrders==6 && OpenShortOrders==6 && PendLongs==0 && PendShorts==0)

           {

            buystop5(); 

           }

         if(total==13 && OpenLongOrders==7 && OpenShortOrders==7 && PendLongs==0 && PendShorts==0)

           {

            sellstop6(); 

           }  

         if(total==14 && OpenLongOrders==8 && OpenShortOrders==7 && PendLongs==0 && PendShorts==0)

           {

            buystop6(); 

           }

         if(total==1 && OpenLongOrders==0 && OpenShortOrders==0 && (PendLongs==1 || PendShorts==1))

           {

            deleteallpendingorders();

           }


         Sleep(3600);

        }

     }

  }

//+------------------------------------------------------------------+

//| openbuy                                                          |

//+------------------------------------------------------------------+

void openbuy()

  {

   OrderSend(Symbol(),OP_BUY,lot1,Ask,5,Ask-StopLoss*Point,Ask+TakeProfit*Point,NULL,MagicN,0,clrBlue);

  }

//+------------------------------------------------------------------+

//| sellstop                                                         |

//+------------------------------------------------------------------+

void sellstop()

  {

  OrderSend(Symbol(),OP_SELLSTOP,lot2,Bid-100*Point,5,(Bid-100*Point)+StopLoss*Point,(Bid-100*Point)-TakeProfit*Point,NULL,MagicN,0,clrBlue);

  }

//+------------------------------------------------------------------+

//| buystop                                                          |

//+------------------------------------------------------------------+

void buystop()

  {

   OrderSend(Symbol(),OP_BUYSTOP,lot3,Ask+100*Point,5,(Ask+100*Point)-StopLoss*Point,(Ask+100*Point)+TakeProfit*Point,NULL,MagicN,0,clrBlue);

  }

//+------------------------------------------------------------------+

//| sellstop1                                                        |

//+------------------------------------------------------------------+

void sellstop1()

  {

  OrderSend(Symbol(),OP_SELLSTOP,lot4,Bid-100*Point,5,(Bid-100*Point)+StopLoss*Point,(Bid-100*Point)-TakeProfit*Point,NULL,MagicN,0,clrBlue);

  }

//+------------------------------------------------------------------+

//| buystop1                                                         |

//+------------------------------------------------------------------+

void buystop1()

  {

   OrderSend(Symbol(),OP_BUYSTOP,lot5,Ask+100*Point,5,(Ask+100*Point)-StopLoss*Point,(Ask+100*Point)+TakeProfit*Point,NULL,MagicN,0,clrBlue);

  }

//+------------------------------------------------------------------+

//| sellstop2                                                        |

//+------------------------------------------------------------------+

void sellstop2()

  {

   OrderSend(Symbol(),OP_SELLSTOP,lot6,Bid-100*Point,5,(Bid-100*Point)+StopLoss*Point,(Bid-100*Point)-TakeProfit*Point,NULL,MagicN,0,clrBlue);

  }

//+------------------------------------------------------------------+

//| buystop2                                                         |

//+------------------------------------------------------------------+

void buystop2()

  {

   OrderSend(Symbol(),OP_BUYSTOP,lot7,Ask+100*Point,5,(Ask+100*Point)-StopLoss*Point,(Ask+100*Point)+TakeProfit*Point,NULL,MagicN,0,clrBlue);

  }

//+------------------------------------------------------------------+

//| sellstop3                                                        |

//+------------------------------------------------------------------+

void sellstop3()

  {

   OrderSend(Symbol(),OP_SELLSTOP,lot8,Bid-100*Point,5,(Bid-100*Point)+StopLoss*Point,(Bid-100*Point)-TakeProfit*Point,NULL,MagicN,0,clrBlue);

  }

//+------------------------------------------------------------------+

//| buystop3                                                         |

//+------------------------------------------------------------------+

void buystop3()

  {

   OrderSend(Symbol(),OP_BUYSTOP,lot9,Ask+100*Point,5,(Ask+100*Point)-StopLoss*Point,(Ask+100*Point)+TakeProfit*Point,NULL,MagicN,0,clrBlue);

  }

//+------------------------------------------------------------------+

//| sellstop4                                                        |

//+------------------------------------------------------------------+

void sellstop4()

  {

   OrderSend(Symbol(),OP_SELLSTOP,lot10,Bid-100*Point,5,(Bid-100*Point)+StopLoss*Point,(Bid-100*Point)-TakeProfit*Point,NULL,MagicN,0,clrBlue);

  }

//+------------------------------------------------------------------+

//| buystop4                                                         |

//+------------------------------------------------------------------+

void buystop4()

  {

   OrderSend(Symbol(),OP_BUYSTOP,lot11,Ask+100*Point,5,(Ask+100*Point)-StopLoss*Point,(Ask+100*Point)+TakeProfit*Point,NULL,MagicN,0,clrBlue);

  }

//+------------------------------------------------------------------+

//| sellstop5                                                        |

//+------------------------------------------------------------------+

void sellstop5()

  {

   OrderSend(Symbol(),OP_SELLSTOP,lot12,Bid-100*Point,5,(Bid-100*Point)+StopLoss*Point,(Bid-100*Point)-TakeProfit*Point,NULL,MagicN,0,clrBlue);

  }

//+------------------------------------------------------------------+

//| buystop4                                                         |

//+------------------------------------------------------------------+

void buystop5()

  {

   OrderSend(Symbol(),OP_BUYSTOP,lot13,Ask+100*Point,5,(Ask+100*Point)-StopLoss*Point,(Ask+100*Point)+TakeProfit*Point,NULL,MagicN,0,clrBlue);

  }

//+------------------------------------------------------------------+

//| sellstop6                                                       |

//+------------------------------------------------------------------+

void sellstop6()

  {

   OrderSend(Symbol(),OP_SELLSTOP,lot14,Bid-100*Point,5,(Bid-100*Point)+StopLoss*Point,(Bid-100*Point)-TakeProfit*Point,NULL,MagicN,0,clrBlue);

  }

//+------------------------------------------------------------------+

//| buystop6                                                         |

//+------------------------------------------------------------------+

void buystop6()

  {

   OrderSend(Symbol(),OP_BUYSTOP,lot15,Ask+100*Point,5,(Ask+100*Point)-StopLoss*Point,(Ask+100*Point)+TakeProfit*Point,NULL,MagicN,0,clrBlue);

  }

//+------------------------------------------------------------------+

//| deleteallpendingorders                                           |

//+------------------------------------------------------------------+

void deleteallpendingorders()

{

   for(int i=0;i<OrdersTotal();i++)

   {

     OrderSelect(i,SELECT_BY_POS,MODE_TRADES);

     if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicN && ((OrderType()==OP_BUY) || (OrderType()==OP_SELL) ||(OrderType()==OP_BUYSTOP) || (OrderType()==OP_SELLSTOP) || (OrderType()==OP_BUYLIMIT) || (OrderType()==OP_SELLLIMIT)))

     {

       OrderDelete(OrderTicket());

     }   

   }

}


eky_slade
9
eky_slade  
Can anywone help me, pls ... i'm not a programator...
To add comments, please log in or register