need help with my first EA

 

Hi

it's my first EA and i got stuck, im trying to create EA with bands that will buy or sell when ever the price is touching the bands.

when im back testing it i get error message "TestGenerator: unmatched data error (volume limit 206 at 2010.04.01 03:00 exceeded)"

or the second error msg is "TestGenerator: unmatched data error (low value 1.3499 at 2010.04.01 03:00 is not reached from the least timeframe, low price 1.3522 mismatches)"

please help me

#property link      ""
#include <stderror.mqh>
#include <stdlib.mqh>
#define IDLE 0
#define SIGNAL_BUY   1
#define SIGNAL_SELL  2
#define SIGNAL_TRBUY 3
#define SIGNAL_TRSELL 4
#define SIGNAL_P 5
#define SIGNAL_L 6
bool trade=false;
int tickets=0;
int ticketb=0;
int Order = IDLE;
int Barw;
int barc;
double BOLH;
double BOLL;

extern int TP=120;    //take profit
extern int SL=60;      //stop loss
extern double lotSize=0.1;
extern double DEV=3.0;
extern int Per=12;
extern int Bar_wait=10;
extern int MagicNumber=7272;



//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
{
//----
   if (OrdersTotal()==0)   
   {trade=false;}

   if (OrdersTotal()!=0)
   {
       for (int i=1; i<=OrdersTotal(); i++)       //Cycle for all orders..
      {                                        //displayed in the terminal
       if(OrderSelect(i-1,SELECT_BY_POS)==true)//If there is the next one
        {                                     
          if (OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber)
          {
           trade=true;
           
               break;
            }
          else {trade=false;}
          }
        } 
     
   } 


//////////////////// INDICATORS\

BOLH=iCustom(NULL,0,"Bands",Per,0,DEV,MODE_UPPER,1);////the last zero its the shift   
BOLL= iCustom(NULL,0,"Bands",Per,0,DEV,MODE_LOWER,1);////the last zero its the shift 
Comment("bollh = " ,BOLH); // show us the price of the boll high


//////////////////CHECK FOR BUY

if (trade==false && Order==IDLE)
{

if (  Open[0]<=BOLL && Open[1]<BOLL )

{Order=SIGNAL_BUY;}
   // Alert("buy_signal");
      
}
//////////////////////////////


//////////////////CHECK FOR SELL

if (trade==false && Order==IDLE)
{

if (  Open[0]>=BOLH && Open[1]>=BOLH )

{Order=SIGNAL_SELL;}
    //  Alert("sell_signal");
      
}

/////////////////////////BUY
if (trade==false)
{
  if (Order == SIGNAL_BUY  )
  {

  ticketb=OrderSend(Symbol(),OP_BUY,lotSize,Ask,3,0, 0,"SHAUL",MagicNumber,Green);   //open
  OrderModify(ticketb,0,Ask-(SL*Point),Ask+(TP*Point),0,Green);

      if(OrderSelect( ticketb, SELECT_BY_TICKET )==true)
      {
       Alert("LONG ORDER OPENED IN SHAUL"," Symbol= ",Symbol()," Period=",Period(), " Ticket= ",ticketb);
      Order = SIGNAL_TRBUY;
      
       
        
      }
      else
      {
      Print("OrderSelect returned the error of ",GetLastError());
      Alert("EROR LONG ORDER IN SHAUL "," Symbol= ",Symbol()," Period=",Period()," EROR= ",GetLastError());
      Order= IDLE;
      }
   }
} 
/////////////////////////////////// END


/////////////////////////sell
if (trade==false)
{
  if (Order == SIGNAL_SELL  )
  {

  tickets=OrderSend(Symbol(),OP_SELL,lotSize,Bid,3,0, 0,"SHAUL",MagicNumber,Green);
  OrderModify(tickets,0,Ask+(SL*Point),Ask-(TP*Point),0,Green);

      if(OrderSelect( tickets, SELECT_BY_TICKET )==true)
      {
       Alert("SHORT ORDER OPENED IN SHAUL"," Symbol= ",Symbol()," Period=",Period(), " Ticket= ",ticketb);
      Order = SIGNAL_TRSELL;
      
        
      }
      else
      {
      Print("OrderSelect returned the error of ",GetLastError());
      Alert("EROR SHORT ORDER IN SHAUL "," Symbol= ",Symbol()," Period=",Period()," EROR= ",GetLastError());
      Order= IDLE;
      }
   }
} 
/////////////////////////////////// END





//----
   return(0);
  }
//+------------------------------------------------------------------+
 
Does it place any trades after that?
 
ubzen:
Does it place any trades after that?

no it repeats, like infinity loop
Reason: