The GRAPHONPRICE instruction in ProBuilder language is used to display the values of variables directly on the price chart within a ProBacktest program. This feature is particularly useful for visualizing how variables change in relation to the price movements over time, aiding in the analysis and debugging of trading strategies.
GRAPHONPRICE variableName COLOURED(R, G, B, alpha) AS "Label"
Where:
Below is an example of how to use GRAPHONPRICE to plot Bollinger Bands indicators on a daily timeframe chart:
timeframe(daily)
ema20daily = average[20,1]
bolupdaily = BollingerUp[20](close)
boldndaily = BollingerDown[20](close)
timeframe(default)
// Plotting the indicators on the price chart
GRAPHONPRICE ema20daily COLOURED(200,200,0) AS "EMA 20 Daily"
GRAPHONPRICE bolupdaily COLOURED(0,200,0) AS "Bollinger Upper Band Daily"
GRAPHONPRICE boldndaily COLOURED(0,0,200) AS "Bollinger Lower Band Daily"
This code snippet first calculates the 20-day Exponential Moving Average (EMA) and the upper and lower bands of the Bollinger Bands on a daily timeframe. It then switches back to the default timeframe and plots these indicators on the price chart with specified colors.
The GRAPHONPRICE instruction can be a powerful tool for traders who need to visually track the behavior of specific variables or indicators directly on the trading chart. By using different colors and labels, multiple variables can be effectively distinguished and analyzed in the context of historical price action.
Understanding the plotted indicators, such as Bollinger Bands in the example, can provide insights into market volatility and price levels that might be significant for trading decisions. Bollinger Bands, for instance, consist of a middle band being a moving average, with the upper and lower bands calculated based on the standard deviation of the price from the moving average.