Stochastic Distance Indicator [CC]The Stochastic Distance Indicator was created by Vitali Apirine (Stocks and Commodities Jun 2023 pgs 16-21), and this is a new method that measures the absolute distance between a price and its highest and lowest values over a long period. It uses the stochastic formula to create an oscillator using this distance value and smooths the value. Obviously, there is a lag in signals due to the lookback periods, but it does a good job of staying above the midline when the stock is in a strong uptrend and vice versa. Of course, I'm open to suggestions, but I'm deciding to create buy and sell signals based on comparing the unsmoothed and smoothed values. 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!
Vitaliapirine
TASC 2023.06 Stochastic Distance Oscillator█ OVERVIEW
This script implements the stochastic distance oscillator (SDO) , a momentum indicator introduced by Vitali Apirine in an article featured in TASC's June 2023 edition of Traders' Tips . The SDO is a variation of the classic stochastic oscillator and is designed to identify overbought and oversold levels, as well as detect bull and bear trend changes.
█ CONCEPTS
Unlike the classic stochastic oscillator, which compares an asset's price to its past price range, the SDO measures the size of the current distance relative to the maximum-minimum distance range over a set number of periods. The current distance is defined as the distance between the current price and the price n periods ago.
The readings of the SDO can be used to identify the following states of the asset price:
Uptrend state: the oscillator crosses over 50 from a non-uptrend state.
Downtrend state: the oscillator crosses under -50 from a non-downtrend state.
Overbought state: the oscillator is in an uptrend and crosses -50 for the first time.
Oversold state: the oscillator is in a downtrend and crosses 50 for the first time.
Trend continuity: the oscillator crosses 0 in the direction of the current trend.
The script indicates these five conditions using on-chart signals and background coloring.
█ CALCULATIONS
The SDO is calculated as follows:
1. Calculate the distance between the current price and the price n periods ago, as well as the maximum and minimum distances for the selected lookback period. The author recommends using one of two values of n , 14 or 40 bars.
2. Calculate the time series % D that represents the relation between the asset's current distance and its distance range over a loockback period:
% D = (Abs(current distance) − Abs(minimum distance)) / (Abs(maximum distance) − Abs(minimum distance)) * 100
3. Use the calculated % D to obtain the SDO:
If the closing price is above the close n periods ago, SDO = % D
If the closing price is below the close n periods ago, SDO = −% D
If the closing price equals the close n periods ago or the current distance equals the minimum distance, SDO = 0
4. Smooth the SDO using an exponential moving average (EMA). The author recommends using an EMA in the range from 3 to 6 .
Adjustable input parameters include the number of periods n , the lookback period for calculating % D , the smoothing EMA length, and the overbought/oversold threshold level.
True Range Adjusted Exponential Moving Average [CC]The True Range Adjusted Exponential Moving Average was created by Vitali Apirine (Stocks and Commodities Jan 2023 pgs 22-27) and this is the latest indicator in his EMA variation series. He has been tweaking the traditional EMA formula using various methods and this indicator of course uses the True Range indicator. The way that this indicator works is that it uses a stochastic of the True Range vs its highest and lowest values over a fixed length to create a multiple which increases as the True Range rises to its highest level and decreases as the True Range falls. This in turn will adjust the Ema to rise or fall depending on the underlying True Range. As with all of my indicators, I have color coded it to turn green when it detects a buy signal or turn red when it detects a sell signal. Darker colors mean it is a very strong signal and let me know if you find any settings that work well overall vs the default settings.
Let me know if you would like me to publish any other scripts that you recommend!
TASC 2023.01 TRAdj EMA█ OVERVIEW
TASC's January 2023 edition of Traders' Tips includes an article titled "True Range Adjusted Exponential Moving Average (TRadj EMA)" by Vitali Apirine. This code implements the indicator presented in that publication.
█ CONCEPTS
The True Range Adjusted Exponential Moving Average (TRAdj EMA) is a trend-following indicator that considers volatility for a quicker response to price changes. It is an EMA that modulates its weighting factor based on the true range (TR) of the asset.
In a trading strategy, traders can use a TRAdj EMA in tandem with an EMA of the same length to identify an asset's trend, or they can use it alongside another TRAdj EMA of a different length to identify turning points and filter price movements.
█ CALCULATIONS
The following steps are performed to calculate the indicator:
• Calculate the asset's TR according to the standard definition proposed by J. Welles Wilder, Jr.
• Define the true range adjustment factor as:
TRAdj =( Current TR − Minimum TR) ⁄ ( Maximum TR − Minimum TR ),
where Maximum TR and Minimum TR are the maximum and minimum TR values over the specified lookback period .
• Calculate the TRAdj EMA in the same manner as a traditional EMA, but with a weighting factor defined as:
2*(1 + TRAdj * Multiplier ) ⁄ ( EMA length + 1),
where Multiplier is an input parameter that ranges from 5 to 10. For comparison, a traditional EMA uses a weighting factor of 2 ⁄ ( EMA length + 1).
TASC 2022.10 RS VA EMA█ OVERVIEW
TASC's October 2022 edition Traders' Tips includes the second part of the "Relative Strength Moving Averages" article series authored by Vitali Apirine. This is the code that implements the Relative Strength Volume-Adjusted Exponential Moving Average (RS VA EMA) presented in this publication.
█ CONCEPTS
In his article series, the author argues that the relative strength of price, volume, and volatility can potentially be used to filter price movements and define turning points. In particular, the RS VA EMA indicator is designed to account for the relative strength of volume. Like the traditional exponential moving average (EMA) , it is a lagging trend-following indicator. The difference is that it responds more quickly.
In a trading strategy, RS VA EMA is suggested to be used in combination with EMA of the same length to determine the overall trend or in combination with RS VA EMA of a different length to identify turning points and filter price movements.
█ CALCULATIONS
The calculation of RS VA EMA is based on the concept of volume strength (VS). By definition, VS measures the difference between "positive" and "negative" volume flow. Volume is indicated as "positive" when the close is higher than the previous close and "negative" when the close is below the previous close.
The following steps are used in the calculation process:
• Calculate the volume strength (VS) of a given length.
• Multiply VS by a predefined multiplier and calculate the EMA of the resulting time series.
The values of 10,10,10 are the typical input settings for RS VA EMA, where the first parameter is the length of the moving average, the second is the length of VS, and the third is the volume strength multiplier.
TASC 2022.09 LRAdj EMA█ OVERVIEW
TASC's September 2022 edition of Traders' Tips includes an article by Vitali Apirine titled "The Linear Regression-Adjusted Exponential Moving Average". This script implements the titular indicator presented in this article.
█ CONCEPT
The Linear Regression-Adjusted Exponential Moving Average (LRAdj EMA) is a new tool that combines a linear regression indicator with exponential moving averages . First, the indicator accounts for the linear regression deviation, that is, the distance between the price and the linear regression indicator. Subsequently, an exponential moving average (EMA) smooths the price data and and provides an indication of the current direction.
As part of a trading system, LRAdj EMA can be used in conjunction with an exponential moving average of the same length to identify the overall trend. Alternatively, using LRAdj EMAs of different lengths together can help identify turning points.
█ CALCULATION
The script uses the following input parameters:
EMA Length
LR Lookback Period
Multiplier
The calculation of LRAdj EMA is carried out as follows:
Current LRAdj EMA = Prior LRAdj EMA + MLTP × (1+ LRAdj × Multiplier ) × ( Price − Prior LRAdj EMA ),
where MLTP is a weighting multiplier defined as MLTP = 2 ⁄ ( EMA Length + 1), and LRAdj is the linear regression adjustment (LRAdj) multiplier:
LRAdj = (Abs( Current LR Dist )−Abs( Minimum LR Dist )) ⁄ (Abs( Maximum LR Dist )−Abs( Minimum LR Dist ))
When calculating the LRAdj multiplier, the absolute values of the following quantities are used:
Current LR Dist is the distance between the current close and the linear regression indicator with a length determined by the LR Lookback Period parameter,
Minimum LR Dist is the minimum distance between the close and the linear regression indicator for the LR lookback period ,
Maximum LR Dist is the maximum distance between the close and the linear regression indicator for the LR lookback period .
Relative Strength Super Smoother by lastguruA better version of Apirine's RS EMA by using a superior MA: Ehlers Super Smoother.
In January 2022 edition of TASC Vitaly Apirine introduced his Relative Strength Exponential Moving Average. A concept not entirely new, as Tushar Chande used a similar calculation for his VIDYA moving average. Both are based on the idea to change EMA length depending on the absolute RSI value, so the moving average would speed up then RSI is going up or down from the center value (when there is a significant directional price movement), and slow down when RSI returns to the center value (when there is a neutral or sideways movement). That way EMA responsiveness would increase where it matters most, but decrease where there is a high probability of whipsaw.
There are only two main differences between VIDYA and RS EMA:
RSI internal smoothing - VIDYA uses SMA, as Chande's CMO is an RSI with SMA; RS EMA uses EMA
Change direction - VIDYA sets the fastest length; RS EMA sets the slowest length
Both algorithms use EMA as the base of their calculation. As John F. Ehlers has shown in his article "Predictive and Successful Indicators" (January 2014 issue of TASC), EMA is not a very efficient filter, as it introduces a significant lag if sufficient smoothing is required. He describes a new smoothing filter called SuperSmoother, "that sharply attenuates aliasing noise while minimizing filtering lag." In other words, it provides better smoothing with lower lag than EMA.
In this script, I try to get the best of all these approaches and present to you Relative Strength Super Smoother. It uses RS EMA algorithm to calculate the SuperSmoother length. Unlike the original RS EMA algorithm, that has an abstract "multiplier" setting to scale the period variance (without this parameter, RSI would only allow it to speed up twice; Vitaly Apirine sets the multiplier to 10 by default), my implementation has explicit lower bound setting, so you can specify the exact range of calculated length.
Settings:
Lower Bound - fastest SuperSmoother length (when RSI is +100 or -100)
Upper Bound - slowest SuperSmoother length (when RSI is 0)
RSI Length - underlying RSI length. Unlike the original RSI that uses RMA as an internal smoothing algorithm, Vitaly Apirine uses EMA, which is approximately twice as fast (that is needed because he uses a generally long RSI length and RMA would be too slow for this). It is the same as the Upper Bound by default (0), as in the original implementation
The original RS EMA is also shown on the chart for comparison. The default multiplier of 10 for RS EMA means that the fastest EMA period is around 4. I use the fastest period of 8 by default. It does not introduce too much of a lag in comparison, but the curve is much smoother.
This script is just an interface for my public libraries. Check them out for more information.
TASC 2022.05 Relative Strength Exponential Moving Average█ OVERVIEW
TASC's May 2022 edition Traders' Tips includes the "Relative Strength Moving Averages" article authored by Vitali Apirine. This is the code implementing the Relative Strength Exponential Moving Average (RS EMA) indicator introduced in this publication.
█ CONCEPTS
RS EMA is an adaptive trend-following indicator with reduced lag characteristics. By design, this was made possible by harnessing the relative strength of price. It operates in a similar fashion to a traditional EMA, but it has an improved response to price fluctuations. In a trading strategy, RS EMA can be used in conjunction with an EMA of the same length to identify the overall trend (see the preview chart). Alternatively, RS EMAs with different lengths can define turning points and filter price movements.
RS EMA is an adaptive trend-following indicator with reduced lag characteristics. By design, this was made possible by harnessing the relative strength of price. It operates in a similar fashion to a traditional EMA, but it has an improved response to price fluctuations.
█ CALCULATIONS
The following steps are used in the calculation process:
• Calculate the relative strength (RS) of a given length.
• Multiply RS by a chosen coefficient (multiplier) to adapt the EMA filtering the original time series. Calculate the EMA of the resulting time series.
The author recommends RS EMA(10,10,10) as typical settings, where the first parameter is the EMA length, the second parameter is the RS length, and the third parameter is the RS multiplier. Other values may be substituted depending on your trading style and goals.
Relative Strength Volatility Adjusted Ema [CC]The Relative Strength Volatility Adjusted Exponential Moving Average was created by Vitali Apirine (Stocks and Commodities Mar 2022) and this is his final indicator of his recent Relative Strength series. I published both of the previous indicators, Relative Strength Volume Adjusted Exponential Moving Average and Relative Strength Exponential Moving Average
This indicator is particularly unique because it uses the Volatility Index (VIX) symbol as the default to determine volatility and uses this in place of the current stock's price into a typical relative strength calculation. As you can see in the chart, it follows the price much closer than the other two indicators and so of course this means that this indicator is best for choppy markets and the other two are better for trending markets. I would of course recommend to experiment with this one and see what works best for you.
I have included strong buy and sell signals in addition to normal ones so strong signals are darker in color and normal signals are lighter in color. Buy when the line turns green and sell when it turns red.
Let me know if there are any other indicators or scripts you would like to see me publish!
Relative Strength Volume Adjusted Exponential Moving Avg [CC]The Relative Strength Volume Adjusted Exponential Moving Average was created by Vitali Apirine (Stocks and Commodities Feb 2022 pgs 14-18) and this is very similar of course to the last Relative Strength Exponential Moving Average . It works under the same concept with using overbought and oversold methods to adjust the moving average and with this particular version you will notice that sudden drops or increases won't follow super closely so this can be useful along with the other as a good complementary indicator to use with each other to determine the short and medium term trend and to give good entry and exit points. I have strong buy and sell signals in addition to normal ones so darker colors are strong and lighter colors are normal. Buy when the indicator line turns green and sell when it turns red.
Let me know if there are any other indicators or scripts you would like to see me publish!
Relative Strength Exponential Moving Average [CC]The Relative Strength Exponential Moving Average was created by Vitali Apirine (Stocks and Commodities Jan 2022 pgs 22-25) and this is a handy moving average that combines a typical overbought/oversold mechanic with an overall trend indicator. Even though the typical length is so large it reacts extremely quickly when the stock becomes overbought or oversold. Because of this the indicator by itself doesn't work as well during choppy periods so Vitali recommends using a moving average crossover system during choppy so do one indicator with the default length of 50 and use a different length of 10 so when the shorter length crosses over the longer length then buy and vice versa you would sell. Generally speaking buy when the line turns green and sell when it turns red. I have used strong buy and sell signals in addition to normal signals so strong signals are darker in color and normal signals are lighter in color.
Let me know if there are any other scripts or indicators you would like me to publish!
Moving Average Band Width [CC]The Moving Average Band Width was created by Vitali Apirine (Stocks and Commodities Aug 2021 pg 25) and this is of course an extension based on my previous Moving Average Bands script. For those of you that aren't aware, the Band Width indicator is an indicator that tells you how close the upper and lower bands are to each other which is a great determination of how volatility is increasing or decreasing. This acts as both a trend indicator and a volatility indicator. I have included strong buy and sell signals in addition to normal ones so stronger signals are darker in color and normal ones are lighter. A great buy signal is when you are in an uptrend (so the line is green already) and the indicator line is moving up which means strong underlying volatility.
Let me know if there are any other indicators or scripts you would like to see me publish!
Moving Average Bands [CC]The Moving Average Bands were created by Vitali Apirine (Stocks and Commodities July 2021 pg 16) and this is a very handy trend following indicator that will give you the overall trend of the underlying stock. As the bands rise then the stock is in an uptrend and as they fall then it is a downtrend. If the bands stay flat then it is a sideways and/or choppy market. I did change the middle band from what he originally authored because I believe this gives more accurate buy and sell signals so keep that in mind. Feel free to use a different moving average than the original exponential moving average in the formula. As always buy when the indicator lines turn green and sell when they turn red.
Let me know if there are any other indicators you would like to see me publish!
Compare Price Momentum Oscillator [CC]The Compare Price Momentum Oscillator was created by Vitali Apirine (Stocks and Commodities Aug 2020 pg 16) and this is a handy indicator to compare the momentum of the current symbol you are looking at to the s&p to determine the relative strength of the underlying security. Buy when the line turns green and sell when it turns red.
Let me know if there are any other scripts you would like to see me publish!
[blackcat] L1 Vitali Apirine Rate Of Change With BandsLevel: 1
Background
Vitali Apirine introuced this RoC indicator of “Rate Of Change With Bands” on March 2021.
Function
In Vitali Apirine's article “Rate Of Change With Bands” , the author introduces a concept of identifying overbought and oversold levels based on calculating standard deviation bands of the rate of change (ROC) momentum oscillator. The rate of change bands widen and narrow as the ROC deviation increases and decreases. The author proposes using this indicator in conjunction with other technical analysis methods to determine if the instrument is overbought or oversold.
Key Signal
UpperBand --> overbought threshold
oMARoc --> Output RoC Moving Average
LowerBand --> oversold threshold
Labels
L --> Long
S --> Short
XL --> Close Long
XS --> Close Short
Pros and Cons
100% Vitali Apirine definition translation, even variable names are the same. This help readers who would like to use pine to read his article.
Remarks
The 1st script for Blackcat1402 Vitali Apirine series publication.
Readme
In real life, I am a prolific inventor. I have successfully applied for more than 60 international and regional patents in the past 12 years. But in the past two years or so, I have tried to transfer my creativity to the development of trading strategies. Tradingview is the ideal platform for me. I am selecting and contributing some of the hundreds of scripts to publish in Tradingview community. Welcome everyone to interact with me to discuss these interesting pine scripts.
The scripts posted are categorized into 5 levels according to my efforts or manhours put into these works.
Level 1 : interesting script snippets or distinctive improvement from classic indicators or strategy. Level 1 scripts can usually appear in more complex indicators as a function module or element.
Level 2 : composite indicator/strategy. By selecting or combining several independent or dependent functions or sub indicators in proper way, the composite script exhibits a resonance phenomenon which can filter out noise or fake trading signal to enhance trading confidence level.
Level 3 : comprehensive indicator/strategy. They are simple trading systems based on my strategies. They are commonly containing several or all of entry signal, close signal, stop loss, take profit, re-entry, risk management, and position sizing techniques. Even some interesting fundamental and mass psychological aspects are incorporated.
Level 4 : script snippets or functions that do not disclose source code. Interesting element that can reveal market laws and work as raw material for indicators and strategies. If you find Level 1~2 scripts are helpful, Level 4 is a private version that took me far more efforts to develop.
Level 5 : indicator/strategy that do not disclose source code. private version of Level 3 script with my accumulated script processing skills or a large number of custom functions. I had a private function library built in past two years. Level 5 scripts use many of them to achieve private trading strategy.