ka66

ka66: Auto-Guppy Multiple Moving Average (GMMA)

This implements a Guppy Multiple Moving Average (GMMA) with the following twists, which may be a feature or a bug, depending on your perspective:

  • For both fast and slow group of MAs, only a starting MA (the fastest in that group) is specified.
  • For either group, a configurable factor is set, which will be used to calculate subsequent MAs.
  • Automatically selects colours as gradients within a configurable colour range, clearly differentiating between the short-term and long-term groups of averages.
  • Use Weighted Moving Average (WMAs) as the averaging mechanism. More on this later.

For example, if in the fast group, we start with MA 3, and a factor of 2, then the 6 MAs in the group will be: 3, 6, 12, 24, 48, 96.

The calculated lookbacks are displayed on a table on the top-right, in case further indicators need to be calculated based on these values.

Use of WMAs: This is an annoyance of the implementation: As I use arrays to store lookback calculations (12 of them, individual variables would be a pani to work with!), getting these back out of the array returns a series rather than a simple value. For some unfathomable reason, PineScript doesn't allow copying/conversion of these into a simple value. To add insult to the injury, a bunch of moving averaging functions (e.g.: ta.ema, ta.hma) only work with simple int lookback values. Go figure. SMAs and WMAs are the two that allow series lookback values, and WMAs are less laggy than SMAs but remain smooth, so WMAs it is!
Script de código aberto

Dentro do verdadeiro espírito TradingView, o autor deste script publicou ele como um script de código aberto, para que os traders possam compreender e checar ele. Um viva ao autor! Você pode usá-lo gratuitamente, mas a reutilização deste código em uma publicação é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.

Quer usar esse script no gráfico?