73 lines
2.4 KiB
MQL5
73 lines
2.4 KiB
MQL5
|
|
//+------------------------------------------------------------------+
|
||
|
|
//| Distribucion.mq5 |
|
||
|
|
//| Copyright 2025, Niquel Mendoza. |
|
||
|
|
//| https://www.mql5.com/es/users/nique_372/news |
|
||
|
|
//+------------------------------------------------------------------+
|
||
|
|
#property copyright "Copyright 2025, Niquel Mendoza."
|
||
|
|
#property link "https://www.mql5.com/es/users/nique_372/news"
|
||
|
|
#property version "1.00"
|
||
|
|
#property strict
|
||
|
|
|
||
|
|
#include "..\\Histogram\\Main.mqh"
|
||
|
|
|
||
|
|
//+------------------------------------------------------------------+
|
||
|
|
//| Script program start function |
|
||
|
|
//+------------------------------------------------------------------+
|
||
|
|
void OnStart()
|
||
|
|
{
|
||
|
|
//---
|
||
|
|
CHistogramHorizontal his_horizontal;
|
||
|
|
his_horizontal.Initialize(600, 500, "HistogramaLabel", 0, 0, ColorToARGB(clrWhite));
|
||
|
|
his_horizontal.CreateBitmapLabel(100, 0, COLOR_FORMAT_ARGB_RAW);
|
||
|
|
|
||
|
|
//---
|
||
|
|
int width_parte_inf = 100;
|
||
|
|
|
||
|
|
//---
|
||
|
|
uint clr_p1 = 0xFF87ACCB;
|
||
|
|
uint clr_p2 = 0xFFC2A0AA;
|
||
|
|
uint clr_p3 = 0xFFD2A06A;
|
||
|
|
uint clr_black = ColorToARGB(clrBlack);
|
||
|
|
|
||
|
|
//--- Paso 1 titulo
|
||
|
|
int xgap = 20;
|
||
|
|
int ygap = 30;
|
||
|
|
|
||
|
|
his_horizontal.TituloDefault("Test titulo");
|
||
|
|
CHistogramTitulo* titulo_ptr = his_horizontal.TituloGetPointer();
|
||
|
|
// titulo_ptr.Text("Texto nuevo");
|
||
|
|
|
||
|
|
//--- Paso 1.5 Copyright (Opcional)
|
||
|
|
his_horizontal.CreateCopyrightDefault("Leo");
|
||
|
|
|
||
|
|
//--- Paso 2: Agregar data
|
||
|
|
vector v = vector::Random(100, 0.0, 100.0);
|
||
|
|
double arr[];
|
||
|
|
VectorToDoubleArray(v, arr);
|
||
|
|
his_horizontal.AddConjuntoBarWithBinsDeft("Distribucion", arr, 15);
|
||
|
|
|
||
|
|
//--- Paso 3 Inicilizaicon
|
||
|
|
int x1 = xgap + 50;
|
||
|
|
int x2 = 600 - 40;
|
||
|
|
int y1 = ygap;
|
||
|
|
int y2 = 500 - ygap - 25;
|
||
|
|
|
||
|
|
his_horizontal.InitLienzoBarras(x1, y1, x2, y2, 5, 5, 5) ; // No corte
|
||
|
|
//his_horizontal.GetLineCortePtr().Color(ColorToARGB(clrLightSteelBlue));
|
||
|
|
|
||
|
|
//--- Paso 4 Ejes (Opcional)
|
||
|
|
his_horizontal.CreateEjeLine(HIST_LINE_MODE_IZQUIERDA, clr_black, clr_black, 4, 5, 5, 2, 10, "Arial"); // Creamos el eje line
|
||
|
|
his_horizontal.EjeLineGetPointer().HistogramLinePointerGet().CreateTitulo("Datos", clr_black, 25, 12, "Arial"); // Creamos el titulo de las secciones
|
||
|
|
|
||
|
|
//---
|
||
|
|
his_horizontal.Redraw();
|
||
|
|
Sleep(5000);
|
||
|
|
|
||
|
|
//---
|
||
|
|
his_horizontal.SavePicture("histogram_1.png", true);
|
||
|
|
while(!IsStopped())
|
||
|
|
{
|
||
|
|
Sleep(2000);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
//+------------------------------------------------------------------+
|