Características del lenguaje mql5, sutilezas y técnicas - página 104
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
¿Cuántos instrumentos hay en la revisión del mercado?
61.
En la compilación 1907 los errores han desaparecido milagrosamente. Ni siquiera sé si hay que retroceder para encontrarlos, o si se acaba de arreglar algo en este sitio...
Pregunta sobre la construcción de indicadores
#property indicator_chart_window
#property indicator_buffers 12
#property indicator_plots 6
#property indicator_type1 DRAW_COLOR_LINE
#property indicator_type2 DRAW_COLOR_LINE
#property indicator_type3 DRAW_COLOR_LINE
#property indicator_type4 DRAW_COLOR_LINE
#property indicator_type5 DRAW_COLOR_LINE
#property indicator_type6 DRAW_COLOR_LINE
SetIndexBuffer(0,upper_line,INDICATOR_DATA);
SetIndexBuffer(1,upper_line_color,INDICATOR_COLOR_INDEX);
PlotIndexSetString(0,PLOT_LABEL,"Upper Line");
PlotIndexSetInteger(0,PLOT_LINE_STYLE,UpperStyle);
PlotIndexSetInteger(0,PLOT_LINE_WIDTH,UpperWidth);
PlotIndexSetInteger(0,PLOT_COLOR_INDEXES,2);
PlotIndexSetInteger(0,PLOT_LINE_COLOR,0,UpperTrendUp);
PlotIndexSetInteger(0,PLOT_LINE_COLOR,1,UpperTrendDw);
// ==========
SetIndexBuffer(2,awera_line,INDICATOR_DATA);
SetIndexBuffer(3,awera_line_color,INDICATOR_COLOR_INDEX);
PlotIndexSetString(1,PLOT_LABEL,"Average Line");
PlotIndexSetInteger(1,PLOT_LINE_STYLE,AverageStyle);
PlotIndexSetInteger(1,PLOT_LINE_WIDTH,AverageWidth);
PlotIndexSetInteger(1,PLOT_COLOR_INDEXES,2);
PlotIndexSetInteger(1,PLOT_LINE_COLOR,0,AverageTrendUp);
PlotIndexSetInteger(1,PLOT_LINE_COLOR,1,AverageTrendDw);
// ==========
SetIndexBuffer(4,lower_line,INDICATOR_DATA);
SetIndexBuffer(5,lower_line_color,INDICATOR_COLOR_INDEX);
PlotIndexSetString(2,PLOT_LABEL,"Lower Line");
PlotIndexSetInteger(2,PLOT_LINE_STYLE,LowerStyle);
PlotIndexSetInteger(2,PLOT_LINE_WIDTH,LowerWidth);
PlotIndexSetInteger(2,PLOT_COLOR_INDEXES,2);
PlotIndexSetInteger(2,PLOT_LINE_COLOR,0,LowerTrendUp);
PlotIndexSetInteger(2,PLOT_LINE_COLOR,1,LowerTrendDw);
¿Cuántos tampones de color se pueden utilizar?
¿Cómo se vinculan los topes entre sí?
#property indicator_buffers 12 // Declarar un total de 12 buffers
#property indicator_plots 6 // construcciones gráficas
¿Entiendo correctamente que especificando indicator_type 1 a 6, el indicador entenderá que se deben dibujar líneas de color para 6 gráficos?
#property indicator_type1 DRAW_COLOR_LINE
#property indicator_type2 DRAW_COLOR_LINE
#property indicator_type3 DRAW_COLOR_LINE
#property indicator_type4 DRAW_COLOR_LINE
#property indicator_type5 DRAW_COLOR_LINE
#property indicator_type6 DRAW_COLOR_LINE
// =====
SetIndexBuffer(0,upper_line,INDICATOR_DATA); // Primer buffer para datos
SetIndexBuffer(1,upper_line_color,INDICATOR_COLOR_INDEX); // Segundo buffer para datos de color
PlotIndexSetString(0,PLOT_LABEL, "Upper Line"); // Cambiar las propiedades del primer buffer
PlotIndexSetInteger(0,PLOT_LINE_STYLE,UpperStyle);// cambiar las propiedades del primer buffer
PlotIndexSetInteger(0,PLOT_LINE_WIDTH,UpperWidth);//cambiar las propiedades del primer buffer
PlotIndexSetInteger(0,PLOT_COLOR_INDEXES,2);// cambiar las propiedades del primer buffer
PlotIndexSetInteger(0,PLOT_LINE_COLOR,0,UpperTrendUp);// cambiar las propiedades del primer buffer
PlotIndexSetInteger(0,PLOT_LINE_COLOR,1,UpperTrendDw);// cambiar las propiedades del primer buffer
SetIndexBuffer(2,awera_line,INDICATOR_DATA); // Tercer buffer
SetIndexBuffer(3,awera_line_color,INDICATOR_COLOR_INDEX); // Cuarto buffer de colores
PlotIndexSetString(1,PLOT_LABEL, "Average Line"); // Cambiar las propiedades del buffer para SetIndexBuffer(2,awera_line,INDICATOR_DATA);
PlotIndexSetInteger(1,PLOT_LINE_STYLE,AverageStyle); // Cambiar las propiedades del buffer para SetIndexBuffer(2,awera_line,INDICATOR_DATA);
PlotIndexSetInteger(1,PLOT_LINE_WIDTH,AverageWidth); // Cambiar las propiedades del buffer para SetIndexBuffer(2,awera_line,INDICATOR_DATA);
PlotIndexSetInteger(1,PLOT_COLOR_INDEXES,2); // Cambiar las propiedades del buffer para SetIndexBuffer(2,awera_line,INDICATOR_DATA);
PlotIndexSetInteger(1,PLOT_LINE_COLOR,0,AverageTrendUp); // Cambiar las propiedades del buffer para SetIndexBuffer(2,awera_line,INDICATOR_DATA);
PlotIndexSetInteger(1,PLOT_LINE_COLOR,1,AverageTrendDw); // Cambiar las propiedades del buffer para SetIndexBuffer(2,awera_line,INDICATOR_DATA);
Pregunta sobre la construcción de indicadores
#property indicator_chart_window
#property indicator_buffers 12
#property indicator_plots 6
#property indicator_type1 DRAW_COLOR_LINE
#property indicator_type2 DRAW_COLOR_LINE
#property indicator_type3 DRAW_COLOR_LINE
#property indicator_type4 DRAW_COLOR_LINE
#property indicator_type5 DRAW_COLOR_LINE
#property indicator_type6 DRAW_COLOR_LINE
SetIndexBuffer(0,upper_line,INDICATOR_DATA);
SetIndexBuffer(1,upper_line_color,INDICATOR_COLOR_INDEX);
PlotIndexSetString(0,PLOT_LABEL,"Upper Line");
PlotIndexSetInteger(0,PLOT_LINE_STYLE,UpperStyle);
PlotIndexSetInteger(0,PLOT_LINE_WIDTH,UpperWidth);
PlotIndexSetInteger(0,PLOT_COLOR_INDEXES,2);
PlotIndexSetInteger(0,PLOT_LINE_COLOR,0,UpperTrendUp);
PlotIndexSetInteger(0,PLOT_LINE_COLOR,1,UpperTrendDw);
// ==========
SetIndexBuffer(2,awera_line,INDICATOR_DATA);
SetIndexBuffer(3,awera_line_color,INDICATOR_COLOR_INDEX);
PlotIndexSetString(1,PLOT_LABEL,"Average Line");
PlotIndexSetInteger(1,PLOT_LINE_STYLE,AverageStyle);
PlotIndexSetInteger(1,PLOT_LINE_WIDTH,AverageWidth);
PlotIndexSetInteger(1,PLOT_COLOR_INDEXES,2);
PlotIndexSetInteger(1,PLOT_LINE_COLOR,0,AverageTrendUp);
PlotIndexSetInteger(1,PLOT_LINE_COLOR,1,AverageTrendDw);
// ==========
SetIndexBuffer(4,lower_line,INDICATOR_DATA);
SetIndexBuffer(5,lower_line_color,INDICATOR_COLOR_INDEX);
PlotIndexSetString(2,PLOT_LABEL,"Lower Line");
PlotIndexSetInteger(2,PLOT_LINE_STYLE,LowerStyle);
PlotIndexSetInteger(2,PLOT_LINE_WIDTH,LowerWidth);
PlotIndexSetInteger(2,PLOT_COLOR_INDEXES,2);
PlotIndexSetInteger(2,PLOT_LINE_COLOR,0,LowerTrendUp);
PlotIndexSetInteger(2,PLOT_LINE_COLOR,1,LowerTrendDw);
¿Cuántos tampones de color se pueden utilizar?
¿Cómo se vinculan los topes entre sí?
#property indicator_buffers 12 // Declarar un total de 12 buffers
#property indicator_plots 6 // construcciones gráficas
¿Entiendo correctamente que especificando indicator_type 1 a 6, el indicador entenderá que se deben dibujar líneas de color para 6 gráficos?
#property indicator_type1 DRAW_COLOR_LINE
#property indicator_type2 DRAW_COLOR_LINE
#property indicator_type3 DRAW_COLOR_LINE
#property indicator_type4 DRAW_COLOR_LINE
#property indicator_type5 DRAW_COLOR_LINE
#property indicator_type6 DRAW_COLOR_LINE
// =====
SetIndexBuffer(0,upper_line,INDICATOR_DATA); // Primer buffer para datos
SetIndexBuffer(1,upper_line_color,INDICATOR_COLOR_INDEX); // Segundo buffer para datos de color
PlotIndexSetString(0,PLOT_LABEL, "Upper Line"); // Cambiar las propiedades del primer buffer
PlotIndexSetInteger(0,PLOT_LINE_STYLE,UpperStyle);// cambiar las propiedades del primer buffer
PlotIndexSetInteger(0,PLOT_LINE_WIDTH,UpperWidth);//cambiar las propiedades del primer buffer
PlotIndexSetInteger(0,PLOT_COLOR_INDEXES,2);// cambiar las propiedades del primer buffer
PlotIndexSetInteger(0,PLOT_LINE_COLOR,0,UpperTrendUp);// cambiar las propiedades del primer buffer
PlotIndexSetInteger(0,PLOT_LINE_COLOR,1,UpperTrendDw);// cambiar las propiedades del primer buffer
SetIndexBuffer(2,awera_line,INDICATOR_DATA); // Tercer buffer
SetIndexBuffer(3,awera_line_color,INDICATOR_COLOR_INDEX); // Cuarto buffer de colores
PlotIndexSetString(1,PLOT_LABEL, "Average Line"); // Cambiar las propiedades del buffer para SetIndexBuffer(2,awera_line,INDICATOR_DATA);
PlotIndexSetInteger(1,PLOT_LINE_STYLE,AverageStyle); // Cambiar las propiedades del buffer para SetIndexBuffer(2,awera_line,INDICATOR_DATA);
PlotIndexSetInteger(1,PLOT_LINE_WIDTH,AverageWidth); // Cambiar las propiedades del buffer para SetIndexBuffer(2,awera_line,INDICATOR_DATA);
PlotIndexSetInteger(1,PLOT_COLOR_INDEXES,2); // Cambiar las propiedades del buffer para SetIndexBuffer(2,awera_line,INDICATOR_DATA);
PlotIndexSetInteger(1,PLOT_LINE_COLOR,0,AverageTrendUp); // Cambiar las propiedades del buffer para SetIndexBuffer(2,awera_line,INDICATOR_DATA);
PlotIndexSetInteger(1,PLOT_LINE_COLOR,1,AverageTrendDw); // Cambiar las propiedades del buffer para SetIndexBuffer(2,awera_line,INDICATOR_DATA);
Será mejor que crees una rama separada para tu pregunta. Esta rama es sobre características, no debería haber discusiones aquí.
Para comprender mejor el principio del dibujo, implemente la funcionalidad de forma incremental. Has construido una línea - comprueba su funcionalidad, añade la siguiente.
Cada serie gráfica (en este caso una línea de color) sólo puede tener un búfer de color. Cada búfer puede contener muchos colores.
En la compilación de 1907, los errores han desaparecido milagrosamente. Ni siquiera sé si hay que retroceder para encontrarlos, o si se acaba de arreglar algo en este sitio...
Los errores desaparecieron, pero los problemas con la cola de eventos no. Después de unas horas, el terminal empieza a cargar la CPU hasta el 95%. Y algo me dice que las garrapatas se saltan.
@Slava, ¿ha cambiado algo en ChartEvent en las builds 19xx? ¿Se reproduce el problema en tus construcciones?
Los errores han desaparecido, pero los problemas de la cola de eventos no. Tras unas horas de funcionamiento, el terminal empieza a cargar la CPU al 95%. Y algo me dice que faltan garrapatas.
@Slava, ¿ha cambiado algo en ChartEvent en las builds 19xx? ¿Se reproduce su problema?
Este es el aspecto de la monitorización de los recursos tras 15 horas de trabajo del terminal (la frecuencia mínima de envío de eventos del espía es de 500 ms):
Aunque la carga de la CPU es cercana a 0 durante varias horas después del arranque.
Este es el aspecto de la monitorización de recursos después de 15 horas de funcionamiento del terminal (la tasa mínima de envío de eventos de spyware es de 500ms):
Aunque la carga de la CPU es cercana a 0 durante unas horas después del arranque.
Bild 1908 - sin cambios.
La posibilidad de sustituir los operadores de la estructura del tipo base permite la flexibilidad en algunas situaciones.
A modo de ejemplo, he aquí una de las técnicas de ordenación personalizada de una matriz de estructuras
Resultado
Esta es probablemente una bicicleta antigua.
La posibilidad de reemplazar los operadores de las estructuras de tipo base permite la flexibilidad en algunas situaciones.
hay algunos puntos. en mql, el operador < debe ser necesariamente un método de clase/estructura.
Esto significa que no puede establecerse para las estructuras incrustadas, ni para las inmutables.
Esto se puede mejorar un poco añadiendo una función de comparación de plantillas, que por defecto llamará al operador <
UPD: Escribo el operador < en todas partes porque suele estar sobrecargado en lugar de >, no es estricto, pero es generalmente aceptadohay algunos puntos. en mql, el operador < tiene que ser un método de la clase/estructura.
Significa que no se puede establecer para las estructuras incrustadas. O para las estructuras inmutables.
Resultado
Esta forma se puede mejorar un poco, añadiendo una función de comparación de plantillas, que por defecto llamará al operador <
Si se utiliza typedef, hay que definir una función de ordenación no sólo para las estructuras, sino también para los tipos numéricos estándar. O tal vez no entiendo de qué estás hablando.