peacefulLizard50262

Cumulative Weighted Triple Exponential Moving Average (CWTEMA)

wma
This Pine Script code defines an indicator called "CWTEMA" that plots a custom weighted triple exponential moving average (TEMA) on a chart. The indicator takes two inputs: a source series (usually the close price of a security) and a length parameter that specifies the number of periods over which the moving average is calculated.

The code first defines a tema() function, which calculates the TEMA for a given series of data and a given length. The function uses the ta.ema() function from the ta library to compute the exponential moving average of the source data, and then applies the triple exponential moving average formula to calculate the TEMA.

The wma() function is then defined, which calculates the weighted moving average of a given series of data using a set of weights. This function computes the weighted sum of the source data using the given weights, then divides this sum by the sum of the weights to calculate the weighted moving average.

Finally, the cweema() function is defined, which calculates the custom weighted TEMA. This function first computes the weights for each value in the moving average using the given length parameter, then calls the wma() and tema() functions to calculate the weighted moving average using the TEMA values. The cweema() function is then plotted on the chart.

Script open-source

Nello spirito di condivisione promosso da TradingView, l'autore (al quale vanno i nostri ringraziamenti) ha deciso di pubblicare questo script in modalità open-source, così che chiunque possa comprenderlo e testarlo. Puoi utilizzarlo gratuitamente, ma il riutilizzo del codice è subordinato al rispetto del Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.

Vuoi usare questo script sui tuoi grafici?