OPEN-SOURCE SCRIPT

Multi SMA EMA WMA HMA BB (5+5 MAs + Bollinger Bands) MTF by RRB

Aggiornato
Multi SMA EMA WMA HMA BB (5+5 Moving Averages of Any Type with Bollinger Bands) MTF by RagingRocketBull 2018
Version 1.0

This indicator shows multiple MAs of any type (SMA EMA WMA HMA etc) with BB and MTF support

There are several versions: Simple, MTF, Pro MTF and Ultimate MTF. This is the MTF version. The Differences are listed below. All versions have BB
- Simple: you have 2 groups of MAs that can be assigned any type (5+5)
- MTF: +assign 1 custom Timeframe to any group combo (5+5 Custom TF)
- Pro MTF: +multiple Timeframes for multiple MA groups (4*3 MTF), horizontal levels and show max bars back options
- Ultimate MTF: +individual settings for each MA, multiple Timeframes

There are 2 groups of MAs, 3rd group is BB. You can:
- show/hide all MAs in a group. Use length 0 to hide a particular MA independently or uncheck in Style.
- apply any MA type to all MAs in a particular MA group. For example, you can assign all EMAs the HMA type. Groups are called EMAs and SMAs just for reference.
- assign Custom Timeframe to a particular MA/BB group combination or all groups. For example, show daily (D) EMAs+SMAs on H1 Timeframe, or only H4 (240) BB on H1.

You can use different types of MAs as dynamic S/R levels to trade of off and MA crosses as signals for possible trend change (golden/death bull/bear crosses).
Current Timeframe MAs can be used together with Custom Timeframe MAs on a single chart. Higher TF MAs are more important than lower TF MAs.
Most common MA types are: SMA, EMA, WMA, HMA.
Most common MA lengths are: 12, 20, 26, 30, 50, 100, 200, 400 etc.

MTF Notes:
- Script UI uses simple timeframe textbox instead of input resolution dropdown to allow for 240 120 and other custom TFs
- Groups that are not assigned a Custom TF will use Current Timeframe (0).
- MTF will work for any MA type assigned to the group. BB group always uses SMA type.
- MTF works both ways: you can display a higher TF MA/BB on a lower TF or a lower TF MA/BB on a higher TF.
- MTF MA values are normally aligned at the boundary of their native timeframe. This produces stair stepping when a higher TF MA is viewed on a lower TF.
Therefore Point Density/Smoothing is applied by default on MA MTF for visual aesthetics. Set to 0 to disable and see exact ma mtf values (lines with stair stepping and original mtf alignment).
- Smoothing is disabled for BB MTF because fill doesn't work with smoothed MAs after duplicate values are replaced with na.
- MTF MA Value fluctuation is possible on the current bar due to default security lookahead

Features:
- 2 groups of custom 5+5 MAs of any type including Hull Moving Average (HMA)
- BB
- 1x Custom Timeframe with step line smoothing for 3 groups (MAs + BB)

1. based on 3EmaBB, uses plot, fill, security, change, barstate, stdev and custom hma functions
2. you can't set certain constants from input due to Pinescript limitations - change the code as needed, recompile and use as a private script version
3. you can't have plot* inside ?/if/for/function, and implementing condition forks using 2 sets of plots (na vs non-na) doubles indicator params and styles - confusing
4. swma has a fixed length = 4, alma and linreg have additional offset and smoothing params


Feel free to use. Good Luck!
Note di rilascio
Changes in ver 2.0:
- fixed hma/wma(src, 0) error when len = 1 by adding a max(2,len) wrapper to hma function
- 3x separate TFs for EMAs, SMAs and BB groups instead of 7 preset combinations
- any BB MA Type option
- advanced X,Y Smoothing from MTF Pro version, added Y == 0, X > 0, TF >= deltaX_max_tf - X,Y smoothing disabled (stair stepping on high TFs)
- smoothing applied to BB MA only, excluding BB bands because fill won't work with smoothed bands. See MTF Pro version to learn how smoothing works.
- support for timeframes in H: H, 2H, 4H etc
- removed src security call (not needed)
- moved show/hide flags to top

Note: Recently TradingView has limited Replay Mode to D,W,MN only for free accounts. Pinescript security calls are now also limited.
You won't be able to plot any TF < D1 in Replay Mode (you will see straight lines) but all TFs will work properly in history and real-time modes. This is not a bug.

Smoothing:

X Y Point Density/MTF Smoothing of MA stair stepping on custom TFs - decides whether to show/hide ma values
- X,Y == 0 - X,Y smoothing disabled (stair stepping on high TFs)
- X == 0, Y > 0 - X,Y smoothing applied to all TFs
- Y == 0, X > 0 - X smoothing applied to all TFs < deltaX_max_tf, Y smoothing disabled
- Y == 0, X > 0, TF >= deltaX_max_tf - X,Y smoothing disabled (stair stepping on high TFs)
- X > 0, Y > 0 - Y smoothing applied to all TFs, then X smoothing applied to all TFs < deltaX_max_tf

X Smoothing with Y == 0 - shows only every deltaX-th point starting from the first bar.
X Smoothing with Y > 0 - shows only every deltaX-th point starting from the last shown Y point, essentially filling huge gaps remaining after Y Smoothing with points and preserving the curve's general shape
Y Smoothing reduces points on all TFs, removes adjacent points with prices within deltaY, while preserving the smaller curve details.
X Smoothing on high TFs with already scarce points produces weird curve shapes, it works best only on high density lower TFs
A combination of X,Y produces the most accurate smoothing. Higher delta value - larger range, more points removed.
Note di rilascio
Changes in ver 3.0:
- better screen on script's home page
Bollinger Bands (BB)Exponential Moving Average (EMA)HMAmtfmulti-timeframeSimple Moving Average (SMA)sma

Script open-source

In pieno spirito TradingView, l'autore di questo script lo ha pubblicato open-source, in modo che i trader possano comprenderlo e verificarlo. Un saluto all'autore! È possibile utilizzarlo gratuitamente, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.

Vuoi usare questo script sui tuoi grafici?

Declinazione di responsabilità