GRAPH

Category: ProBacktest

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.

Syntax

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.

Example

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.

Additional Information

  • The MACD (Moving Average Convergence Divergence) is a trend-following momentum indicator that shows the relationship between two moving averages of a security’s price. It is commonly used to identify potential buy and sell signals.
  • The RGB color model is used to specify colors in digital graphics. ‘R’ stands for Red, ‘G’ for Green, and ‘B’ for Blue. Each parameter can take a value from 0 to 255, allowing for over 16 million possible colors.

This instruction is particularly useful for traders who rely on visual cues and historical data analysis to refine their trading strategies.

Related Instructions:

  • GRAPHONPRICE probacktest
  • PRINT instructions
  • Logo Logo
    Loading...