moze ktoś mi to sprawdzi nalepiej bedzie, niemoge znaleść przyczyny tych błedów
Kod: Zaznacz cały
int sl=34;
double lots=0.1;
int buyx, sellx;
int poz1long, poz2long, poz3long, poz1short, poz2short, poz3short;
int init()
  {
return(0);
  }
int deinit(){ return(0);}
int start()
{
BE_long_poz1();
BE_long_poz2();
BE_long_poz3();
   
BE_short_poz1();
BE_short_poz2();
BE_short_poz3();
double ma =iMA(NULL, 0, 169, 0, MODE_EMA, PRICE_CLOSE, 0);
   if(total(OP_BUY)==0 && Ask>ma && buyx==0)
   {
   int poz1long = OrderSend(Symbol(),OP_BUY,lots,Ask,3,Bid-sl*Point,Bid+34*Point);
   int poz2long = OrderSend(Symbol(),OP_BUY,lots,Ask,3,Bid-sl*Point,Bid+55*Point);   
   int poz3long = OrderSend(Symbol(),OP_BUY,lots,Ask,3,Bid-sl*Point,Bid+89*Point); 
   buyx=1;
   sellx=0;
   }
   if(total(OP_SELL)==0 && Bid<ma && sellx==0)
   {
   int poz1short = OrderSend(Symbol(),OP_SELL,lots,Bid,3,Ask+sl*Point,Ask-34*Point);
   int poz2short = OrderSend(Symbol(),OP_SELL,lots,Bid,3,Ask+sl*Point,Ask-55*Point);   
   int poz3short = OrderSend(Symbol(),OP_SELL,lots,Bid,3,Ask+sl*Point,Ask-89*Point);   
   
   buyx=0;
   sellx=1;
   }
 
return(0);
}
int MagicNumber, cmd;
int total(int cmd)
{
   int sum = 0;
   RefreshRates();
   for (int i=0;i<=OrdersTotal();i++)
   {
      OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if (Symbol()==OrderSymbol() && cmd==OrderType() && MagicNumber==OrderMagicNumber()) sum++;
   }
   return(sum);
}
void BE_long_poz1()
{
   double ma =iMA(NULL, 0, 169, 0, MODE_EMA, PRICE_CLOSE, 0);
   if (buyx==1)
   {
   OrderSelect(poz1long,SELECT_BY_TICKET,MODE_TRADES);
   OrderModify(poz1long,OrderOpenPrice(),ma-34*Point,ma+34*Point,OrderExpiration(),CLR_NONE);
   }
}
void BE_long_poz2()
{
   double ma =iMA(NULL, 0, 169, 0, MODE_EMA, PRICE_CLOSE, 0);
   if (Bid<ma+34*Point)
   {
   OrderSelect(poz2long,SELECT_BY_TICKET,MODE_TRADES);
   OrderModify(poz2long,OrderOpenPrice(),ma-34*Point,ma+34*Point,OrderExpiration(),CLR_NONE);
   }
   if (Bid>ma+34*Point)
   {
   OrderSelect(poz2long,SELECT_BY_TICKET,MODE_TRADES);
   OrderModify(poz2long,OrderOpenPrice(),ma+1*Point,ma+55*Point,OrderExpiration(),CLR_NONE);
  
   }
}
void BE_long_poz3()
{
   double ma =iMA(NULL, 0, 169, 0, MODE_EMA, PRICE_CLOSE, 0);
   
   
   if (Bid<ma+34*Point)
   {
   OrderSelect(poz3long,SELECT_BY_TICKET);
   OrderModify(poz3long,OrderOpenPrice(),ma-34*Point,ma+34*Point,OrderExpiration(),CLR_NONE);
   }
   if (Bid>ma+34*Point)
   {
   OrderSelect(poz3long,SELECT_BY_TICKET);
   OrderModify(poz3long,OrderOpenPrice(),ma+1*Point,ma+55*Point,OrderExpiration(),CLR_NONE);
   }
   if (Bid>ma+55*Point)
   {
   OrderSelect(poz3long,SELECT_BY_TICKET);
   OrderModify(poz3long,OrderOpenPrice(),ma+34*Point,ma+89*Point,OrderExpiration(),CLR_NONE);
   }
}
void BE_short_poz1()
{
   double ma =iMA(NULL, 0, 169, 0, MODE_EMA, PRICE_CLOSE, 0);
   if (sellx==1)
   {
   OrderSelect(poz1short,SELECT_BY_TICKET);
   OrderModify(poz1short,OrderOpenPrice(),ma+34*Point,ma-34*Point,OrderExpiration(),CLR_NONE);
   }
}
void BE_short_poz2()
{
   double ma =iMA(NULL, 0, 169, 0, MODE_EMA, PRICE_CLOSE, 0);
   if (Bid<ma-34*Point)
   {
   OrderSelect(poz2short,SELECT_BY_TICKET);
   OrderModify(poz2short,OrderOpenPrice(),ma+34*Point,ma-34*Point,OrderExpiration(),CLR_NONE);
   }
   if (Bid>=ma-34*Point)
   {
   OrderSelect(poz2short,SELECT_BY_TICKET);
   OrderModify(poz2short,OrderOpenPrice(),ma-1*Point,ma-55*Point,OrderExpiration(),CLR_NONE);
   }
}
void BE_short_poz3()
{
   double ma =iMA(NULL, 0, 169, 0, MODE_EMA, PRICE_CLOSE, 0);
   
   
   if (Bid<ma-34*Point)
   {
   OrderSelect(poz3short,SELECT_BY_TICKET);
   OrderModify(poz3short,OrderOpenPrice(),ma+34*Point,ma-34*Point,OrderExpiration(),CLR_NONE);
   }
   if (Bid<ma-34*Point)
   {
   OrderSelect(poz3short,SELECT_BY_TICKET);
   OrderModify(poz3short,OrderOpenPrice(),ma-1*Point,ma-55*Point,OrderExpiration(),CLR_NONE);
   }
   if (Bid<ma-55*Point)
   {
   OrderSelect(poz3short,SELECT_BY_TICKET);
   OrderModify(poz3short,OrderOpenPrice(),ma-34*Point,ma-89*Point,OrderExpiration(),CLR_NONE);
   }
}