Errores, fallos, preguntas - página 2381

 

¡Error de precio normal! Buenas tardes a todos. He modificado c mql4 a mql5 y ahora me da error NormalPrice. Por favor, ayúdenme a entender la razón.

#include <Trade\PositionInfo.mqh>
#include <Trade\Trade.mqh>
#include <Trade\SymbolInfo.mqh>
#include <Trade\OrderInfo.mqh>

CPositionInfo  o_position;    //класс для управления открытыми позициями
CTrade         o_trade;     
CSymbolInfo    o_symbol;
COrderInfo     o_order;
//+------------------------------------------------------------------+
//| Переменные вводимые при запуске параметры                        |
//+------------------------------------------------------------------+
input double  StartLot    = 0.1;
input int     Indent      = 30;
input int     Step        = 10;
input double  ProfitClose = 20;
input int     MagicNumber = 12345;
input int     Slippage    = 30;
//+------------------------------------------------------------------+
//| Изменяемые параметры в программе                                 |
//+------------------------------------------------------------------+
int dStep;
int dIndent;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
{
   dStep = Step;
   dIndent = Indent;
   
   if (!o_symbol.Name(Symbol()))
      return(INIT_FAILED);
   
   RefreshRates();
   
   o_trade.SetExpertMagicNumber(MagicNumber);
   //Проверка режимов открытия ордеров через функцию
   if (IsFillingTypeAllowed (o_symbol.Name(), SYMBOL_FILLING_FOK))
   {
      o_trade.SetTypeFilling(ORDER_FILLING_FOK);
   }
   else if (IsFillingTypeAllowed (o_symbol.Name(), SYMBOL_FILLING_IOC))
   {
      o_trade.SetTypeFilling(ORDER_FILLING_IOC);
   }
   else 
   {
      o_trade.SetTypeFilling(ORDER_FILLING_RETURN);
   }

   o_trade.SetDeviationInPoints(Slippage);
   
   if (o_symbol.Digits() == 3 || o_symbol.Digits() == 5)
   {
      dStep    *= 10;
      dIndent  *= 10;
   }

   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
}
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{
   datetime             lpos_time         = 0;
   double               lpos_price_open   = 0.0;
   double               lpos_volume       = 0.0;
   ENUM_POSITION_TYPE   lpos_type         = -1;
   int                  pos_count         = 0;
   double               sum_profit        = 0;
   //счечик открытых позиций
   for (int i = PositionsTotal() - 1; i>=0; i--)
   {
      if (o_position.SelectByIndex(i))
      {
         if (o_position.Symbol() == o_symbol.Name() && o_position.Magic() == MagicNumber)
         {
            if (o_position.Time() > lpos_time)//если время позиции больше чем время последней позиции
            {
               lpos_time         = o_position.Time();
               lpos_price_open   = o_position.PriceOpen();
               lpos_volume       = o_position.Volume();
               lpos_type         = o_position.PositionType();
            }
            pos_count++;
            sum_profit = sum_profit + o_position.Commission() + o_position.Swap() + o_position.Profit();
         }
      }
   
   }
   //счетчик количества отложенных ордеров
   int stop_count = 0;
   for (int i = OrdersTotal()-1; i>=0; i--) //OrderTotal считает только отложенные ордера
   {
      if (o_order.SelectByIndex(i))
      {
         if (o_order.Symbol() == o_symbol.Name() && o_order.Magic() == MagicNumber)
         stop_count++;
      }
   
   }
//Функция проверки котировок
   if (!RefreshRates())
      return;
   //
   if (sum_profit > ProfitClose)
   {
      CloseAll();
      return;
   }
   //
   if (pos_count>0)
   {
      if (lpos_type == POSITION_TYPE_BUY && o_symbol.Bid() < lpos_price_open - dStep * o_symbol.Point())
      {
         o_trade.Sell(lpos_volume * 2, o_symbol.Name());
      }   
      if (lpos_type == POSITION_TYPE_SELL && o_symbol.Ask() < lpos_price_open + dStep * o_symbol.Point())
      {
         o_trade.Buy(lpos_volume * 2, o_symbol.Name());
      }   
      o_trade.SellStop(StartLot, o_symbol.Bid() - dIndent * o_symbol.Point());
      o_trade.BuyStop(StartLot, o_symbol.Ask() + dIndent * o_symbol.Point());
      return;
   }
   if (pos_count > 0 && stop_count > 0)
      DeleteStopOrders(); 
}
//Функция проверки котировок
bool RefreshRates()
{
   if (!o_symbol.RefreshRates())
      return (false);
   if (o_symbol.Ask() == 0 || o_symbol.Bid() == 0)
      return (false);
   return(true);
}   

