//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
int start()
{
double buy = iCustom(NULL,0,IndName,ChannelPeriod,0,Shift);
double sell = iCustom(NULL,0,IndName,ChannelPeriod,1,Shift);
// Comment("\n ask_long: ",ask_long,
// "\n bid_short: ",bid_short,
// "\n---------------",
// "\n nextAbove: ",nextAbove,
// "\n nextAbove2: ",nextAbove2,
// "\n nextBelow: ",nextBelow,
// "\n nextBelow2: ",nextBelow2);
if(((!IsOptimization()) && !IsTesting() && (!IsVisualMode())) || (ShowTableOnTesting && IsTesting() && (!IsOptimization())))
{
info();
}
//+------------------------------------------------------------------+
//| Открытие первого ордера серии покупок |
//+------------------------------------------------------------------+
if(count_long()==0)
{
bid_long = Bid;
ask_long = Ask;
if(buy > 0)
{
Print("Открытие первого ордера серии покупок");
int ticket_long = OrderSend(Symbol(),OP_BUY,Lots_long,ask_long,Slippage,0,0,"No loss",Magic_long,0,Lime);
modify_flag_long = TRUE;
if(ticket_long<=0)
{
Print("Ошибка открытия покупок: ", GetLastError());
}
}
}
//+------------------------------------------------------------------+
//| Открытие первого ордера серии продаж |
//+------------------------------------------------------------------+
if(count_short()==0)
{
bid_short = Bid;
ask_short = Ask;
if(sell > 0)
{
Print("Открытие первого ордера серии продаж");
int ticket_short = OrderSend(Symbol(),OP_SELL,Lots_short,bid_short,Slippage,0,0,"No loss",Magic_short,0,Red);
modify_flag_short = TRUE;
if(ticket_short<=0)
{
Print("Ошибка открытия продаж: ", GetLastError());
}
}
}
vadimltd