Cannot compute nested WAverage in PowerLanguage  [SOLVED]

Questions about MultiCharts and user contributed studies.
Guest

Cannot compute nested WAverage in PowerLanguage

Postby Guest » 18 May 2009

I'm writing an indicator that requires a double/triple weighted average smoothing of an oscillator.

I have the following code snippets:


Code: Select all

Mtm = Price[0] - Price[1];
signWma = WAverage(WAverage(Mtm,Fast),Slow);


The signWma variable does not compute. It appears that the nested WAverage is not kosher. Is there a way around this? Thanks in advance.

albertc
Posts: 13
Joined: 21 May 2009

  [SOLVED]

Postby albertc » 21 May 2009

Sorry, my mistake. I found out that the nested WAverage DOES indeed work, albeit VERY slowly. The code for WAverage is very inefficient so when the smoothing lengths are large, it takes a long time for the calculations to complete.

In the end, I got around this issue by writing a fast execution weighted moving average algorithm. Since a WMA is a convolution, the concept for the code is similar to that of SummationFC.


Return to “MultiCharts”