//+------------------------------------------------------------------+
bool IsFillingTypeAllowed (string symbol, int fill_type)
{
   int filling = (int) SymbolInfoInteger(symbol, SYMBOL_FILLING_MODE);//запрашиваем режим открытия
   return(filling && fill_type);
}   
//+------------------------------------------------------------------+
void  CloseAll()
{
   for (int index = PositionsTotal()-1; index >=0; index--)
   {
      if (o_position.SelectByIndex(index))
      {
         if (o_position.Symbol() == o_symbol.Name() && o_position.Magic() == MagicNumber)
         {
            o_trade.PositionClose(o_position.Ticket());
         }
      }
   }
}
//+Функция удаления стоп ордеров
void  DeleteStopOrders()
{
   for (int i = OrdersTotal()-1; i>-0; i--)
   {
      if (o_order.SelectByIndex(i))
         if (o_order.Symbol() == o_symbol.Name() && o_order.Magic() == MagicNumber)
            o_trade.OrderDelete(o_order.Ticket());
   }
}

 
La pregunta puede ser off-topic, pero no veo el sentido de crear una. Lo preguntaré aquí.
¿De qué depende la fiabilidad de la señal?
 
Evgeniy Kazeikin:
La pregunta puede ser off-topic, pero no veo el sentido de crear una. Lo preguntaré aquí.
¿En qué se basa la fiabilidad de la señal?
Hay cinco o seis componentes, calculados mediante una fórmula compleja, y luego se dibuja una escala con el color adecuado
 
Slava:

Además de los errores anteriores en el probador (estoy probando un EA multidivisa), el probador no quiere mostrar otros símbolos, y el registro contiene numerosos errores de no sincronización, también bajo el número 4001.

De nuevo, en la compilación de 1981, todo funcionaba sin errores. En 1983 es un problema.

Función de comprobación de la sincronización:

//+------------------------------------------------------------------+
//| Проверка синхронизации данных                                                                                               |
//+------------------------------------------------------------------+
bool CheckSync(const string &usingSymbols[],// Список используемых символов
               const ENUM_TIMEFRAMES timeframe          // Рабочий ТФ
               )
  {
//--- Цикл по символам
   for(int i=0; i<_symbolsSize; i++)
     {
      //--- Проверяем синхронизацию i-го символа
      if(!SymbolIsSynchronized(usingSymbols[i]) || // Если нет синх. данных терминала и сервера или..
         !SeriesInfoInteger(usingSymbols[i],timeframe,SERIES_SYNCHRONIZED))   // ..не синх. данные по символу/периоду на данный момент
        {
         //---
         Print(__FUNCTION__,": ВНИМАНИЕ! Синхронизация по '"+usingSymbols[i]+"' ТФ "+EnumToString(timeframe)+" отсутствует!");
         Print(__FUNCTION__,": error = ",GetLastError());
         //--- Возвращаем ложь
         return( false );
        }
     }
//--- Все символы синхронизованы
   return( true );
  }

La sincronización es soportada por una solicitud de datos minuto a minuto en cada carácter con CopyTime(). ResetLastError() no restablece el número de error 4001 antes de llamar a las funciones de comprobación de la sincronización.

 

Hola, después de la actualización de MT5 del 8 de noviembre las líneas horizontales ya no son dibujadas por este script en el probador de estrategias. Y el comentario no aparece.

Por favor, aconséjeme cómo solucionarlo.

Error 4001.

2019.02.11 20:42:53.522 Terminal        MetaTrader x64 build 1983 started (MetaQuotes Software Corp.)
2019.02.11 20:42:53.528 Terminal        Windows 10 (build 14393) x64, IE 11, UAC, Intel Core i3  M 330 @ 2.13 GHz, Memory: 1797 / 3885 Mb, Disk: 359 / 368 Gb, GMT+8
 
San Kos:

Hola, después de la actualización de MT5 del 8 de noviembre las líneas horizontales ya no son dibujadas por este script en el probador de estrategias. Por favor, aconséjeme cómo solucionarlo.

