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.
PRINT(variable) as "Label" COLOURED(R, G, B) FILLCOLOR(BG_R, BG_G, BG_B)
The PRINT function can be customized with several parameters:
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)).
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.