The GRAPH instruction in ProBuilder language is used to display the historical values of variables defined within a ProBacktest strategy on a chart. This feature allows traders and analysts to visually track the behavior of specific variables over time, aiding in the analysis and decision-making process.
GRAPH variableName AS "label"
GRAPH variableName coloured(R, G, B) AS "label"
The GRAPH instruction can be used multiple times within the same ProBacktest strategy. All specified variables will be displayed in the same chart window. The optional coloured(R, G, B) part allows the user to specify the color of the graphical representation using RGB color codes.
myMACD = MACD[12,26,9](close)
longCondition = myMACD crosses over 0
IF myMACD > 0 THEN
signals = 1
ELSE
signals = -1
ENDIF
IF longCondition THEN
BUY 1 LOT AT close + 10 LIMIT
ENDIF
SET STOP %TRAILING 0.5
GRAPH signals coloured(255,0,0) AS "MACD signals"
In this example, the MACD indicator is calculated with specific parameters and used to determine trading signals. The GRAPH instruction is then used to plot these signals on the chart, with positive signals in red (RGB: 255,0,0), enhancing visual analysis.
This instruction is particularly useful for traders who rely on visual cues and historical data analysis to refine their trading strategies.