Error 4001.

Confirmado.

Terminal y sistema:

2019.02.10 16:53:22.710 MetaTrader 5 x64 build 1983 started (MetaQuotes Software Corp.)
2019.02.10 16:53:23.196 Windows 10 (build 17134) x64, IE 11, UAC, Intel Core i3-3120 M  @ 2.50 GHz, Memory: 3340 / 8077 Mb, Disk: 101 / 415 Gb, GMT+2
2019.02.10 16:53:23.196 C:\Users\barab\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075


Ejemplo: Elrango diario del Asesor Experto funciona conOBJ_HLINE. En los errores de los probadores:

2019.02.11 14:37:47.737   InpStartMinute=5
2019.02.11 14:37:47.795 2018.09.01 00:00:00   VLineCreate: failed to create a vertical line! Error code = 4001
2019.02.11 14:37:47.795 2018.09.01 00:00:00   VLineMove: failed to move the vertical line! Error code = 4001
2019.02.11 14:37:47.795 2018.09.01 00:00:00   VLineCreate: failed to create a vertical line! Error code = 4001
2019.02.11 14:37:47.795 2018.09.01 00:00:00   VLineMove: failed to move the vertical line! Error code = 4001
2019.02.11 14:37:47.795 2018.09.01 00:00:00   HLineCreate: failed to create a horizontal line! Error code = 4001
2019.02.11 14:37:47.795 2018.09.01 00:00:00   HLineMove: failed to move the horizontal line! Error code = 4001
2019.02.11 14:37:47.795 2018.09.01 00:00:00   HLineCreate: failed to create a horizontal line! Error code = 4001
2019.02.11 14:37:47.795 2018.09.01 00:00:00   HLineMove: failed to move the horizontal line! Error code = 4001
2019.02.11 14:37:48.969 USDJPY,Daily: history cache allocated for 548 bars and contains 433 bars from 2017.01.02 00:00 to 2018.08.31 00:00
 
Alexey Kozitsyn:

Además de los errores anteriores en el probador (estoy probando un EA multidivisa), el probador no quiere mostrar otros símbolos, y el registro contiene numerosos errores de no sincronización, también bajo el número 4001.

De nuevo, en la compilación de 1981, todo funcionaba sin errores. En 1983 es un problema.

Función de comprobación de la sincronización:

La sincronización se apoya en una solicitud de datos minuto a minuto para cada carácter con CopyTime(). ResetLastError() no restablece el número de error 4001 antes de llamar a las funciones de comprobación de la sincronización.

Este error ya se ha solucionado.

 
Vladimir Karputov:

Confirmado.

El terminal y el sistema:


Ejemplo: El asesor derango diario trabaja con objetosOBJ_HLINE. En los errores del probador:

Se arreglará en la próxima versión.

 

Bild 1984 MQ Demo Server


 

Me pregunto si alguien más tiene este problema en la construcción de 1983? El probador multidivisa se niega a hacer café, parece que se ha convertido en un probador monodivisa. Estoy tratando de obtener barras para diferentes símbolos, pero no importa cuál solicite, devuelve la que está establecida en la configuración del probador.


Aquí hay un simple Asesor Experto que bloquea un error.

int OnInit()
  {
      EventSetMillisecondTimer(200);
      return INIT_SUCCEEDED;
  }

void OnTimer()
{
      MqlRates aBarsCHFJPY[], aBarsEURUSD[], aBarsUSDCHF[];
      int countBars = CopyRates("CHFJPY", PERIOD_H1, 1, 1, aBarsCHFJPY)
         , countBars2 = CopyRates("EURUSD", PERIOD_H1, 1, 1, aBarsEURUSD)
         , countBars3 = CopyRates("USDCHF", PERIOD_H1, 1, 1, aBarsUSDCHF);
      
      ExpertRemove();
      return;
}

Miro aBarsCHFJPY[0], aBarsEURUSD[0], aBarsUSDCHF[0] con la depuración, y veo que son absolutamente idénticos (y cuál de ellos depende exactamente de la selección de un símbolo en la configuración del probador). El cambio de la fecha del probador no afecta a nada. Dicho esto, las propiedades de los personajes parecen ser correctas. Volví a construir 1966 - todo está bien allí.