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 6bool trade=false;
int tickets=0;
int ticketb=0;
int Order = IDLE;
int Barw;
int barc;
double BOLH;
double BOLL;
externint TP=120; //take profitexternint SL=60; //stop lossexterndouble lotSize=0.1;
externdouble DEV=3.0;
externint Per=12;
externint Bar_wait=10;
externint 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 terminalif(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 BUYif (trade==false && Order==IDLE)
{
if ( Open[0]<=BOLL && Open[1]<BOLL )
{Order=SIGNAL_BUY;}
// Alert("buy_signal");
}
////////////////////////////////////////////////CHECK FOR SELLif (trade==false && Order==IDLE)
{
if ( Open[0]>=BOLH && Open[1]>=BOLH )
{Order=SIGNAL_SELL;}
// Alert("sell_signal");
}
/////////////////////////BUYif (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/////////////////////////sellif (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);
}
//+------------------------------------------------------------------+
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
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