Testare 'CopyTicks'. - pagina 24

 
Alexey Kozitsyn:

Perché?

int  CopyTicks(
   string           symbol_name,           // имя символа
   MqlTick&         ticks_array[],         // массив для приёма тиков
   uint             flags=COPY_TICKS_ALL,  // флаг, определяющий тип получаемых тиков
   ulong            from=0,                // дата, начиная с которой запрашиваются тики
   uint             count=0                // количество тиков, которые необходимо получить
   );
Evidenziato in grassetto. L'array alla fine è un rifiuto dei valori predefiniti.
 
fxsaber:
int  CopyTicks(
   string           symbol_name,           // имя символа
   MqlTick&         ticks_array[],         // массив для приёма тиков
   uint             flags=COPY_TICKS_ALL,  // флаг, определяющий тип получаемых тиков
   ulong            from=0,                // дата, начиная с которой запрашиваются тики
   uint             count=0                // количество тиков, которые необходимо получить
   );
Evidenziato in grassetto.
Non evidenziato, ma probabilmente ha risposto sopra...
 
fxsaber:
int  CopyTicks(
   string           symbol_name,           // имя символа
   MqlTick&         ticks_array[],         // массив для приёма тиков
   uint             flags=COPY_TICKS_ALL,  // флаг, определяющий тип получаемых тиков
   ulong            from=0,                // дата, начиная с которой запрашиваются тики
   uint             count=0                // количество тиков, которые необходимо получить
   );
L'ho messo in grassetto. Array alla fine - evita i valori predefiniti.

Sì, la dimensione delle zecche nella cache può essere assegnata esplicitamente nella documentazione. Se volete ottenere l'intera cache - guardate la documentazione e chiedete il numero richiesto con la funzione, con parametri come qui:

intCopyBuffer(
intindicator_handle,// handle dell'indicatore
intbuffer_num,// numero del buffer dell'indicatore
intstart_pos,//dove iniziare
intcount,// quanti ne copiamo
doublebuffer[]// array dove i dati saranno copiati
);

Tutto è già stato inventato, perché inventare qualcosa di nuovo?

 
Alexey Kozitsyn:

Penso che sia molto più importante fare un download data-to-date che cercare di mantenere le impostazioni di default.

Quindi da una data all'altra sarà così. CopyTicks che cerca di corrispondere nella sintassi alle funzioni Copy solo per la presenza di Copy nel nome non è conveniente. Comodo e giustificato è quando puoi fare cose da preprocessore come questa

// Позволяет, как в MT4, работать с таймсериями: Open[Pos], High[Pos], Low[Pos], Close[Pos], Time[Pos], Volume[Pos].
// А так же задает привычные MT4-функции: iOpen, iHigh, iLow, iClose, iTime, iVolume.
#define DEFINE_TIMESERIE(NAME,FUNC,T)                                                                         \
  class CLASS##NAME                                                                                           \
  {                                                                                                           \
  public:                                                                                                     \
    static T Get( const string Symb, const int TimeFrame, const int iShift )                                  \
    {                                                                                                         \
      T tValue[];                                                                                             \
                                                                                                              \
      return((Copy##FUNC((Symb == NULL) ? _Symbol : Symb, _Period, iShift, 1, tValue) > 0) ? tValue[0] : -1); \
    }                                                                                                         \
                                                                                                              \
    T operator []( const int iPos ) const                                                                     \
    {                                                                                                         \
      return(CLASS##NAME::Get(_Symbol, _Period, iPos));                                                       \
    }                                                                                                         \
  };                                                                                                          \
                                                                                                              \
  CLASS##NAME NAME;                                                                                           \
                                                                                                              \
  T i##NAME( const string Symb, const int TimeFrame, const int iShift )                                       \
  {                                                                                                           \
    return(CLASS##NAME::Get(Symb, TimeFrame, iShift));                                                        \
  }

DEFINE_TIMESERIE(Volume, TickVolume, long)
DEFINE_TIMESERIE(Time, Time, datetime)
DEFINE_TIMESERIE(Open, Open, double)
DEFINE_TIMESERIE(High, High, double)
DEFINE_TIMESERIE(Low, Low, double)
DEFINE_TIMESERIE(Close, Close, double)
E non puoi farlo per CopyTicks perché ci sono due diversi thread fisici (TRADE e INFO) e un thread sintetico (ALL) - bandiere.
 
fxsaber:

Quindi da una data all'altra sarà così. CopyTicks che cerca di far corrispondere la sintassi alle funzioni Copy solo per la presenza di Copy nel nome non è conveniente. Conveniente e giustificato è quando si possono fare cose da preprocessore come questa.

#define DEFINE_TIMESERIE(NAME,FUNC,T)                                                                         \
  class CLASS##NAME                                                                                           \
  {                                                                                                           \
  public:                                                                                                     \
    static T Get( const string Symb, const int TimeFrame, const int iShift )                                  \
    {                                                                                                         \
      T tValue[];                                                                                             \
                                                                                                              \
      return((Copy##FUNC((Symb == NULL) ? _Symbol : Symb, _Period, iShift, 1, tValue) > 0) ? tValue[0] : -1); \
    }                                                                                                         \
                                                                                                              \
    T operator []( const int iPos ) const                                                                     \
    {                                                                                                         \
      return(CLASS##NAME::Get(_Symbol, _Period, iPos));                                                       \
    }                                                                                                         \
  };                                                                                                          \
                                                                                                              \
  CLASS##NAME NAME;                                                                                           \
                                                                                                              \
  T i##NAME( const string Symb, const int TimeFrame, const int iShift )                                       \
  {                                                                                                           \
    return(CLASS##NAME::Get(Symb, TimeFrame, iShift));                                                        \
  }

DEFINE_TIMESERIE(Volume, TickVolume, long)
DEFINE_TIMESERIE(Time, Time, datetime)
DEFINE_TIMESERIE(Open, Open, double)
DEFINE_TIMESERIE(High, High, double)
DEFINE_TIMESERIE(Low, Low, double)
DEFINE_TIMESERIE(Close, Close, double)
E per CopyTicks questo tipo di cosa non può essere fatta, perché ci sono due diversi thread fisici (TRADE e INFO) e uno sintetico (ALL) - bandiere.

Prima che tu apparissi sul forum, non avevo incontrato questo modo di scrivere, per il quale, ovviamente, ti ringrazio, ma non sono sicuro che molti programmatori lo troverebbero utile.

 
fxsaber:

Sul tuo demo, in effetti lo è. Su BCS non lo è.

Network 'xxx': authorized on BCS-MetaTrader5 through Access Server #2 (ping: 46.66 ms)


2016.10.18 15:12:32.949 Test14 (Si-12.16,M1)    Time: 29089 msc for 1503 records
2016.10.18 15:12:32.822 Test14 (Si-12.16,M1)    Time: 33207 msc for 1501 records
2016.10.18 15:12:32.639 Test14 (Si-12.16,M1)    Time: 21389 msc for 1500 records
2016.10.18 15:12:31.959 Test14 (Si-12.16,M1)    Time: 21926 msc for 1500 records

E su Alpari non è affatto buono.

Network 'xxx': authorized on Alpari-MT5 through mt5.nl.3 (ping: 61.87 ms)

2016.10.18 15:14:47.159 Test14 (GBPUSD,M1)      Time: 31086 msc for 1836 records
2016.10.18 15:14:46.999 Test14 (GBPUSD,M1)      Time: 30698 msc for 1836 records
2016.10.18 15:14:46.779 Test14 (GBPUSD,M1)      Time: 46306 msc for 1836 records
2016.10.18 15:14:46.612 Test14 (GBPUSD,M1)      Time: 30440 msc for 1836 records
2016.10.18 15:14:46.532 Test14 (GBPUSD,M1)      Time: 36227 msc for 1836 records

Ho parlato sopra dell'inconveniente di copytix. L'indicatore presentato rallenta a causa del fatto che devo chiamare più volte copytix. E tutti i ritardi sono dovuti a questo. Il punto è questo

La soluzione è stata proposta.

Ora, per scaricare le zecche tra le date, è necessario fare richieste per QUALSIASI numero di zecche, a partire dalla data di inizio. E poi guardare ogni volta, e se ha raggiunto la data finale. E dato che ogni richiesta di copytix è molto costosa, e si ottengono tali freni.

Dati dall'apertura reale, vengono caricati solo tick freschi:

2016.10.20 18:47:06.499 GetTickHistory: Получено 4 тиков за 46 мкс (пинг = 62214 мкс)
2016.10.20 18:47:06.499 GetTickHistory: Получены все доступные тики. Время [0]: 2016.10.20 16:47
2016.10.20 18:47:06.499 GetTickHistory: Получено 3 тиков за 20 мкс (пинг = 62214 мкс)
2016.10.20 18:47:06.499 GetTickHistory: Получены все доступные тики. Время [0]: 2016.10.20 16:47
2016.10.20 18:47:06.499 GetTickHistory: Получено 3 тиков за 19 мкс (пинг = 62214 мкс)
2016.10.20 18:47:06.499 GetTickHistory: Получены все доступные тики. Время [0]: 2016.10.20 16:47
2016.10.20 18:47:06.540 GetTickHistory: Получено 8 тиков за 107 мкс (пинг = 62214 мкс)
2016.10.20 18:47:06.540 GetTickHistory: Получены все доступные тики. Время [0]: 2016.10.20 16:47
2016.10.20 18:47:06.540 GetTickHistory: Получено 5 тиков за 19 мкс (пинг = 62214 мкс)
2016.10.20 18:47:06.540 GetTickHistory: Получены все доступные тики. Время [0]: 2016.10.20 16:47
2016.10.20 18:47:06.540 GetTickHistory: Получено 5 тиков за 19 мкс (пинг = 62214 мкс)
2016.10.20 18:47:06.540 GetTickHistory: Получены все доступные тики. Время [0]: 2016.10.20 16:47
2016.10.20 18:47:06.540 GetTickHistory: Получено 5 тиков за 18 мкс (пинг = 62214 мкс)
2016.10.20 18:47:06.540 GetTickHistory: Получены все доступные тики. Время [0]: 2016.10.20 16:47
COPY_TICKS_TRADE!
 
CopyTicks() sembra essere una funzione asincrona? Spesso i tick arrivano per candele che non si sono ancora aperte...
 
Alexey Kozitsyn:
CopyTicks() sembra essere una funzione asincrona?
Sì.
 
Mi piacerebbe sentire gli sviluppatori riguardo a CopyTicks() in tester... Ho dei cattivi sospetti a riguardo. Sono di nuovo interessato a lavorare con COPY_TICKS_TRADE!
 

Stanco del terminale. La sceneggiatura

void OnStart()
{
  MqlTick Ticks[];
  
  Print(CopyTicks(_Symbol, Ticks));
  Print(GetLastError());
}

impiccagioni. Cancellandolo manualmente, lo si disconnette.

2016.10.28 16:48:57.737 Test (GBPUSD,M1)        4401
2016.10.28 16:48:57.737 Test (GBPUSD,M1)        -1

Cambiare TF e simbolo - simile. Dopo il riavvio funziona.

Motivazione: