AntRobot/utils/ChartUtils.mqh

59 lines
5.1 KiB
MQL5
Raw Permalink Normal View History

2025-05-30 14:40:14 +02:00
<EFBFBD><EFBFBD>//+------------------------------------------------------------------+
//| ChartUtils.mqh |
//| Copyright 2021, MetaQuotes Ltd. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Ltd."
#property link "https://www.mql5.com"
#property version "1.00"
class ChartUtils {
private:
public:
ChartUtils();
~ChartUtils();
void setChartTemplate() {
ChartSetInteger(0,CHART_COLOR_BACKGROUND,0);
ChartSetInteger(0, CHART_FOREGROUND,16777215);
ChartSetInteger(0,CHART_COLOR_CHART_UP,7451452);
ChartSetInteger(0,CHART_COLOR_CHART_DOWN,255);
ChartSetInteger(0,CHART_COLOR_CANDLE_BULL,7451452);
ChartSetInteger(0,CHART_COLOR_CANDLE_BEAR,255);
ChartSetInteger(0,CHART_COLOR_CHART_LINE,65280);
ChartSetInteger(0,CHART_COLOR_GRID,2697513);
ChartSetInteger(0,CHART_SHIFT,1);
ChartSetInteger(0,CHART_SHOW_ASK_LINE,1);
ChartSetInteger(0,CHART_SHOW_BID_LINE,1);
ChartSetInteger(0,CHART_SHOW_LAST_LINE,1);
ChartSetInteger(0,CHART_SHOW_PERIOD_SEP,1);
}
void drawLine(string name,datetime time1,double price1,datetime time2,double price2) {
//--- anulamos el valor del error
ResetLastError();
//--- creamos la l<EFBFBD>nea de tendencia seg<EFBFBD>n las coordenadas establecidas
if(!ObjectCreate(0, name,OBJ_TREND,0,time1,price1,time2,price2)) {
Print(__FUNCTION__,
": <00>Fallo al crear la l<00>nea de tendencia! C<00>digo del error = ",GetLastError());
return;
}
//--- establecemos el color de la l<EFBFBD>nea
ObjectSetInteger(0, name,OBJPROP_COLOR,clrBlue);
//--- establecemos el estilo de visualizaci<EFBFBD>n de la l<EFBFBD>nea
ObjectSetInteger(0, name,OBJPROP_STYLE,STYLE_SOLID);
//--- establecemos el grosor de la l<EFBFBD>nea
ObjectSetInteger(0, name,OBJPROP_WIDTH,1);
}
};
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
ChartUtils::ChartUtils() {
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
ChartUtils::~ChartUtils() {
}
//+------------------------------------------------------------------+