Inter-Exchanges Crypto Price Spread Deviation (Tartigradia)Measures the deviation of price metrics between various exchanges. It's a kind of realized volatility indicator, as the idea is that in times of high volatility (high emotions, fear, uncertainty), it's more likely that market inefficiencies will appear for the same asset between different market makers, ie, the price can temporarily differ a lot. This indicator will catch these instants of high differences between exchanges, even if they lasted only an instant (because we use high and low values).
Both standard deviation and median absolute deviation (more robust to outliers, ie, exchanges with a very different price from others won't influence the median absolute deviation, but the standard deviation yes).
Compared to other inter-exchanges spread indicators, this one offers two major features:
* The symbol automatically adapts to the symbol currently selected in user's chart. Hence, switching between tickers does not require the user to modify any option, everything is dynamically updated behind the scenes.
* It's easy to add more exchanges (requires some code editing because PineScript v5 does not allow dynamical request.security() calls).
Limitations/things to know:
* History is limited to what the ticker itself display. Ie, even if the exchanges specified in this indicator have more data than the ticker currently displayed in the user's chart, the indicator will show only a timeperiod as long as the chart.
* The indicator can manage multiple exchanges of different historical length (ie, some exchanges having more data going way earlier in the past than others), in which case they will simply be ignored from calculations when far back in the past. Hence, you should be aware that the further you go in the past, the less exchanges will have such data, and hence the less accurate the measures will be (because the deviation will be calculated from less sources than more recent bars). This is thanks to how the array.* math functions behave in case of na values, they simply skip them from calculations, contrary to math.* functions.

# MAD

Variety N-Tuple Moving Averages w/ Variety Stepping [Loxx]Variety N-Tuple Moving Averages w/ Variety Stepping 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 2 different moving average types. For example, using "50" as the depth will give you Quinquagintuple Moving Average. If you'd like to find the name of the moving average type you create with the depth input with this indicator, you can find a list of tuples here: Tuples extrapolated
Due to the coding required to adapt a moving average to fit into this indicator, additional moving average types will be added as they are created to fit into this unique use case. Since this is a work in process, there will be many future updates of this indicator. For now, you can choose from either EMA or RMA.
This indicator is also considered one of the top 10 forex indicators. See details here: forex-station.com
Additionally, this indicator is a computationally faster, more streamlined version of the following indicators with the addition of 6 stepping functions and 6 different bands/channels types.
STD-Stepped, Variety N-Tuple Moving Averages
STD-Stepped, Variety N-Tuple Moving Averages is the standard deviation stepped/filtered indicator of the following indicator
Last but not least, a big shoutout to @lejmer for his help in formulating a looping solution for this streamlined version. this indicator is speedy even at 50 orders deep. You can find his scripts here: www.tradingview.com
How this works
Step 1: Run factorial calculation on the depth value,
Step 2: Calculate weights of nested moving averages
factorial(depth) / (factorial(depth - k) * factorial(k); where depth 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 calculation 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)
In this new streamlined version, these MA calculations are packed into an array inside loop so Pine doesn't have to keep all possible series information in memory. This is handled with the following code:
temp = array.get(workarr, k + 1) + alpha * (array.get(workarr, k) - array.get(workarr, k + 1))
array.set(workarr, k + 1, temp)
After we pack the array, we apply the coefficients to derive the NTMA:
qema = 5 * ema1 - 10 * ema2 + 10 * ema3 - 5 * ema4 + ema5
Stepping calculations
First off, you can filter by both price and/or MA output. Both price and MA output can be filtered/stepped in their own way. You'll see two selectors in the input settings. Default is ATR ATR. Here's how stepping works in simple terms: if the price/MA output doesn't move by X deviations, then revert to the price/MA output one bar back.
ATR
The average true range (ATR) is a technical analysis indicator, introduced by market technician J. Welles Wilder Jr. in his book New Concepts in Technical Trading Systems, that measures market volatility by decomposing the entire range of an asset price for that period.
Standard Deviation
Standard deviation is a statistic that measures the dispersion of a dataset relative to its mean and is calculated as the square root of the variance. The standard deviation is calculated as the square root of variance by determining each data point's deviation relative to the mean. If the data points are further from the mean, there is a higher deviation within the data set; thus, the more spread out the data, the higher the standard deviation.
Adaptive Deviation
By definition, the Standard Deviation (STD, also represented by the Greek letter sigma σ or the Latin letter s) is a measure that is used to quantify the amount of variation or dispersion of a set of data values. In technical analysis we usually use it to measure the level of current volatility .
Standard Deviation is based on Simple Moving Average calculation for mean value. This version of standard deviation uses the properties of EMA to calculate what can be called a new type of deviation, and since it is based on EMA , we can call it EMA deviation. And added to that, Perry Kaufman's efficiency ratio is used to make it adaptive (since all EMA type calculations are nearly perfect for adapting).
The difference when compared to standard is significant--not just because of EMA usage, but the efficiency ratio makes it a "bit more logical" in very volatile market conditions.
See how this compares to Standard Devaition here:
Adaptive Deviation
Median Absolute Deviation
The median absolute deviation is a measure of statistical dispersion. Moreover, the MAD is a robust statistic, being more resilient to outliers in a data set than the standard deviation. In the standard deviation, the distances from the mean are squared, so large deviations are weighted more heavily, and thus outliers can heavily influence it. In the MAD, the deviations of a small number of outliers are irrelevant.
Because the MAD is a more robust estimator of scale than the sample variance or standard deviation, it works better with distributions without a mean or variance, such as the Cauchy distribution.
For this indicator, I used a manual recreation of the quantile function in Pine Script. This is so users have a full inside view into how this is calculated.
Efficiency-Ratio Adaptive ATR
Average True Range (ATR) is widely used indicator in many occasions for technical analysis . It is calculated as the RMA of true range. This version adds a "twist": it uses Perry Kaufman's Efficiency Ratio to calculate adaptive true range
See how this compares to ATR here:
ER-Adaptive ATR
Mean Absolute Deviation
The mean absolute deviation (MAD) is a measure of variability that indicates the average distance between observations and their mean. MAD uses the original units of the data, which simplifies interpretation. Larger values signify that the data points spread out further from the average. Conversely, lower values correspond to data points bunching closer to it. The mean absolute deviation is also known as the mean deviation and average absolute deviation.
This definition of the mean absolute deviation sounds similar to the standard deviation (SD). While both measure variability, they have different calculations. In recent years, some proponents of MAD have suggested that it replace the SD as the primary measure because it is a simpler concept that better fits real life.
For Pine Coders, this is equivalent of using ta.dev()
Bands/Channels
See the information above for how bands/channels are calculated. After the one of the above deviations is calculated, the channels are calculated as output +/- deviation * multiplier
Signals
Green is uptrend, red is downtrend, yellow "L" signal is Long, fuchsia "S" signal is short.
Included:
Alerts
Loxx's Expanded Source Types
Bar coloring
Signals
6 bands/channels types
6 stepping types
Related indicators
3-Pole Super Smoother w/ EMA-Deviation-Corrected Stepping
STD-Stepped Fast Cosine Transform Moving Average
ATR-Stepped PDF MA

[Mad] Pivots HL-TrendHi There
This is a Trend-Indicator based on Pivot highs and Pivot lows from different forward-backward lenghts.
As Mohamed3nan is only looking at one timeframe, here is a mtf-version of that
How to use?
This indicator should basically work in each timeframe.
Green is Bullmode, Red is Bearmode
try to find a "IN Trend" setup or go directly in on the switch of the trends...
The riskmanagement is as always in your own hands
you can activate the field, ends up in a mess like this here :D

Adaptive MA Difference constructor [lastguru]A complimentary indicator to my Adaptive MA constructor. It calculates the difference between the two MA lines (inspired by the Moving Average Difference (MAD) indicator by John F. Ehlers). You can then further smooth the resulting curve. The parameters and options are explained here:
The difference is normalized by dividing the difference by twice its Root mean square (RMS) over Slow MA length. Inverse Fisher Transform is then used to force the -1..1 range.
Same Postfilter options are provided as in my Adaptive Oscillator constructor:
Stochastic - Stochastic
Super Smooth Stochastic - Super Smooth Stochastic (part of MESA Stochastic ) by John F. Ehlers
Inverse Fisher Transform - Inverse Fisher Transform
Noise Elimination Technology - a simplified Kendall correlation algorithm "Noise Elimination Technology" by John F. Ehlers
Momentum - momentum (derivative)
Except for Inverse Fisher Transform, all Postfilter algorithms can have Length parameter. If it is not specified (set to 0), then the calculated Slow MA Length is used.

Ehlers Moving Average Difference Hann Indicator [CC]The Moving Average Difference Hann Indicator was created by John Ehlers (Stocks and Commodities Nov 2021) and this is an improved variation of his Moving Average Difference Indicator that uses smoothing from his Hann Windowing Indicator to provide smoother buy and sell signals. As for how this indicator works it is an improved version of the classic MACD indicator which of course takes a difference between two exponential moving averages. I have included strong buy and signals in addition to normal ones so lighter colors are normal signals and darker colors are strong signals. Buy when the line turns green and sell when it turns red.
Let me know if there are any other indicators you would like to see me publish!

Mean Absolute Deviation BandsThe other way to build bands around price that uses Mean Absolute Deviation instead of Standard Deviation.
MAD is also a measure of variability, but less frequently used. MAD is better for use with distributions other than the Gaussian.
MAD is always less than or equal to Standard Deviation and the resulting bands are more tighter for the same parameters if we compare it to Bollinger Bands.
If you use band stops this can be useful.

[RESEARCH] Mean Absolute DeviationHello traders and developers!
I was wondering how built-in "dev" function in Pine is calculated so I made a little research.
I examined 7 samples:
0) "dev" function itself
1) "dev" according to its description: series - sma(series)
2) Mean Absolute Deviation
3) ratio of the absolute difference from 1) divided by period
4) ratio of the difference from 1) divided by period
5) Median Absolute Deviation
6) tricky for-loop to calculate Mean Absolute Deviation
The results of the null and sixth samples are identical.
So, TV built-in "dev" function represents Mean Absolute Deviation and it's description is incorrect.
Where it is used? For example: Commodity Channel Index. You can check its original formula and if you used simple standard deviation instead of MAD in your CCIs - well guys, you were wrong.
Good luck!

