WeightedAverage

Category: Indicators

The WeightedAverage function in ProBuilder language calculates the Weighted Moving Average (WMA) of a given price over a specified number of periods. This function is used to smooth out price data by creating an average price that is more heavily influenced by recent prices.

Syntax:

WeightedAverage[N](price)

Where N represents the number of periods over which the average is calculated, and price indicates the price data (such as close, open, high, or low).

Example:

myWMA = WeightedAverage[20](close)

This example calculates the 20-period Weighted Moving Average using the closing prices of the bars.

  • The WeightedAverage function assigns more weight to recent data points and less weight to older data points, unlike a simple moving average that assigns equal weight to all values.
  • This type of moving average is useful for identifying trends in data where recent changes are more significant than older changes.

Understanding the Weighted Moving Average can help in analyzing market trends more effectively, as it emphasizes recent price movements over older ones, potentially providing a more responsive indicator than a simple moving average.

Logo Logo
Loading...