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!
Скрипт с открытым кодом

В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Отказ от ответственности

Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.

Хотите использовать этот скрипт на графике?