PRINT

Category: Instructions

The PRINT function in ProBuilder language is a debugging tool used to display the values of variables for each candle on a chart. This function is particularly useful during the development and testing phases of creating trading strategies, indicators or screeners, as it allows developers to visually verify and track variable values over time in a separated window from the chart.

Syntax:

PRINT(variable) as "Label" COLOURED(R, G, B) FILLCOLOR(BG_R, BG_G, BG_B)

The PRINT function can be customized with several parameters:

  • variable: The variable whose values you want to display.
  • Label: A string that serves as the header for the column in which the variable values are displayed.
  • COLOURED(R, G, B): Sets the color of the text using RGB values, where R, G, and B represent the intensity of Red, Green, and Blue, respectively.
  • FILLCOLOR(BG_R, BG_G, BG_B): Sets the background color of the text display area using RGB values.

Example:

VarA = close - open
R = 255
B = 255
PRINT(VarA) as "A" COLOURED(R, 0, 0) FILLCOLOR(0, 0, B)
RETURN

This example calculates the difference between the closing and opening prices of a candle (stored in VarA) and displays it in a table. The label for this column is “A”. The text color is set to red (COLOURED(255, 0, 0)), and the background color is set to blue (FILLCOLOR(0, 0, 255)).

Additional Information:

The PRINT function is essential for debugging in ProBuilder because it provides a straightforward way to observe how variables change with each new candle on the chart. This can help identify errors in logic or unexpected values in codes. It is important to note that the PRINT function is intended for debugging purposes and should be removed or disabled in the final version of strategies script to ensure optimal performance.

Related Instructions:

  • GRAPH probacktest
  • GRAPHONPRICE probacktest
  • Logo Logo
    Loading...