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提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?