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.
DRAWTEXT("text", x1, y1, (font), (style), (size)) COLOURED(R, G, B, a)
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.
DRAWTEXT("High: #highPrice#", barindex, highPrice) will display the actual high price value in the text.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.