Hampel FilterHampel Filter script.
This indicator was originally developed by Frank Rudolf Hampel (Journal of the American Statistical Association, 69, 382–393, 1974: The influence curve and its role in robust estimation).
The Hampel filter is a simple but effective filter to find outliers and to remove them from data. It performs better than a median filter.

Moving Average Delta Indicator by KIVANC fr3762Description:
MAD stands for Moving Average Delta, it calculates the difference between moving average and price. The curve shows the difference in Pips.
By calculating the delta between two points we can see more small changes in the direction of the moving average curve which are normally hard to see. You can see the MAD curve as look through the microscope at a simple moving average curve. It may help predicting a trend change before it happens, the sample shows a beginning trend change from long to short.
Interpretation:
If the MAD curve is bigger than 0, the moving average is above the price
conversely;
If the MAD curve is smaller than 0, the moving average is below the price
Before a trend change, the moving average gets flatter, the MAD curve points to towards the zero
We can see what is the maximum rising/falling of the difference and predict an upcomming trend change
Usage:
Drop a simple moving average to a chart and set the period in a way that it best fits the movements. There is no "magic" settings for the moving average period, you may double click the MA line to set it to a different period.
Drop the MAD indicator to the cart and give it the same period as your simple moving average .

BUY & SELL VOLUME TO PRICE PRESSURE by @XeL_ArjonaBUY & SELL PRICE TO VOLUME PRESSURE
By Ricardo M Arjona @XeL_Arjona
DISCLAIMER:
The Following indicator/code IS NOT intended to be a formal investment advice or recommendation by the author, nor should be construed as such. Users will be fully responsible by their use regarding their own trading vehicles/assets.
The embedded code and ideas within this work are FREELY AND PUBLICLY available on the Web for NON LUCRATIVE ACTIVITIES and must remain as is.
Pine Script code MOD's and adaptations by @XeL_Arjona with special mention in regard of:
Buy (Bull) and Sell (Bear) "Power Balance Algorithm" by: Stocks & Commodities V. 21:10 (68-72): "Bull And Bear Balance Indicator by Vadim Gimelfarb"
Normalisation (Filter) from Karthik Marar's VSA work: karthikmarar.blogspot.mx
Buy to Sell Convergence / Divergence and Volume Pressure Counterforce Histogram Ideas by: @XeL_Arjona
WHAT IS THIS?
The following indicators try to acknowledge in a K-I-S-S approach to the eye (Keep-It-Simple-Stupid), the two most important aspects of nearly every trading vehicle: -- PRICE ACTION IN RELATION BY IT'S VOLUME --
Volume Pressure Histogram: Columns plotted in positive are considered the dominant Volume Force for the given period. All "negative" columns represents the counterforce Vol.Press against the dominant.
Buy to Sell Convergence / Divergence: It's a simple adaptation of the popular "Price Percentage Oscillator" or MACD but taking Buying Pressure against Selling Pressure Averages, so given a Positive oscillator reading (>0) represents Bullish dominant Trend and a Negative reading (<0) a Bearish dominant Trend. Histogram is the diff between RAW Volume Pressures Convergence/Divergence minus Normalised ones (Signal) which helps as a confirmation.
Volume bars are by default plotted from RAW Volume Pressure algorithms, but they can be as well filtered with Karthik Marar's approach against a "Total Volume Average" in favor to clean day to day noise like HFT.
ALL NEW IDEAS OR MODIFICATIONS to these indicators are Welcome in favor to deploy a better and more accurate readings. I will be very glad to be notified at Twitter: @XeL_Arjona
Any important addition to this work MUST REMAIN PUBLIC by means of CreativeCommons CC & TradingView. -- 2015

