Escala horizontal (por tiempo)
Para determinar la escala y el número de barras a lo largo del eje horizontal, utilice el grupo de propiedades de enteros de ENUM_CHART_PROPERTY_INTEGER. Entre ellos, sólo CHART_SCALE es editable.
Identificador
|
Descripción
|
CHART_SCALE
|
Escala (0 a 5)
|
CHART_VISIBLE_BARS
|
Número de barras visibles actualmente en el gráfico (puede ser inferior a CHART_WIDTH_IN_BARS debido a la sangría CHART_SHIFT_SIZE) (sólo lectura)
|
CHART_FIRST_VISIBLE_BAR
|
Número de la primera barra visible en el gráfico. La numeración va de derecha a izquierda, como en una serie temporal. (sólo lectura)
|
CHART_WIDTH_IN_BARS
|
Anchura del gráfico en barras (capacidad potencial, las barras de los extremos a izquierda y derecha pueden ser parcialmente visibles) (sólo lectura)
|
CHART_WIDTH_IN_PIXELS
|
Anchura del gráfico en píxeles (sólo lectura)
|

Propiedades ENUM_CHART_PROPERTY_INTEGER de un gráfico
Estamos listos para implementar el siguiente script de prueba ChartScaleTime.mq5, que permite analizar los cambios en estas propiedades.
void OnStart()
{
int flags[] =
{
CHART_SCALE,
CHART_VISIBLE_BARS,
CHART_FIRST_VISIBLE_BAR,
CHART_WIDTH_IN_BARS,
CHART_WIDTH_IN_PIXELS
};
ChartModeMonitor m(flags);
...
}
|
A continuación figura una parte del registro con comentarios sobre las medidas adoptadas.
Initial state:
[key] [value]
[0] 5 4
[1] 100 35
[2] 104 34
[3] 105 45
[4] 106 715
// 1) changed the scale to a smaller one:
CHART_SCALE 4 -> 3 // - the value of the "scale" property has changed
CHART_VISIBLE_BARS 35 -> 69 // - increased the number of visible bars
CHART_FIRST_VISIBLE_BAR 34 -> 68 // - the number of the first visible bar has increased
CHART_WIDTH_IN_BARS 45 -> 90 // - increased the potential number of bars
// 2) disabled padding at the right edge
CHART_VISIBLE_BARS 69 -> 89 // - the number of visible bars has increased
CHART_FIRST_VISIBLE_BAR 68 -> 88 // - the number of the first visible bar has increased
// 3) reduced the window size
CHART_VISIBLE_BARS 89 -> 86 // - number of visible bars decreased
CHART_WIDTH_IN_BARS 90 -> 86 // - the potential number of bars has decreased
CHART_WIDTH_IN_PIXELS 715 -> 680 // - decreased width in pixels
// 4) clicked the "End" button to move to the current time
CHART_VISIBLE_BARS 86 -> 85 // - number of visible bars decreased
CHART_FIRST_VISIBLE_BAR 88 -> 84 // - the number of the first visible bar has decreased
|