Hatalar, hatalar, sorular - sayfa 2381

 

NormalFiyat Hatası! Herkese iyi günler. Normal bir kenar boşluğunu mql4'ten mql5'e yeniden işlemek NormalPrice hatası veriyor. Köpeğin nereye gömüldüğünü anlamaya yardımcı olun.

 #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());
   }
}

 
Soru konu başlığında olmayabilir ama ben onu böyle yaratmanın mantığını göremiyorum. burada soracağım.
Sinyal güvenilirliği neye dayanır?
 
Evgeniy Kazeikin :
Soru konu başlığında olmayabilir ama ben onu böyle yaratmanın mantığını göremiyorum. burada soracağım.
Sinyal güvenilirliği neye dayanır?
Karmaşık bir formüle göre hesaplanan beş veya altı bileşen vardır, ardından karşılık gelen renkle bir ölçek çizilir.
 
Slava :

Test cihazının yukarıdaki hatalarına ek olarak (çok para birimli bir Expert Advisor'ı test ediyorum), diğer sembollerin test cihazında görüntülenmesini istemiyor ve yine 4001 numaralı çok sayıda senkronizasyon dışı hata hata veriyor. kayıt.

Yine, 1981 yapısında her şey hatasız çalıştı. 1983'te - sorun.

Senkronizasyon kontrol fonksiyonu:

 //+------------------------------------------------------------------+
//| Проверка синхронизации данных                                                                                               |
//+------------------------------------------------------------------+
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 );
  }

Senkronizasyon, CopyTime() işlevi tarafından her sembol için her dakika veri talebi tarafından desteklenir. ResetLastError(), senkronizasyon kontrol işlevlerini çağırmadan önce 4001 hata numarasını sıfırlamaz.

 

Merhaba, 8 Kasım'daki MT5 güncellemesinden sonra, strateji test cihazında artık bu script kullanılarak yatay çizgiler çizilmiyordu. Ve yorum görüntülenmiyor.

Nasıl düzelteceğimi söyle.

Hata 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 :

Merhaba, 8 Kasım'daki MT5 güncellemesinden sonra, strateji test cihazında artık bu script kullanılarak yatay çizgiler çizilmiyordu. Lütfen nasıl düzelteceğimi söyle.

Hata 4001.

onaylıyorum.

Terminal ve sistem:

 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


Örnek: Günlük aralık EA , OBJ_HLINE nesneleri ile çalışır. Hata test cihazı:

 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 :

Test cihazının yukarıdaki hatalarına ek olarak (çok para birimli bir Expert Advisor'ı test ediyorum), diğer sembollerin test cihazında görüntülenmesini istemiyor ve yine 4001 numaralı çok sayıda senkronizasyon dışı hata hata veriyor. kayıt.

Yine, 1981 yapısında her şey hatasız çalıştı. 1983'te - sorun.

Senkronizasyon kontrol fonksiyonu:

Senkronizasyon, CopyTime() işlevi tarafından her sembol için her dakika veri talebi tarafından desteklenir. ResetLastError(), senkronizasyon kontrol işlevlerini çağırmadan önce 4001 hata numarasını sıfırlamaz.

Bu hata zaten düzeltildi.

 
Vladimir Karputov :

onaylıyorum.

Terminal ve sistem:


Örnek: Günlük aralık EA , OBJ_HLINE nesneleri ile çalışır. Hata test cihazı:

Bir sonraki derlemede düzeltilecektir.

 

1984 MQ demo sunucusu oluşturun


 

Merak ediyorum, 1983 yapısında bu sorunu yaşayan başka biri var mı? Çoklu para birimi test cihazı kahve demlemeyi reddetti , tek para birimi test cihazına dönüşmüş gibi görünüyor. Farklı semboller için çubuklar almaya çalışıyorum - hangisini talep ettiğimden bağımsız olarak , test cihazı ayarlarında ayarlanmış olanı döndürüyor.


İşte hata yaptığım basit bir Uzman Danışman.

 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 ;
}

aBarsCHFJPY[0], aBarsEURUSD[0], aBarsUSDCHF[0] değerlerinde hata ayıklamanın altına bakıyorum ve bunların tamamen aynı olduğunu (ve hangilerinin test cihazı ayarlarında seçilen sembole bağlı olduğunu) görüyorum. Test cihazının tarihini değiştirmek hiçbir şeyi etkilemez. Olduğu söyleniyor, karakter özellikleri doğru görünüyor. 1966'yı inşa etmeye geri döndüm - orada her şey yolunda.