TradingView
loxx
5 Sep 2022 pukul 19.38

STD-Stepped, Variety N-Tuple Moving Averages [Loxx] 

U.S. Dollar/Swiss FrancFXCM

Deskripsi

STD-Stepped, Variety N-Tuple Moving Averages [Loxx] is the standard deviation stepped/filtered indicator of the following indicator

tradingview.com/script/IM2KIi2P-Variety-N-Tuple-Moving-Averages-Loxx/

Variety N-Tuple Moving Averages is a moving average indicator that allows you to create 1- 30 tuple moving average types; i.e., Double-MA, Triple-MA, Quadruple-MA, Quintuple-MA, ... N-tuple-MA. This version contains 5 different moving average types including T3. A list of tuples can be found here if you'd like to name the order of the moving average by depth: Tuples extrapolated

STD-Stepped, You'll notice that this is a lot of code and could normally be packed into a single loop in order to extract the N-tuple MA, however due to Pine Script limitations and processing paradigm this is not possible ... yet.

If you choose the EMA option and select a depth of 2, this is the classic DEMA ; EMA with a depth of 3 is the classic TEMA , and so on and so forth this is to help you understand how this indicator works. This version of NTMA is restricted to a maximum depth of 30 or less. Normally this indicator would include 50 depths but I've cut this down to 30 to reduce indicator load time. In the future, I'll create an updated NTMA that allows for more depth levels.

This is considered one of the top ten indicators in forex. You can read more about it here: forex-station.com/viewtopic.php?f=579496&t=8473244

How this works

Step 1: Run factorial calculation on the depth value,

Step 2: Calculate weights of nested moving averages

factorial(nemadepth) / (factorial(nemadepth - k) * factorial(k); where nemadepth is the depth and k is the weight position

Examples of coefficient outputs:

6 Depth: 6 15 20 15 6
7 Depth: 7 21 35 35 21 7
8 Depth: 8 28 56 70 56 28 8
9 Depth: 9 36 34 84 126 126 84 36 9
10 Depth: 10 45 120 210 252 210 120 45 10
11 Depth: 11 55 165 330 462 462 330 165 55 11
12 Depth: 12 66 220 495 792 924 792 495 220 66 12
13 Depth: 13 78 286 715 1287 1716 1716 1287 715 286 78 13

Step 3: Apply coefficient to each moving average

For QEMA, which is 5 depth EMA , the caculation is as follows

ema1 = ta. ema ( src , length)
ema2 = ta. ema (ema1, length)
ema3 = ta. ema (ema2, length)
ema4 = ta. ema (ema3, length)
ema5 = ta. ema (ema4, length)

qema = 5 * ema1 - 10 * ema2 + 10 * ema3 - 5 * ema4 + ema5

Included:
  • Alerts
  • Loxx's Expanded Source Types
  • Bar coloring
  • Signals
  • Standard deviation stepping


Catatan Rilis

Limited to 15 so that Pine script doesn't time out. Use the new I posted after this one.
Komentar
theheirophant
I see you finally found tghe solution. Nice work mate
loxx
@theheirophant, lol, its one solution, not the most elegant but it gets the job done
slowcoconut
@loxx, instant fan of these stepped methods you've put out... they're perfect for cutting out noise... and the tuple variety offers many variations to dig thru.. thanks
rlone9440
Hi Loxx, sorry, not sure I understand your last update. You mentioned something new after this update. Would you elaborate a little? Thanks!
kastis
i'm getting compile error then applying indicator
secretcode
Nice, Thank you
Mosatrader2022
Absolute genius, thanks for all the effort. You are a kind of gift that keeps on giving lol.
Lebih lanjut