Variation

Category: Indicators

The Variation function in ProBuilder language is used to calculate the percentage change between the closing prices of two consecutive bars on a chart. This function is particularly useful for identifying how much the price has varied from one period to the next in percentage terms, which can be a critical indicator in trading strategies.

Syntax:

Variation(price)

Example:

// Calculate the variation in the high prices
var = Variation(high)
// Calculate a moving average of the variation and apply a standard deviation
averagingvar = 3 * STD[20](exponentialaverage[20](var))
RETURN var, averagingvar

This example demonstrates how to use the Variation function to compute the percentage change in the high prices of the bars. It also shows how to smooth this variation data using an exponential moving average and then scale it by three times the standard deviation over 20 periods. This can help in identifying significant changes or anomalies in price movements.

  • The Variation function takes one argument, which is the price series (e.g., close, open, high, low) from which the percentage change is calculated.
  • The result is a percentage that represents how much the price has increased or decreased from the previous bar to the current bar.
  • Additional processing of the variation data, like averaging or standard deviation, can provide more insights into the price trends and help in making informed trading decisions.

This function is essential for traders who focus on volatility and price changes, providing a straightforward metric to gauge market dynamics.

Logo Logo
Loading...