DRAWTEXT

Category: Graphical

DRAWTEXT is a graphical instruction used in ProBuilder programming to display text annotations directly on a trading chart. This function is particularly useful for labeling specific points, values, or conditions on a chart, enhancing the visual representation of trading data and strategies.

Syntax:

DRAWTEXT("text", x1, y1, (font), (style), (size)) COLOURED(R, G, B, a)
  • “text”: The string value to be displayed. Must be enclosed in quotation marks.
  • x1: The bar index where the text will start.
  • y1: The price or vertical axis value where the text will be placed.
  • (font) (optional): Font type with options including Dialog (default), Monospaced, Serif, SansSerif.
  • (style) (optional): Text style, options are Standard (default), Bold, Italic, BoldItalic. Requires to be specified.
  • (size) (optional): Font size, ranging from 10 (default) to 30. Requires to be specified.
  • COLOURED(R, G, B, a): Sets the color of the text using RGB values and an alpha (transparency) value.

Example:

Below is an example of how to use DRAWTEXT to label the high price of a trading session with the text “High Price”:

highPrice = high
DRAWTEXT("High Price", barindex, highPrice) COLOURED(255, 0, 0, 255)

This code snippet will display the text “High Price” at the highest price point of the current bar on the chart, colored in solid red.

Additional Information:

  • Variables can be included within the text by enclosing them in pound symbols (#). For example, DRAWTEXT("High: #highPrice#", barindex, highPrice) will display the actual high price value in the text.
  • The DRAWTEXT function is often used in conjunction with other graphical functions like DRAWLINE to provide a more comprehensive visual analysis tool on the chart.

This function is essential for traders who use visual aids to enhance their chart analysis, making it easier to identify and annotate key data points directly on the chart.

Logo Logo
Loading...