MQL4 Chart Properties

This documentation details MQL4 functions for managing chart properties. Each property has associated Get and Set functions (where applicable) that interact with the MetaTrader 4/5 terminal.

Core Chart Properties

  • **CHART_BRING_TO_TOP**: Displays chart above all others.
  • * ChartBringToTop(long chart_ID=0)
  • **CHART_MOUSE_SCROLL**: Enables/disables chart scrolling with the left mouse button.
  • * ChartMouseScrollGet(bool &result, long chart_ID=0) * ChartMouseScrollSet(bool value, long chart_ID=0)
  • **CHART_EVENT_MOUSE_MOVE**: Enables/disables sending mouse move/click events to MQL4 applications.
  • * ChartEventMouseMoveGet(bool &result, long chart_ID=0) * ChartEventMouseMoveSet(bool value, long chart_ID=0)
  • **CHART_EVENT_OBJECT_CREATE**: Enables/disables sending object creation events to MQL4 applications.
  • * ChartEventObjectCreateGet(bool &result, long chart_ID=0) * ChartEventObjectCreateSet(bool value, long chart_ID=0)
  • **CHART_EVENT_OBJECT_DELETE**: Enables/disables sending object deletion events to MQL4 applications.
  • * ChartEventObjectDeleteGet(bool &result, long chart_ID=0) * ChartEventObjectDeleteSet(bool value, long chart_ID=0)
  • **CHART_MODE**: Sets the chart display type (candlesticks, bars, line).
  • * ChartModeGet(long chart_ID=0) returns ENUM_CHART_MODE. * ChartModeSet(long value, long chart_ID=0)
  • **CHART_FOREGROUND**: Displays chart in the foreground.
  • * ChartForegroundGet(bool &result, long chart_ID=0) * ChartForegroundSet(bool value, long chart_ID=0)
  • **CHART_SHIFT**: Enables/disables chart shift from the right border.
  • * ChartShiftGet(bool &result, long chart_ID=0) * ChartShiftSet(bool value, long chart_ID=0)
  • **CHART_AUTOSCROLL**: Enables/disables automatic shift to the right border on new ticks.
  • * ChartAutoscrollGet(bool &result, long chart_ID=0) * ChartAutoscrollSet(bool value, long chart_ID=0)
  • **CHART_SCALE**: Sets chart scale (0-5).
  • * ChartScaleGet(long chart_ID=0) returns int. * ChartScaleSet(long value, long chart_ID=0)
  • **CHART_SCALEFIX**: Enables/disables fixed chart scale mode.
  • * ChartScaleFixGet(bool &result, long chart_ID=0) * ChartScaleFixSet(bool value, long chart_ID=0)
  • **CHART_SCALEFIX_11**: Enables/disables 1:1 chart scale mode.
  • * ChartScaleFix11Get(bool &result, long chart_ID=0) * ChartScaleFix11Set(bool value, long chart_ID=0)
  • **CHART_SCALE_PT_PER_BAR**: Enables/disables specifying chart scale in points per bar.
  • * ChartScalePerBarGet(bool &result, long chart_ID=0) * ChartScalePerBarSet(bool value, long chart_ID=0)
  • **CHART_SHOW_OHLC**: Enables/disables displaying OHLC values in the upper left corner.
  • * ChartShowOHLCGet(bool &result, long chart_ID=0) * ChartShowOHLCSet(bool value, long chart_ID=0)
  • **CHART_SHOW_BID_LINE**: Enables/disables displaying Bid value as a horizontal line.
  • * ChartShowBidLineGet(bool &result, long chart_ID=0) * ChartShowBidLineSet(bool value, long chart_ID=0)
  • **CHART_SHOW_ASK_LINE**: Enables/disables displaying Ask value as a horizontal line.
  • * ChartShowAskLineGet(bool &result, long chart_ID=0) * ChartShowAskLineSet(bool value, long chart_ID=0)
  • **CHART_SHOW_LAST_LINE**: Enables/disables displaying the last deal price line.
  • * ChartShowLastLineGet(bool &result, long chart_ID=0) * ChartShowLastLineSet(bool value, long chart_ID=0)
  • **CHART_SHOW_PERIOD_SEP**: Enables/disables displaying vertical separators between periods.
  • * ChartShowPeriodSeparatorGet(bool &result, long chart_ID=0) * ChartShowPeriodSepapatorSet(bool value, long chart_ID=0)
  • **CHART_SHOW_GRID**: Enables/disables displaying the chart grid.
  • * ChartShowGridGet(bool &result, long chart_ID=0) * ChartShowGridSet(bool value, long chart_ID=0)
  • **CHART_SHOW_VOLUMES**: Sets the mode for displaying volumes (none, tick, actual).
  • * ChartShowVolumesGet(long chart_ID=0) returns ENUM_CHART_VOLUME_MODE. * ChartShowVolumesSet(long value, long chart_ID=0)
  • **CHART_SHOW_OBJECT_DESCR**: Enables/disables graphical object pop-up descriptions on hover.
  • * ChartShowObjectDescriptionGet(bool &result, long chart_ID=0) * ChartShowObjectDescriptionSet(bool value, long chart_ID=0)
  • **CHART_VISIBLE_BARS**: Number of visible bars on the chart.
  • * ChartVisibleBars(long chart_ID=0) returns int.
  • **CHART_WINDOWS_TOTAL**: Total number of chart windows (including subwindows).
  • * ChartWindowsTotal(long chart_ID=0) returns int.
  • **CHART_WINDOW_IS_VISIBLE**: Checks visibility of a subwindow.
  • * ChartWindowsIsVisible(bool &result, long chart_ID=0, int sub_window=0)
  • **CHART_WINDOW_HANDLE**: Returns the chart handle.
  • * ChartWindowsHandle(long chart_ID=0) returns int.
  • **CHART_WINDOW_YDISTANCE**: Distance in pixels from subwindow top to main window top.
  • * ChartWindowsYDistance(long chart_ID=0, int sub_window=0) returns int.
  • **CHART_FIRST_VISIBLE_BAR**: Index of the first visible bar.
  • * ChartFirstVisibleBar(long chart_ID=0) returns int.
  • **CHART_WIDTH_IN_BARS**: Chart width in bars.
  • * ChartWidthInBars(long chart_ID=0) returns int.
  • **CHART_WIDTH_IN_PIXELS**: Chart width in pixels.
  • * ChartWidthInPixels(long chart_ID=0) returns int.
  • **CHART_HEIGHT_IN_PIXELS**: Chart height in pixels.
  • * ChartHeightInPixelsGet(long chart_ID=0, int sub_window=0) returns int. * ChartHeightInPixelsSet(int value, long chart_ID=0, int sub_window=0)
  • **CHART_COLOR_BACKGROUND**: Chart background color.
  • * ChartBackColorGet(long chart_ID=0) returns color. * ChartBackColorSet(color clr, long chart_ID=0)
  • **CHART_COLOR_FOREGROUND**: Color of axes, scale, and OHLC line.
  • * ChartForeColorGet(long chart_ID=0) returns color. * ChartForeColorSet(color clr, long chart_ID=0)
  • **CHART_COLOR_GRID**: Chart grid color.
  • * ChartGridColorGet(long chart_ID=0) returns color. * ChartGridColorSet(color clr, long chart_ID=0)
  • **CHART_COLOR_VOLUME**: Color of volumes and order opening levels.
  • * ChartVolumeColorGet(long chart_ID=0) returns color. * ChartVolumeColorSet(color clr, long chart_ID=0)
  • **CHART_COLOR_CHART_UP**: Color of up bar, its shadow, and bullish candlestick body border.
  • * ChartUpColorGet(long chart_ID=0) returns color. * ChartUpColorSet(color clr, long chart_ID=0)
  • **CHART_COLOR_CHART_DOWN**: Color of down bar, its shadow, and bearish candlestick body border.
  • * ChartDownColorGet(long chart_ID=0) returns color. * ChartDownColorSet(color clr, long chart_ID=0)
  • **CHART_COLOR_CHART_LINE**: Color of the chart line and Doji candlesticks.
  • * ChartLineColorGet(long chart_ID=0) returns color. * ChartLineColorSet(color clr, long chart_ID=0)
  • **CHART_COLOR_CANDLE_BULL**: Color of bullish candlestick body.
  • * ChartBullColorGet(long chart_ID=0) returns color. * ChartBullColorSet(color clr, long chart_ID=0)
  • **CHART_COLOR_CANDLE_BEAR**: Color of bearish candlestick body.
  • * ChartBearColorGet(long chart_ID=0) returns color. * ChartBearColorSet(color clr, long chart_ID=0)
  • **CHART_COLOR_BID**: Bid price line color.
  • * ChartBidColorGet(long chart_ID=0) returns color. * ChartBidColorSet(color clr, long chart_ID=0)
  • **CHART_COLOR_ASK**: Ask price line color.
  • * ChartAskColorGet(long chart_ID=0) returns color. * ChartAskColorSet(color clr, long chart_ID=0)
  • **CHART_COLOR_LAST**: Color of the last performed deal's price line.
  • * ChartLastColorGet(long chart_ID=0) returns color. * ChartLastColorSet(color clr, long chart_ID=0)
  • **CHART_COLOR_STOP_LEVEL**: Stop Loss and Take Profit level color.
  • * ChartStopLevelColorGet(long chart_ID=0) returns color. * ChartStopLevelColorSet(color clr, long chart_ID=0)
  • **CHART_SHOW_TRADE_LEVELS**: Enables/disables displaying trade levels (open orders, SL, TP, pending orders).
  • * ChartShowTradeLevelsGet(bool &result, long chart_ID=0) * ChartShowTradeLevelsSet(bool value, long chart_ID=0)
  • **CHART_DRAG_TRADE_LEVELS**: Enables/disables dragging trade levels with the mouse.
  • * ChartDragTradeLevelsGet(bool &result, long chart_ID=0) * ChartDragTradeLevelsSet(bool value, long chart_ID=0)
  • **CHART_SHOW_DATE_SCALE**: Enables/disables displaying the time scale.
  • * ChartShowDateScaleGet(bool &result, long chart_ID=0) * ChartShowDateScaleSet(bool value, long chart_ID=0)
  • **CHART_SHOW_PRICE_SCALE**: Enables/disables displaying the price scale.
  • * ChartShowPriceScaleGet(bool &result, long chart_ID=0) * ChartShowPriceScaleSet(bool value, long chart_ID=0)
  • **CHART_SHIFT_SIZE**: Shift size of the zero bar from the right border (10%-50%).
  • * ChartShiftSizeGet(long chart_ID=0) returns double. * ChartShiftSizeSet(double value, long chart_ID=0)
  • **CHART_IS_OFFLINE**: Checks if the chart is in offline mode.
  • * CheckChartOffline(long chart_ID=0) returns bool.
  • **CHART_FIXED_POSITION**: Fixed chart position from the left border (percentage).
  • * ChartFixedPositionGet(long chart_ID=0) returns double. * ChartFixedPositionSet(double value, long chart_ID=0)
  • **CHART_FIXED_MAX**: Fixed chart maximum value.
  • * ChartFixedMaxGet(long chart_ID=0) returns double. * ChartFixedMaxSet(double value, long chart_ID=0)
  • **CHART_FIXED_MIN**: Fixed chart minimum value.
  • * ChartFixedMinGet(long chart_ID=0) returns double. * ChartFixedMinSet(double value, long chart_ID=0)
  • **CHART_POINTS_PER_BAR**: Chart scale in points per bar.
  • * ChartPointsPerBarGet(long chart_ID=0) returns double. * ChartPointsPerBarSet(double value, long chart_ID=0)
  • **CHART_PRICE_MIN**: Minimum value on the chart.
  • * ChartPriceMin(long chart_ID=0, int sub_window=0) returns double.
  • **CHART_PRICE_MAX**: Maximum value on the chart.
  • * ChartPriceMax(long chart_ID=0, int sub_window=0) returns double.

    Chart Properties Panel

    A panel is provided for managing chart properties, including labels for property names and values, and buttons to cycle through options. It handles integer, double, and string properties, with specific logic for color and enumeration types. The panel dynamically adjusts based on available chart properties.