BUY & SELL VOLUME TO PRICE PRESSURE by @XeL_ArjonaBUY & SELL PRICE TO VOLUME PRESSURE
By Ricardo M Arjona @XeL_Arjona
DISCLAIMER:
The Following indicator/code IS NOT intended to be a formal investment advice or recommendation by the author, nor should be construed as such. Users will be fully responsible by their use regarding their own trading vehicles/assets.
The embedded code and ideas within this work are FREELY AND PUBLICLY available on the Web for NON LUCRATIVE ACTIVITIES and must remain as is.
Pine Script code MOD's and adaptations by @XeL_Arjona with special mention in regard of:
Buy (Bull) and Sell (Bear) "Power Balance Algorithm" by: Stocks & Commodities V. 21:10 (68-72): "Bull And Bear Balance Indicator by Vadim Gimelfarb"
Normalisation (Filter) from Karthik Marar's VSA work: karthikmarar.blogspot.mx
Buy to Sell Convergence / Divergence and Volume Pressure Counterforce Histogram Ideas by: @XeL_Arjona
WHAT IS THIS?
The following indicators try to acknowledge in a K-I-S-S approach to the eye (Keep-It-Simple-Stupid), the two most important aspects of nearly every trading vehicle: -- PRICE ACTION IN RELATION BY IT'S VOLUME --
Volume Pressure Histogram: Columns plotted in positive are considered the dominant Volume Force for the given period. All "negative" columns represents the counterforce Vol.Press against the dominant.
Buy to Sell Convergence / Divergence: It's a simple adaptation of the popular "Price Percentage Oscillator" or MACD but taking Buying Pressure against Selling Pressure Averages, so given a Positive oscillator reading (>0) represents Bullish dominant Trend and a Negative reading (<0) a Bearish dominant Trend. Histogram is the diff between RAW Volume Pressures Convergence/Divergence minus Normalised ones (Signal) which helps as a confirmation.
Volume bars are by default plotted from RAW Volume Pressure algorithms, but they can be as well filtered with Karthik Marar's approach against a "Total Volume Average" in favor to clean day to day noise like HFT.
ALL NEW IDEAS OR MODIFICATIONS to these indicators are Welcome in favor to deploy a better and more accurate readings. I will be very glad to be notified at Twitter: @XeL_Arjona
Any important addition to this work MUST REMAIN PUBLIC by means of CreativeCommons CC & TradingView. -- 2015