DRAWHLINE

Category: Graphical

The DRAWHLINE function in ProBuilder language is used to draw a horizontal line across a chart at a specified y-coordinate. This function is particularly useful for marking specific levels or values on a chart, such as highs, lows, or custom calculations.

Syntax:

DRAWHLINE(y1) COLOURED(R, V, B, a)

The DRAWHLINE function requires one parameter, y1, which specifies the y-coordinate of the horizontal line. The COLOURED function is optional and can be used to set the color of the line using RGB (Red, Green, Blue) values and an alpha (transparency) value, a.

Example:

defparam drawonlastbaronly = true
hh = highest[15](high)
ll = lowest[15](low)
DRAWHLINE(hh) coloured(0, 200, 0)
DRAWHLINE(ll) coloured(200, 0, 0)
RETURN

In this example, the script first sets the parameter to draw only on the last bar using defparam drawonlastbaronly = true. It then calculates the highest and lowest values of the ‘high’ and ‘low’ price series over the last 15 bars, storing these in variables hh and ll respectively. Horizontal lines are then drawn at these levels, with the high line colored green (RGB: 0, 200, 0) and the low line colored red (RGB: 200, 0, 0).

Additional Information:

  • The DRAWHLINE function is useful for visual reference points on the chart, aiding in the analysis of price levels or other indicators.
  • The COLOURED function allows for customization of the line’s appearance, making it more visible or aligned with other charting elements.
  • Setting the alpha value in the COLOURED function can adjust the transparency of the line, which is useful when multiple lines are drawn on the same chart.

Understanding how to use the DRAWHLINE function effectively can enhance chart analysis and help in making informed trading decisions based on visual cues.

Related Instructions:

  • DRAWLINE graphical
  • DRAWSEGMENT graphical
  • DRAWVLINE graphical
  • Logo Logo
    Loading...