Está perdiendo oportunidades comerciales:
- Aplicaciones de trading gratuitas
- 8 000+ señales para copiar
- Noticias económicas para analizar los mercados financieros
Registro
Entrada
Usted acepta la política del sitio web y las condiciones de uso
Si no tiene cuenta de usuario, regístrese
¿Por qué?
string symbol_name, // имя символа
MqlTick& ticks_array[], // массив для приёма тиков
uint flags=COPY_TICKS_ALL, // флаг, определяющий тип получаемых тиков
ulong from=0, // дата, начиная с которой запрашиваются тики
uint count=0 // количество тиков, которые необходимо получить
);
string symbol_name, // имя символа
MqlTick& ticks_array[], // массив для приёма тиков
uint flags=COPY_TICKS_ALL, // флаг, определяющий тип получаемых тиков
ulong from=0, // дата, начиная с которой запрашиваются тики
uint count=0 // количество тиков, которые необходимо получить
);
string symbol_name, // имя символа
MqlTick& ticks_array[], // массив для приёма тиков
uint flags=COPY_TICKS_ALL, // флаг, определяющий тип получаемых тиков
ulong from=0, // дата, начиная с которой запрашиваются тики
uint count=0 // количество тиков, которые необходимо получить
);
Sí, el tamaño de los ticks en la caché se puede asignar explícitamente en la documentación. Si quieres obtener todo el caché - mira la documentación y pide el número requerido con la función, con parámetros como aquí:
intCopiarBuffer(
intindicator_handle,// Manejador del indicador
intbuffer_num,// número del buffer indicador
intstart_pos,//donde empezar
intcount,// cuántos copiamos
doublebuffer[]// matriz donde se copiarán los datos
);
Todo está ya inventado, ¿por qué hay que inventar algo nuevo?
Creo que es mucho más importante hacer una descarga de fecha a fecha que intentar mantener la configuración por defecto.
Así que de fecha a fecha será. CopyTicks tratando de coincidir en la sintaxis con Copy-funciones sólo por la presencia de Copy en el nombre no es conveniente. Conveniente y justificado es cuando puedes hacer cosas de preprocesador como esta
// А так же задает привычные 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)
Así que de fecha a fecha será. CopyTicks tratando de hacer coincidir la sintaxis con las funciones de copia sólo por la presencia de Copy en el nombre no es conveniente. Conveniente y justificado es cuando puedes hacer cosas de preprocesador como esta.
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)
Antes de que aparecieras en el foro, no había encontrado esta forma de escribir, por lo que, por supuesto, te doy las gracias, pero no estoy seguro de que muchos programadores la encuentren útil.
En su demo, efectivamente lo es. En BCS no lo es.
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
Y en Alpari no es nada bueno.
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
Ya se habló de los inconvenientes de copytix. El indicador presentado se ralentiza debido a que tengo que llamar a copytix varias veces. Y todos los retrasos se deben a ello. La cuestión es la siguiente
Se ha propuesto la solución.
Ahora, para descargar los ticks entre las fechas, hay que hacer solicitudes para cualquier número de ticks, a partir de la fecha inicial. Y luego mira cada vez, y si llegó a la fecha de finalización. Y teniendo en cuenta que cada solicitud de copytix es muy cara, y que te dan esos frenos.
Datos de la apertura real, sólo se cargan los ticks frescos:
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
¿CopiarTicks() parece ser una función asíncrona?
Cansado de la terminal. El guión
{
MqlTick Ticks[];
Print(CopyTicks(_Symbol, Ticks));
Print(GetLastError());
}
cuelga. Si se borra manualmente, se cerrará la sesión.
2016.10.28 16:48:57.737 Test (GBPUSD,M1) -1
Cambio de TF y símbolo - similar. Después de reiniciar funciona.