Testando 'CopyTicks'. - página 24

 
Alexey Kozitsyn:

Por quê?

int  CopyTicks(
   string           symbol_name,           // имя символа
   MqlTick&         ticks_array[],         // массив для приёма тиков
   uint             flags=COPY_TICKS_ALL,  // флаг, определяющий тип получаемых тиков
   ulong            from=0,                // дата, начиная с которой запрашиваются тики
   uint             count=0                // количество тиков, которые необходимо получить
   );
Destacado em negrito. A matriz no final é uma rejeição dos valores padrão.
 
fxsaber:
int  CopyTicks(
   string           symbol_name,           // имя символа
   MqlTick&         ticks_array[],         // массив для приёма тиков
   uint             flags=COPY_TICKS_ALL,  // флаг, определяющий тип получаемых тиков
   ulong            from=0,                // дата, начиная с которой запрашиваются тики
   uint             count=0                // количество тиков, которые необходимо получить
   );
Destacado em negrito.
Não destacado, mas provavelmente respondido acima...
 
fxsaber:
int  CopyTicks(
   string           symbol_name,           // имя символа
   MqlTick&         ticks_array[],         // массив для приёма тиков
   uint             flags=COPY_TICKS_ALL,  // флаг, определяющий тип получаемых тиков
   ulong            from=0,                // дата, начиная с которой запрашиваются тики
   uint             count=0                // количество тиков, которые необходимо получить
   );
Coloquei-o em negrito. Array at the end - evitar valores padrão.

Sim, o tamanho dos carrapatos no cache pode ser alocado explicitamente na documentação. Se você quiser obter o cache completo - olhe a documentação e peça o número necessário com a função, com parâmetros como aqui:

intCopyBuffer(
intindicator_handle,// alça indicadora
intbuffer_num,// número de buffer indicador
intstart_pos,// por onde começar
contagem de int,// quantos copiamos
buffer duplo[]// matriz onde os dados serão copiados
);

Tudo já foi inventado, por que você deveria inventar algo novo?

 
Alexey Kozitsyn:

Acho que é muito mais importante fazer um upload até a data do que tentar manter as configurações padrão.

Assim, de data em data, será. CopyTicks tentando combinar em sintaxe as funções de cópia somente devido à presença de Copy no nome não é conveniente. Conveniente e justificado é quando você pode fazer coisas de pré-processador como esta

// Позволяет, как в 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 você não pode fazê-lo para CopyTicks porque existem dois fios físicos diferentes (TRADE e INFO) e um fio sintético (ALL) - bandeiras.
 
fxsaber:

Assim, de data em data, será. CopyTicks tentando combinar a sintaxe com as funções de cópia só por causa da presença de Copy no nome não é conveniente. Conveniente e justificado é quando você pode fazer coisas de pré-processador como esta.

#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 para CopyTicks este tipo de coisa não pode ser feito, porque existem dois fios físicos diferentes (TRADE e INFO) e um sintético (ALL) - bandeiras.

Antes de você aparecer no fórum, eu não tinha encontrado esta forma de escrever, pela qual eu, é claro, agradeço, mas não tenho certeza de que muitos programadores a considerariam útil.

 
fxsaber:

Em sua demonstração, de fato é. Na BCS, não é.

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 na Alpari não é nada bom.

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

Falou acima sobre o inconveniente do copytix. O indicador apresentado diminui devido ao fato de que tenho que chamar o copytix várias vezes. E todos os atrasos são por causa disso. A questão é a seguinte

A solução foi proposta.

Agora, para fazer o download de ticks entre datas, você precisa fazer pedidos de QUALQUER número de ticks, a partir da data de início. E então olhe cada vez, e se chegou à data final. E dado que cada pedido de copytix é muito caro, e você recebe tais freios.

Dados de abertura real, apenas carrapatos frescos são carregados:

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() parece ser uma função assíncrona? Muitas vezes chegam carrapatos para castiçais que ainda não abriram.
 
Alexey Kozitsyn:
CopyTicks() parece ser uma função assíncrona?
Sim.
 
Eu gostaria de ouvir dos desenvolvedores sobre CopyTicks() no testador... Eu tenho más suspeitas sobre isso. Estou novamente interessado em trabalhar com COPY_TICKS_TRADE!
 

Cansado do terminal. O roteiro

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

pende. A sua eliminação manual será registrada.

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

Mudança de TF e símbolo - similar. Depois de reiniciado funciona.

Razão: