дикы expert

 
Уфф...!

Читал- Читал и dick expert сделал, вроде как ученик колдунов из повести Стругатксого
А почему, прокляты ,ордера не хочеть открывать.....??????????
Кто то не подскажет ? Please!
---------------------------------------------
KOD:
---------------------------------------
//+------------------------------------------------------------------+
//| wild expert.mq4 |
//| Copyright © 2006, MetaQuotes Software Corp. |
//| https://www.metaquotes.net/ |
//+------------------------------------------------------------------+



extern double Lots = 0.1;
extern double StopLoss = 50;
extern double TakeProfit = 50;
extern double TrailingStop = 16;
extern double cnt=0, Slippage=3;


//+------------------------------------------------------------------+
//
//+------------------------------------------------------------------+
int start()
{

int cnt=0, ticket, total;


// TakeProfit, TrailingStop)

if(Bars<100)
{
Print("bars less than 100");
return(0);
}
if(TakeProfit<10)
{
Print("TakeProfit less than 10");
return(0); // TakeProfit
}


//================= Inicializacia =============================


double A1=iAlligator(NULL,0,13,8,8,5,5,3,MODE_EMA,PRICE_OPEN,MODE_GATORLIPS,0);//ustni
double A2=iAlligator(NULL,0,13,8,8,5,5,3,MODE_EMA,PRICE_OPEN,MODE_GATORTEETH,1);//zubi
double A3=iAlligator(NULL,0,13,8,8,5,5,3,MODE_EMA,PRICE_OPEN,MODE_GATORJAW,1);//4elust

double A4=iAlligator(NULL,0,13,8,8,5,5,3,MODE_EMA,PRICE_OPEN,MODE_GATORLIPS,3);//ustni
double A5=iAlligator(NULL,0,13,8,8,5,5,3,MODE_EMA,PRICE_OPEN,MODE_GATORTEETH,3);//zubi
double A6=iAlligator(NULL,0,13,8,8,5,5,3,MODE_EMA,PRICE_OPEN,MODE_GATORJAW,3);//4elust


double MAF1=iMA(NULL,0,3,0,MODE_LWMA,PRICE_OPEN,0);
double MAF2=iMA(NULL,0,3,0,MODE_LWMA,PRICE_OPEN,1);
double MAF3=iMA(NULL,0,3,0,MODE_LWMA,PRICE_OPEN,2);

double MAS1=iMA(NULL,0,6,0,MODE_LWMA,PRICE_OPEN,0);
double MAS2=iMA(NULL,0,6,0,MODE_LWMA,PRICE_OPEN,1);
double MAS3=iMA(NULL,0,6,0,MODE_LWMA,PRICE_OPEN,2);




//--------------------------------------------------
total=OrdersTotal();
if(total<1)
{
//
if(AccountFreeMargin()<(1000*Lots))
{
Print(" . Free Margin = ", AccountFreeMargin());
return(0);


// (BUY)


if ( (A1-A3)>(0.2*Point) && (A1-A2)>(0.1*Point) && (A2-A3)>(0. 1*Point)
&& (MAS3-MAF3)>(0.2*Point))
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point
,Ask+TakeProfit*Point,"macd sample",16384,0,Red);
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);
}
// (SELL)
if(AccountFreeMargin() < 1000) return(0); // няма пари - излизаме
if ( (A1-A3)<(0.2*Point) && (A1-A2)<(0.1*Point)
&& (A2-A3)<(0.1*Point) &&(MAF3-MAS3)>(0.2*Point))
{
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,
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<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL && // ? OP_BUY or OP_SELL
OrderSymbol()==Symbol()) // ?
{
if(OrderType()==OP_BUY) // OP_BUY
{
// Close?

if ( (A1-A3)<(0.2*Point) && (A1-A2)<(0.1*Point)
&& (A2-A3)<(0.1*Point) &&(MAF3-MAS3)>(0.2*Point))
{
OrderClose(OrderTicket(),OrderLots(),Bid,3,Red);
return(0); // exit
}
// TrailingStop ?

if(TrailingStop>0)
{
if(Bid-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Bid-Point*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,
OrderTakeProfit(),0,Red);
return(0);
}
}
}
}
else // or this is a OP_SELL
{
// me be to Close?

if ( (A1-A3)>(0.2*Point) &&(A1-A2)>(0.1*Point)
&& (A2-A3)>(0.1*Point) && (MAS3-MAF3)>(0.2*Point))
{
OrderClose(OrderTicket(),OrderLots(),Ask,3,Green); // затваряме позицията
return(0); // exit
}
// TrailingStop?

if(TrailingStop>0)
{
if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
{
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,
OrderTakeProfit(),0,Green);
return(0);
}
}
}
}
}
}
return(0);
}
// end
 
А можеть быть не разрешен Live Trading? Опция такая есть. Можеш проверить и в коде:

https://www.mql4.com/ru/docs/grp_common/istradeallowed/
 
Itso:
А можеть быть не разрешен Live Trading? Опция такая есть. Можеш проверить и в коде:

https://www.mql4.com/ru/docs/grp_common/istradeallowed/
Причина обращения: