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
Además, el reto es encontrar una forma de evitar la limitación. Por ejemplo, prohibir el rediseño del indicador EURUSD hasta que lleguen los datos del USDCHF. Ahora estoy probando la siguiente variante
while(nPos > 1 || (nPos == 1 && Time[0] <= iTime("USDCHF", 0, 0))Pero todo depende de cómo MT calcula IndicatorCounted. Si por la hora de llegada de la garrapata - no funcionará, si por el hecho de redistribuir la barra - funcionará. Veamos.
Open[1] EURUSD H1 es 1.2755
Open[1] USDCHF H1 es 1.2443
Una nueva barra de una hora aparece en el EUR, nada ha cambiado en el Franco todavía. ¿Qué hará tu algoitmo?
Además, el reto es encontrar una forma de evitar la limitación. Por ejemplo, prohibir el rediseño del indicador EURUSD hasta que lleguen los datos del USDCHF. Ahora estoy probando la siguiente variante
while(nPos > 1 || (nPos == 1 && Time[0] <= iTime("USDCHF", 0, 0))Pero aquí todo depende de cómo MT calcula el IndicatorCounted. Si por la hora de llegada de los ticks - no funcionará, si por el hecho de redistribuir la barra - sí funcionará. Veamos.
Para, para. Aquí es donde se escribe :
Así que estamos hablando de trabajo en línea, y ahora hemos saltado a un probador. No tengo tiempo para eso.
Open[1] USDCHF H1 es 1.2443
Aparece una nueva barra horaria en el EUR, nada ha cambiado aún en el FRANK. ¿Qué hará tu algoitmo?
Sí, tienes razón. Hay que mirar la hora del bar, no su número.
No hay probador. Sólo en línea.
Lo he sacado al segundo archivo de la lista de barras para poder ver los desplegables.
//+------------------------------------------------------------------+ //| RedrawIndicators.mq4 | //| Satori | //| http://www.metaquotes.ru/forum/7790/ | //+------------------------------------------------------------------+ #property copyright "Satori" #property link "http://www.metaquotes.ru/forum/7790/" #property indicator_separate_window #property indicator_buffers 3 #property indicator_color1 Red #property indicator_color2 Blue #property indicator_color3 Yellow //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; extern int BarsCount=0; //кол-во считаемых баров, если 0 - то все extern string Currency1="EURUSD"; extern string Currency2="GBPUSD"; int handle,handle2; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); SetIndexLabel(0,Currency1); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,ExtMapBuffer2); SetIndexLabel(1,Currency2); SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,ExtMapBuffer3); handle= FileOpen("TestFile.csv",FILE_CSV|FILE_WRITE,';'); handle2= FileOpen("TestFile2.csv",FILE_CSV|FILE_WRITE,';'); if(handle<1 || handle2<1 ) { Print("Файл не обнаружен, последняя ошибка ", GetLastError()); return(false); } else { FileWrite (handle,"index",Symbol(),"index",Currency1,"index",Currency2); FileWrite (handle2,"index",Currency1,Currency2,Symbol()); } return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- FileClose(handle); FileClose(handle2); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int i; int test1,test2; datetime tt1,tt2,TimeMain; BarsCount=MathMin(Bars,(MathMin(iBars(Currency1,Period()),iBars(Currency2,Period())))); Print (Bars," ",iBars(Currency1,Period())," ",iBars(Currency2,Period())); Print (BarsCount); for (i=0;i<BarsCount-counted_bars;i++) { TimeMain=Time[i]; test1=iBarShift(Currency1,Period(),TimeMain); test2=iBarShift(Currency2,Period(),TimeMain); ExtMapBuffer1[i]=iTime(Currency1,Period(),test1); ExtMapBuffer2[i]=iTime(Currency2,Period(),test2); ExtMapBuffer3[i]=(ExtMapBuffer1[i]-ExtMapBuffer2[i]); tt1=Time[i]-ExtMapBuffer1[i]; tt2=Time[i]-ExtMapBuffer2[i]; if (ExtMapBuffer3[i]!=0 || tt1!=0 || tt2!=0) { if (FileWrite (handle, i,TimeToStr(Time[i]),iBarShift(Currency1,Period(),TimeMain),TimeToStr(ExtMapBuffer1[i]),iBarShift(Currency2,Period(),TimeMain),TimeToStr(ExtMapBuffer2[i]) )<=0) Print("нифига не пишет!!"); } FileFlush(handle); if (FileWrite (handle2,i, TimeToStr(iTime(Currency1,Period(),test1)), TimeToStr(iTime(Currency2,Period(),test2)), TimeToStr(Time[i]) )<=0) Print("нифига не пишет!!"); FileFlush(handle2); }//---- return(0); } //+------------------------------------------------------------------+Lo ejecutamos en EURGBP 4H en otros dos brokers, no en Alpari (MIG, FIBO).
La imagen es casi la misma para ambos, mostraré un ejemplo en MIG.
índice EURGBP índice EURUSD índice GBPUSD
15 30.10.2006 0:00 16 29.10.2006 23:00 16 29.10.2006 23:00
46 23.10.2006 0:00 47 22.10.2006 23:00 47 22.10.2006 23:00
77 16.10.2006 0:00 78 15.10.2006 23:00 78 15.10.2006 23:00
108 09.10.2006 0:00 109 08.10.2006 23:00 109 08.10.2006 23:00
139 02.10.2006 0:00 139 02.10.2006 0:00 140 01.10.2006 23:00
Tomemos como ejemplo los compases 46-47.
En el segundo archivo:
45 23.10.2006 4:00 23.10.2006 4:00 23.10.2006 4:00
46 22.10.2006 23:00 22.10.2006 23:00 23.10.2006 0:00
47 22.10.2006 23:00 22.10.2006 23:00 22.10.2006 23:00
48 20.10.2006 20:00 20.10.2006 20:00 20.10.2006 20:00
Parece estar bien... Pero aquí está el problema - ¡la barra 23.10.2006 00:00 está presente en el historial en las tres monedas! Es decir, está en el gráfico, está en el archivo de cotizaciones.
Pero parece que está ausente en el indicador.
Y el último truco: si intentas poner una línea vertical en esta barra, se desplazará a la siguiente. :о) Intenté marcarlo con una línea vertical pero no funcionó.