Постоянно Выдает ошибку?Помогите мне ее найти!
//+------------------------------------------------------------------+
//| 666.mq4 |
//| |
//+------------------------------------------------------------------+
#property copyright
extern double TakeProfit = 50;
extern double Lots = 0.01;
extern double Stoploss = 30;
extern double TrailingStop = 20;
//+------------------------------------------------------------------+
// |
//+------------------------------------------------------------------+
int start()
{
double a;
int b;
int total, ticket, cnt;
if(Bars<100)
{
Print("bars less than 100");
return(0);
}
if(TakeProfit<10)
{
Print("TakeProfit less than 10");
return(0);
}
total=OrdersTotal();
if(total<1)
{
// no opened orders identified
if(AccountFreeMargin()<(1000*Lots))
{
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
if(iMA(NULL,0, 5,0, MODE_EMA,PRICE_OPEN,0) > iMA(NULL,0, 34,0, MODE_EMA,PRICE_OPEN,0)> )
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-Stoploss*Point, Ask+TakeProfit*Point ,"comment",16384,0,Green);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ",GetLastError());
return(0);
}
if(iMA(NULL,0, 5,0, MODE_EMA,PRICE_OPEN,0) < iMA(NULL,0, 34,0, MODE_EMA,PRICE_OPEN,0)> )
{
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+Stoploss*Point,Bid-TakeProfit*Point,"macd sample",16384,0,Red);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
}
else Print("Error opening SELL order : ",GetLastError());
return(0);
}
return(0);
}
for(cnt=0;cnt
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL &&
OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY)
{
if(if(iStochastic(NULL,0,4,8,7,MODE_SMA,0,MODE_MAIN,0)>iStochastic(NULL,0, 4,8,7,MODE_SMA,0,MODE_SIGNAL,0)) )
{
OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet);
return(0);
}
if(TrailingStop>0)
{
if(Bid-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Bid-Point*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
return(0);
}
}
}
}
}
else
{
if(if(iStochastic(NULL,0,4,8,7,MODE_SMA,0,MODE_MAIN,0)<iStochastic(NULL,0, 4,8,7,MODE_SMA,0,MODE_SIGNAL,0)) )
}
OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet);
return(0); // exit
}
if(TrailingStop>0)
{
if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
}
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
return(0);
}
}
}
}
}
return(0);
{
//+------------------------------------------------------------------+
//| 666.mq4 |
//| |
//+------------------------------------------------------------------+
#property copyright
extern double TakeProfit = 50;
extern double Lots = 0.01;
extern double Stoploss = 30;
extern double TrailingStop = 20;
//+------------------------------------------------------------------+
// |
//+------------------------------------------------------------------+
int start()
{
double a;
int b;
int total, ticket, cnt;
if(Bars<100)
{
Print("bars less than 100");
return(0);
}
if(TakeProfit<10)
{
Print("TakeProfit less than 10");
return(0);
}
total=OrdersTotal();
if(total<1)
{
// no opened orders identified
if(AccountFreeMargin()<(1000*Lots))
{
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
if(iMA(NULL,0, 5,0, MODE_EMA,PRICE_OPEN,0) > iMA(NULL,0, 34,0, MODE_EMA,PRICE_OPEN,0)> )
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-Stoploss*Point, Ask+TakeProfit*Point ,"comment",16384,0,Green);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ",GetLastError());
return(0);
}
if(iMA(NULL,0, 5,0, MODE_EMA,PRICE_OPEN,0) < iMA(NULL,0, 34,0, MODE_EMA,PRICE_OPEN,0)> )
{
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+Stoploss*Point,Bid-TakeProfit*Point,"macd sample",16384,0,Red);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
}
else Print("Error opening SELL order : ",GetLastError());
return(0);
}
return(0);
}
for(cnt=0;cnt
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL &&
OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY)
{
if(if(iStochastic(NULL,0,4,8,7,MODE_SMA,0,MODE_MAIN,0)>iStochastic(NULL,0, 4,8,7,MODE_SMA,0,MODE_SIGNAL,0)) )
{
OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet);
return(0);
}
if(TrailingStop>0)
{
if(Bid-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Bid-Point*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
return(0);
}
}
}
}
}
else
{
if(if(iStochastic(NULL,0,4,8,7,MODE_SMA,0,MODE_MAIN,0)<iStochastic(NULL,0, 4,8,7,MODE_SMA,0,MODE_SIGNAL,0)) )
}
OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet);
return(0); // exit
}
if(TrailingStop>0)
{
if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
}
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
return(0);
}
}
}
}
}
return(0);
{