OPEN-SOURCE SCRIPT
Center Weighted Moving Average (CWMA)

This is a pine script that defines and implements a custom weighted moving average (WMA) indicator. The script first defines a function called wma that calculates the weighted moving average of a given data source (src) with a specified set of weights (weights) over a specified length (len). The wma function first computes the weighted sum of the source data by multiplying the source data with the weights and summing over the length. It then calculates the sum of the weights. Finally, it divides the weighted sum by the sum of the weights to compute the weighted moving average.
The script then defines a second function called cwma that calculates a custom WMA by defining the weights for each value in the moving average as the length plus one divided by two minus the absolute value of the length minus the source data. It then uses the wma function to calculate and return the weighted moving average.
The script then specifies the input parameters for the cwma function: the source data (close) and the moving average length (length). It then plots the custom weighted moving average on the chart.
The script then defines a second function called cwma that calculates a custom WMA by defining the weights for each value in the moving average as the length plus one divided by two minus the absolute value of the length minus the source data. It then uses the wma function to calculate and return the weighted moving average.
The script then specifies the input parameters for the cwma function: the source data (close) and the moving average length (length). It then plots the custom weighted moving average on the chart.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.