OPEN-SOURCE SCRIPT

+ Magic Carpet Bands

Aggiornato
Fun name for an indicator, eh? Well, it is true, I think; they look like magic carpets. They're actually pretty simple actually. They're Keltner Channels smoothed with a moving average. If you go down to the lookback period for the bands and set it to 1, you'll recognize them immediately.

Digging a bit deeper you see there are four magic carpets on the chart. The inner ones are set to a multiplier of 2, and the outer to a multiplier of 4. Each "carpet" is composed of two smoothed upper or lower Keltner Channels bounds, both with an optional offset, one of which is set to 13, and the other to 0 by default; and an optional color fill between these. There is also a color fill between the outer and inner carpets which gives them an interesting 3-dimensional aspect at times. They can look a bit like tunnels by default.

My thinking around the idea of using an offset with the bands is that if we assume these things to provide a dynamic support and resistance, and previous support and resistance maintains status as support and resistance until proven otherwise, then by putting an offset to past data we are creating a more obvious visual indication of that support or resistance in the present. The default offset is set to 13 bars back, so if price found resistance at some point around 13 bars ago, and price is currently revisiting it we assume it is still resistance, and that offset band is there to give us a strong visual aid. Obviously it's not foolproof, but nothing is.

Beyond that most interesting part of the indicator you have a nice selection of moving averages which the bands are calculated off of. By default it's set to my UMA. The bands themselves also have a selection of moving averages for how the keltner channels are smoothed. And a note: because the UMA and RDMA are averages of different length MAs, they can not be adjusted other than via the multiplier that sets the distance from the moving average.

The indicator is multi-timeframe, and the moving average can be colored based on a higher timeframe as well.

I popped in the divergence indicator here too. You can choose from RSI and OBV, and the divergences will be plotted on the chart. Working on finding a way to be able to have the bands/MA set to a higher timeframe while plotting the divergences on the chart timeframe, but don't have an answer to that yet.

Alerts for moving average crosses, band touches, and divergences.

I like this one a lot. Enjoy!

Pictures below.

https://s3.tradingview.com/snapshots/e/efXUaLdB.png
One interesting thing about this indicator is that band twists often occur at areas of support or resistance. Simply drawing horizontal lines from previous twisted points can provide places from which you may look for strength or weakness to enter into a trade, or which you might use as targets for taking profits. The vertical lines are just showing the point on the chart when the cross occurred.

https://s3.tradingview.com/snapshots/n/nJO4RLUK.png
Above is a Jurik MA with a bunch of adjustments made to the bands, and the moving average itself. Everything is super adjustable, so you can play around and have fun with them quite a bit.

https://s3.tradingview.com/snapshots/n/nJO4RLUK.png
Just a different MA and bands.

https://s3.tradingview.com/snapshots/m/MIwM2PN9.png
Note di rilascio
fixed an issue where the offset wasn't changing for the exterior bands
Note di rilascio
updated to pinescript version 5
changed UMA from an exponential to simple. this will have virtually no effect on those using it, as they are similar as to be nearly indistinguishable, however, I have a new indicator coming out soon that uses the simple UMA in it, so I wanted this to match with regard to the bands.
Note di rilascio
I'm publishing updates to all of my indicators, so I'm just going to comment on everything here since most of the updates are common across most of my indicators.

Updates specific to Magic Carpet Bands: I eliminated divergences and adjusted some default settings.

As I had a comment expressing confusion about how to use this, and as these are basically just Keltner Channels, below I present a snapshot of this setup as simple Keltner Channels for anyone who doesn't want to use this with offset or smoothing in the bands.
istantanea

User Non-Visible Updates (basically backend stuff that makes:
- changes in code legibility and consistency across all indicators (basically standardizing the coding across as many indicators as possible)
- implementation of libraries into my indicators; which helps significantly in doing what I typed above; which in turn will make creating any new indicators, if they are of the type to use these libraries, much simpler
- updated descriptions for all indicators, which should (it's possible I've forgotten things) reflect changes I've made recently and any I may have made in the past after first publication (this is very minor, but as I was changing so much I thought I may as well--I don't intend to update these much, if at all, in the future)

User Visible Updates:
- as I mentioned everything now uses my moving averages library and volatility bands library--this cuts down the total amount of code significantly, and has made it easier for me to add moving averages, or volatility bands to these indicators because I only had to/have to add it one time (to the library) rather than multiple times across all indicators*
- since creating these libraries I've added several new moving averages (Kaufman Adaptive, Laguerre Filter, McGinley Dynamic (doesn't work for all), and Zero-lag) to them while retaining all the previous with the exception of the UMA, which wasn't implemented consistently across all indicators anyway
- eliminated having two Bollinger Bands with different standard deviations and a fill between them in exchange for one with the band fill implementation that I use on my Donchian Channels Bands
- part of my code consistency across all indicators resulted in a much needed organization of the 'style' tab

*(affects all but the Wavetrend Oscillator, Wavetrend Oscillator Overlay, Jurik KDJ, Average Candle Bodies Range, Bollinger Bands Width, ALMA Trend Detector, Ultimate Moving Average, Donchian Channels, and Dynamic Donchian Channels)
baselineCandlestick analysisMoving AveragesnononsenseforexnononsensefxOscillatorssmoothedkeltnerchannelsvolatilitybandsvolatilityindicator

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?


Anche su:

Declinazione di responsabilità