Z-Score 'Bollinger Bands'The following script is an application of the Z-Score (previous script).
Z-Scores can be used in place of standard deviation (sigma) in 'Bollinger Bands'.
The average of the sample (x-bar) over 21 days (N)
21 average trading days per month, fixed value
The average of the population (mu) over 63 days (n)
63 days per quarter, default is set to 63
Z-Score is calculated by formula in previous script, and the absolute value is taken of "Z".
Z-High = absolute value of Z + (x-bar).
Z-Low = absolute value of Z - (x-bar).
Will update with Z from mu and Z from avg (working on UX and visualization details).
Score
Z-Score The z-score is a way of counting the number of standard deviations between a given data value and the mean of the data set.
Z-score = (x̄ - μ) / (σ / √ n)
x̄ = sample mean (using the array.avg function = array(a,close ), where i = 1 to 21)
μ = population mean ( = avg(close, n))
σ = standard deviation of the population ( = stdev(close,n))
n = number of 'close' or trading day closes
n = input
... Note: The previous indicator is part of a larger series of indicators
Z-SCORE Currency Strength Indicator by Lukas"you must have" indicator if you trade Forex major pairs.
So far this is the most reliable script i have for trade forex pairs.
This indicator will give us information of momentum, strength and cycle.
What i like about Z-SCORE, it's calculate price and volume.
Setting :
1. Set Color 0 and Color 2 into thick line, it will give you strength information.
The strength information is base on cumulative Currency price Vs. 7 others currency,
When Source Price above EMA and Above LWMA "Color 0" active, above EMA "Color 2" active, below EMA "Color 1" active
so it's important to set the thickness.
2. You can set EMA length as thickness filter
3. You can set Signal line between EMA and LWMA
EMA = smoother
LWMA = reactive
Strong currency signal when Color 0 active and they are on upward movement, crossing -80 or above 0
Weak Color 1 active and they are on downward movement, crossing 80 or below 0
Trade Strong Vs. Weak
Any feedback are welcome.
Hope it useful!
I also have unpublished OBV and smooth RSI indicator,
OBV can give you earlier bull/bear sign, let me know if you are interested~
Thank you.
Z-HistogramIt is possible to approximate the underlying distribution of a random variable by using what is called an "Histogram". In order to construct an histogram one must first split the data into several intervals (also called bins) often of the same size and count the number of values falling within each intervals, the histogram plot is then constructed with the X axis representing the measured variable and the Y axis representing the frequency.
The proposed script aim to estimate the underlying distribution of a rolling z-score by constructing its histogram, here the histogram consist of 13 bins of width 0.5 rolling standard deviations. The length setting define the rolling z-score period, the window setting define the number of past data to be counted, finally using the "Total" option (true by default) will count all the rolling z-scores values since the first bar, in order to use the window setting make sure to uncheck the "Total" option.
DISPLAY
In order to see the entirety of the histogram make sure to double click on the indicator window and to have all the lower panels (text notes, pine editor...etc) hidden, finally make sure to zoom-in in order to see the frequency numbers displayed.
Z-Histogram on BTCUSD 15 min TF, the blue bins represent intervals situated over 0 while red bins represent intervals situated under 0. Here σ represent the X-axis in standard deviations, the histogram start with a bin situated at σ = -3 which count the number of times the rolling z-score was within -3 and -2.5, the histogram end with the bin situated at σ = 3 which count the number of time the rolling z-score was within 3 and 3.5.
It is also possible to look at the shape of the histogram without having the indicator window at full size.
INTERPREATION
An histogram can give really interesting information such as overall trend direction and strength. The direction can be measured by looking at the skewness of the histogram, with a negative skewness (the peak of the histogram situated at the right from the center) representing down-trending variations and positive skewness (the peak of the histogram situated at the left from the center) representing up-trending variations, while a symmetrical histogram could represent a ranging market. The farther away the peak of the histogram is situated from the center, the stronger the trend.
Another interesting characteristic is the tailedness of the histogram, which can give information about the cleanliness of the trend, for example a positive skew and high tailedness would represent a clean up-trend, as it could suggest less variations contrary to the main trend.
An histogram applied to the rolling z-score can give various useful information. As a recall the rolling z-score of the price measure the distance between the closing price and its moving average in term of rolling standard deviations, for example if the rolling z-score is equal to 2 it means that the closing price is currently 2 rolling standard deviations over its moving average.
Lets for example analyze the histogram using INTC 15 min tf with a window of 456 bars and rolling z-score of length = 100 in order to review longer term variations.
We can see from the histogram that the uptrend visible on the chart is represented by the bins situated over 0 having an overall higher frequency than the bins under 0, we can see that the closing price tended to stay between 1 and 1.5 rolling standard deviations over its period 100 moving average. Here bins under 0 accounts for retracements in the trend.
IN SUMMARY
An histogram can give various information regarding the price evolution of a security, the proposed script aim to plot the histogram of a rolling z-score. Now this script might not be too useful but it was fun to make, also it does not mean that an histogram is not an useful tool in the context of trading, the only thing required is a god implementation of it (like volume profiles for example)
In this post we have also reviewed some important statistical concepts such as distributions, z-score, skewness and tailedness, each being extremely important in the quantitative trading field.
Thx for reading !
Z Score Enhanced Time Segmented Volume (Multi MA)**THIS VERSION HAS BEEN STANDARDIZED WITH A Z SCORE CALCULATION AND ALLOWS THE USER TO SELECT WHICH MOVING AVERAGE THEY WOULD LIKE TO UTILIZE FOR THE SIGNAL LINE**
Chart shows the Non-Standardized Enhanced Time Segmented Volume (Multi MA) with default settings on top and the Standardized version with default settings on the bottom.
Time Segmented Volume was developed by Worden Brothers, Inc to be a leading indicator by comparing various time segments of both price and volume . Essentialy it is designed to measure the amount of money flowing in and out of an instrument.
Time Segmented Volume was originally ported to TradingView by user @liw0 and later corrected by user @vitelot. I never quite understood how to read Time Segmented Volume until I ran across a version by user @storma where they indicated when price would be long or short, but that code also utilized the incorrect calculation from user @liw0.
In an effort to make Time Segmented Volume more accessible and easier to read, I have re-coded it here. The calculations are based on the code from @vitelot and I have added direction indicators below the chart.
If the histogram (TSV) is greater than zero and greater than the moving average, price should be moving long and there will be a green box below the chart.
If TSV falls below the moving average while still being greater than zero, the trend may be exhausting and has been coded to read Price Action Long - FAILURE with a black x below the chart.
If the histogram (TSV) is less than zero and less than the moving average, price should be moving short and there will be a red box below the chart.
If TSV rises above the moving average while still being less than zero, the trend may be exhausting and has been coded to read Price Action Short - FAILURE with a black x below the chart.
At times, the moving average may be above zero while TSV is below zero or vice versa. In these situations the chart will indicate long or short based on whether or not TSV is greater or less than zero. It is possible a new trend may be forming as the moving average obviously lags, but also possible price is consolidating with little volume and causing TSV to oscillate close to zero.
**Z Score // Standardized Option **
Thist Standardized code implements all of the above but also allows the user to select a threshold level that should not need to be adjusted for each instrument (since the output is standardized).
If the TSV value meets the long and short signal requirements above and TSV is greater than the threshold values a green or red box will print ABOVE the oscillator. The histogram will also change color based on which threshold TSV has met.
This calculation allows us to compare current volatility to the mean (moving average) of the population (Z-Length). The closer the TSV Z-Score is to the mean, the closer it will be to the Zero Line and therefore price is likely consolidating and choppy. The farther TSV Z-Score is from the mean, the more likely price is trending.
The MA Mode determines the Moving Average used to calculate TSV itself. The Z-Score is ALWAYS calculated with a simple moving average (as that is the standard calculation for Z-Score).
The Threshold Levels are the levels at which TSV Z-Score will change from gray to yellow, orange, green ( bullish ), or red ( bearish ).
Statistically speaking, confidence levels in relation to Z-Score are noted below. The built in Threshold Levels are the positive and negative values for 90%, 95%, and 99%. This would indicate when volatility is greater than these values they are out of the ordinary from the standard range. You may wish to adjust these levels for TSV Z-Score to be more responsive to your trading needs
80% :: 1.28
85% :: 1.44
90% :: 1.64
95% :: 1.96
99% :: 2.58
The Z Length is the period for which the Z Score is calculated
More information regarding Time Segmented Volume can be found here: www.worden.com
Original code ported by @liw0
Corrected by @vitelot
Updated/Enhancements by @eylwithsteph with inspiration from @storma
Multiple MA Options Credits to @Fractured and @lejmer
Bits and Pieces from @AlexGrover, @Montyjus, and @Jiehonglim
As always, trade at your own risk.
5 Minute TraderBy request, this is an amalgamation of my most popular indicator features but tailored for lower timeframes.
Signals are generated by simple EMA crosses (with adjustable values) in the direction of the current trend and then validated against a scoring system that's comprised of 20 other indicators. When the majority of them agree then the trade can be taken. The tolerance score that permits a trade can be adjusted within the indicator preference panel and the values can be printed above/below the candle to help you tune your entry points.
To further reassure you, the smoothed candle direction from the 4 hour chart is printed in the background to validate the trend direction and a floating trade helper panel translates the scores in to practical terms (buy, sell etc)
Alerts are built in.
Note: This is a premium script. Please DM me for access.
WhipLashThis is a study to determine if small candle bodies (little difference between open and close), regardless of overall candle length (high/low), can be used to filter choppy markets.
The indicator will calculate the selected average "MA Mode" of (close-open). To standardize this result and ensure any filters/thresholds do not need to be recalculated for each instrument the result will be used to calculate the Z Score.
The idea is that when candle bodies are small there is very little actual price movement, and therefore price is choppy. When considering the Z Score of that result, any outliers ie larger candle bodies, could show a potential trend forming. This indicator is similar to QStick but allows more customization by the user.
MA Mode determines which MA is used to smooth the results of (close-open)
Price Smoothing is the number of running periods the MA Mode is calculated for.
The three Thresholds are preset to the 90%, 95%, and 99% levels for Z Score. If these thresholds are altered you may wish to also alter the horizontal lines programmed for each level on the positive and negative sides.
The Z Length is the period for which the Z Score is calculated
Multiple MA Options Credits to @Fractured
Bits and Pieces from @AlexGrover, @Montyjus, and @Jiehonglim
As always, trade at your own risk.
VQZL Z-ScoreVolatility Qaulity Zero Line attempts to keep a trader out of ranging markets, but the original calculation on TradingView had to be adjusted for each instrument. To avoid this issue, I have applied a z-score calculation to the VQZL so the result is standardized for all instruments. A Z-Score is simply a value's relationship to the mean (average) of a group of values, measured in terms of standard deviations from the mean.
This calculation allows us to compare current volatility to the mean (moving average) of the population (Z-Length). The closer the VQZL Z-Score is to the mean, the closer it will be to the Zero Line and therefore price is likely consolidating and choppy. The farther VQZL Z-Score is from the mean, the more likely price is trending.
The MA Mode determines the Moving Average used to calculate VQZL itself. The Z-Score is ALWAYS calculated with a simple moving average (as that is the standard calculation for Z-Score).
The Threshold Levels are the levels at which VQZL Z-Score will change from gray to yellow, orange, green (bullish), or red (bearish). These levels can be adjusted but you should adjust the Threshold Lines as well (in the style section), so they line up with your adjusted values.
Statistically speaking, confidence levels in relation to Z-Score are noted below. The built in Threshold Levels are the positive and negative values for 90%, 95%, and 99%. This would indicate when volatility is greater than these values they are out of the ordinary from the standard range. You may wish to adjust these levels for VQZL Z-Score to be more responsive to your trading need
80% :: 1.28
85% :: 1.44
90% :: 1.64
95% :: 1.96
99% :: 2.58
As always, trade at your own risk.
VQZL Created by Investo And Adapted From @sarangab
Multiple MA Options Credits to @Fractured
Bits and Pieces from @AlexGrover and @Montyjus
TD Moon Cycle Standard Deviation Z Score AlertsHas alerts for the TD 9 function, also the black is Z score and blue is STD Dev
Also the moon functionality of Ichimoonku is built into this as well because sometimes I just want to see the cycles of moon with TD9 ; see that script (Ichimoonku) for more info on moon functionality.
Much love
Enjoy
GL HF
xoxo
Snoop
Inverse Fisher Fast Z-scoreIntroduction
The fast z-score is a modification of the classic z-score that allow for smoother and faster results by using two least squares moving averages, however oscillators of this kind can be hard to read and modifying its shape to allow a better interpretation can be an interesting thing to do.
The Indicator
I already talked about the fisher transform, this statistical transform is originally applied to the correlation coefficient, the normal transform allow to get a result similar to a smooth z-score if applied to the correlation coefficient, the inverse transform allow to take the z-score and rescale it in a range of (1,-1), therefore the inverse fisher transform of the fast z-score can rescale it in a range of (1,-1).
inverse = (exp(k*fz) - 1)/(exp(k*fz) + 1)
Here k will control the squareness of the output, an higher k will return heavy side step shapes while a lower k will preserve the smoothness of the output.
Conclusion
The fisher transform sure is useful to kinda filter visual information, it also allow to draw levels since the rescaling is in a specific range, i encourage you to use it.
Notes
During those almost 2 weeks i was even lazier and sadder than ever before, so i think its no use to leave, i also have papers to publish and i need tv for that.
Thanks for reading !
Fast Z-ScoreIntroduction
The ability of the least squares moving average to provide a great low lag filter is something i always liked, however the least squares moving average can have other uses, one of them is using it with the z-score to provide a fast smoothing oscillator.
The Indicator
The indicator aim to provide fast and smooth results. length control the smoothness.
The calculation is inspired from my sample correlation coefficient estimation described here
Instead of using the difference between a moving average of period length/2 and a moving average of period length , we use the difference between a lsma of period length/2 and a lsma of period length , this difference is then divided by the standard deviation. All those calculations use the price smoothed by a moving average as source.
The yellow version don't divide the difference by a standard deviation, you can that it is less reactive. Both version have length = 200
Conclusion
I presented a smooth and responsive version of a z-score, the result could be used to estimate an even faster lsma by using the line rescaling technique and our indicator as correlation coefficient.
Hope you like it, feel free to modify it and share your results ! :)
Notes
I have been requested a lot of indicators lately, from mt4 translations to more complex time series analysis methods, this accumulation of work made that it is impossible for me to publish those within a short period of time, also some are really complex. I apologize in advance for the inconvenience, i will try to do my best !
Trend Score by KIVANÇ fr3762Trend Score compares close prices between last close with previous closes by a certain period of time.
It's like momentum but gives a score +1 when close price is equal to or above (defaultly) 10 bars ago and gives a score of -1 when below.
calculation continues from default length to the 2 times of length.
Defaultly (for 10 bars length)
If Trend Score converges to 10; that means there's a strong uptrend
conversely if Trend Score converges to -10; that means a strong downtrend market is on.
Z-Score Strategy Backtest The author of this indicator is Veronique Valcu. The z-score (z) for a data
item x measures the distance (in standard deviations StdDev) and direction
of the item from its mean (U):
z = (x-StdDev) / U
A value of zero indicates that the data item x is equal to the mean U, while
positive or negative values show that the data item is above (x>U) or below
(x Values of +2 and -2 show that the data item is two standard deviations
above or below the chosen mean, respectively, and over 95.5% of all data
items are contained within these two horizontal references (see Figure 1).
We substitute x with the closing price C, the mean U with simple moving
average (SMA) of n periods (n), and StdDev with the standard deviation of
closing prices for n periods, the above formula becomes:
Z_score = (C - SMA(n)) / StdDev(C,n)
The z-score indicator is not new, but its use can be seen as a supplement to
Bollinger bands. It offers a simple way to assess the position of the price
vis-a-vis its resistance and support levels expressed by the Bollinger Bands.
In addition, crossings of z-score averages may signal the start or the end of
a tradable trend. Traders may take a step further and look for stronger signals
by identifying common crossing points of z-score, its average, and average of average.
You can change long to short in the Input Settings
Please, use it only for learning or paper trading. Do not for real trading.
MAC-Z Indicator [LazyBear]This indicator is a composite of MACD and Z-Score (requested by @ChartAt). The general idea is that counter-trend component of the Z-score is used to adjust/improve the trend component of the MACD. The advantage is that it is a more accurate and “assumption-free” and can more accurately describe how a market or stock actually works in a given time frame.
I have also added support to smooth out the MAC-Z using Laguerre filter (Thanks @TheLark for the excellent LMA). Note that smoothing removes the "noise" component additive of Z-Score, so you may miss some good signals. By default Laguerre smoothing is OFF, I suggest playing with the Gamma to see if you can find a proper trade-off value.
Theme credits --> @liw0
More info:
cssanalytics.wordpress.com
Z-Score The author of this indicator is Veronique Valcu. The z-score (z) for a data
item x measures the distance (in standard deviations StdDev) and direction
of the item from its mean (U):
z = (x-StdDev) / U
A value of zero indicates that the data item x is equal to the mean U, while
positive or negative values show that the data item is above (x>U) or below
(x Values of +2 and -2 show that the data item is two standard deviations
above or below the chosen mean, respectively, and over 95.5% of all data
items are contained within these two horizontal references (see Figure 1).
We substitute x with the closing price C, the mean U with simple moving
average (SMA) of n periods (n), and StdDev with the standard deviation of
closing prices for n periods, the above formula becomes:
Z_score = (C - SMA(n)) / StdDev(C,n)
The z-score indicator is not new, but its use can be seen as a supplement to
Bollinger bands. It offers a simple way to assess the position of the price
vis-a-vis its resistance and support levels expressed by the Bollinger Bands.
In addition, crossings of z-score averages may signal the start or the end of
a tradable trend. Traders may take a step further and look for stronger signals
by identifying common crossing points of z-score, its average, and average of average.