PRINT displays variable values for each bar in a separate debug window in ProRealTime™, with optional labels and colors, for inspecting ProBuilder code.
Syntax
PRINT(variable) AS "Label" COLOURED(R, G, B) FILLCOLOR(bgR, bgG, bgB)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
variable | numeric | required | The variable or expression whose per-bar values are displayed. |
"Label" | string | variable name | Column header shown in the output table, set with AS. |
COLOURED(R, G, B) | RGB values | none | Text color of the printed values, each component 0 to 255. |
FILLCOLOR(bgR, bgG, bgB) | RGB values | none | Background color of the printed cells, each component 0 to 255. |
How it works
PRINT is a diagnostic instruction. For each candle the script processes, it appends the current value of the given variable to a table that opens in its own window, one row per bar and one column per PRINT statement. This makes it possible to watch how intermediate values evolve bar by bar without plotting them, which is often clearer than reading a curve when several variables interact.
The AS clause names the column, which matters as soon as more than one value is printed. COLOURED and FILLCOLOR control the text and cell background colors, so specific columns or value states can be made visually distinct.
PRINT belongs to indicator code written in ProBuilder. Strategy code has its own debugging outputs, GRAPH and GRAPHONPRICE, which plot values during a backtest instead of tabulating them. For text placed directly on the chart, DRAWTEXT is the alternative.
Because building the table costs time and memory on every bar, PRINT statements should be removed or commented out once debugging is finished. They add no value to a released indicator and slow down recalculation on large histories.
Examples
Example 1, Inspecting a candle body calculation (Indicator)
// Difference between close and open, shown in a debug table
VarA = close - open
R = 255
B = 255
PRINT(VarA) AS "A" COLOURED(R, 0, 0) FILLCOLOR(0, 0, B)
RETURNEach bar adds one row to the table under the header "A", with red text on a blue background. The indicator itself returns nothing, the point is the table.
Example 2, Comparing two intermediate values side by side (Indicator)
// Watch both moving averages while debugging a crossover
fastMA = average[10](close)
slowMA = average[40](close)
PRINT(fastMA) AS "Fast MA"
PRINT(slowMA) AS "Slow MA"
RETURN fastMA - slowMA AS "MA spread"Two PRINT statements produce two labelled columns, making it possible to verify the crossover logic bar by bar while the spread is plotted normally.
Example 3, Highlighting out-of-range values (Indicator)
// Print RSI and flag extreme readings with a distinct background
myRSI = RSI[14](close)
IF myRSI > 70 OR myRSI < 30 THEN
PRINT(myRSI) AS "RSI14" COLOURED(255, 255, 255) FILLCOLOR(200, 0, 0)
ELSE
PRINT(myRSI) AS "RSI14"
ENDIF
RETURN myRSI AS "RSI14"Conditional formatting inside the IF block makes overbought and oversold rows stand out in the table without changing the plotted output.
Common errors and gotchas
- Left in production code. PRINT is for development only. Forgotten statements keep generating the debug table on every recalculation and degrade performance on long histories.
- Unlabelled columns. Several PRINT calls without
ASlabels produce a table that is hard to read. Name every column when printing more than one variable. - Wrong tool for strategies. PRINT is an indicator debugging instruction. Inside ProBacktest or ProOrder code, use
GRAPHorGRAPHONPRICEto inspect values during a backtest. - RGB components out of range.
COLOUREDandFILLCOLORexpect each component between 0 and 255. Values outside that range do not produce the intended color.
Related instructions
GRAPH, plots a value in a separate window during a backtest.GRAPHONPRICE, plots a backtest value directly on the price chart.RETURN, outputs the final indicator value to the chart.DRAWTEXT, writes text at chart coordinates.COLOURED, applies color to returned curves and printed text.FILLCOLOR, sets background color for printed cells and drawings.
