The Relative Strength Volume-Adjusted Exponential Moving Average (RS VA EMA) is a technical indicator proposed by Vitali Apirine to help identify trends. Its calculation is similar to that of the original EMA, however, the multiplier used in the formula is adjusted for the relative strength of volume.
The strength of volume is calculated as the difference between positive and negative volume flows. Volume flow is positive when the specified price is higher than the prior price; it is negative when the specified price is lower than the prior price.
This is also a built-in ToS indicator: RS_VA_EMA
https://toslc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/R-S/RS-VA-EMA
https://www.tradingview.com/script/3aTtNsrv-TASC-2022-03-Relative-Strength-Volatility-Adjusted-EMA/
minor code fix, Bar Color, MTF - 08/2024
The strength of volume is calculated as the difference between positive and negative volume flows. Volume flow is positive when the specified price is higher than the prior price; it is negative when the specified price is lower than the prior price.
This is also a built-in ToS indicator: RS_VA_EMA
https://toslc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/R-S/RS-VA-EMA
https://www.tradingview.com/script/3aTtNsrv-TASC-2022-03-Relative-Strength-Volatility-Adjusted-EMA/
minor code fix, Bar Color, MTF - 08/2024
CSS:
# Indicator for TOS
#// TASC Issue: March 2022 - Vol. 40, Issue 3
#// Article: Relative Strength Moving Averages -
#// Part 3: The Relative Strength
#// Volatility-Adjusted
#// Exponential Moving Average
#// (RS VolatAdj EMA)
#// Article By: Vitali Apirine
#// Language: TradingView's Pine Script v5
#// Provided By: PineCoders, for tradingview.com
#indicator('TASC 2022.03 RS VolatAdj EMA', overlay = true)
# Converted by Sam4Cok@Samer800 - 08/2024
# minor code fix, Bar Color, MTF - 08/2024
input colorBars = yes;
input timeframe = AggregationPeriod.FIVE_MIN;
input vixSelection = "VIX"; # 'VIX Selection'
input movAvgType = AverageType.EXPONENTIAL;
input chartSource = FundamentalType.CLOSE; # 'Source'
input MovingAveragePeriod = 20; # 'EMA Period'
input VolatilityStrengthPeriod = 20; # 'Volatility Strength Period'
input Multiplier = 10.0; # 'Multiplier'
def na = Double.NaN;
def current = GetAggregationPeriod();
def tf = Max(current, timeframe);
def source = Fundamental(FundamentalType = chartSource, Period = tf);
#// Relative Strength Volatility-Adjusted EMA Function
Script rsvae {
input source = close;
input srcVIX = close;
input periodEMA = 20;
input periodVolatS = 20;
input multVolatS = 10;
def source1 = CompoundValue(1, if !source[1] then source else source[1], source);
def MULT = 2.0 / (max(1.0, periodEMA) + 1.0);
def ALPH = 2.0 / (max(1.0, periodVolatS) + 1.0);
def BETA = 1.0 - ALPH;
def volatUp = if source > source1 then srcVIX else 0.0;
def volatDn = if source < source1 then srcVIX else 0.0;
def volatUpEMA = volatUp * ALPH + if(volatUpEMA[1], volatUpEMA[1],volatUp) * BETA;
def volatDnEMA = volatDn * ALPH + if(volatDnEMA[1], volatDnEMA[1],volatDn) * BETA;
def VolatPer = AbsValue(volatUpEMA - volatDnEMA) / (volatUpEMA + volatDnEMA);
def VolatS = if isNaN(VolatPer) then 0 else VolatPer;
def rsVolatAdjEMA;
def rsVolatAdjEMA1 = if rsVolatAdjEMA[1] then rsVolatAdjEMA[1] else source;
def lastRSVAE = CompoundValue(1, rsVolatAdjEMA1, source);
rsVolatAdjEMA = lastRSVAE + (source - lastRSVAE) * MULT * (1.0 + VolatS * max(0.0, multVolatS));
plot out = rsVolatAdjEMA;
}
def VIXvalue = close(Symbol = vixSelection, Period = tf);
def srcVIX = if isNaN(VIXvalue) then srcVIX[1] else VIXvalue;
def RSvolatAdjEMA = rsvae(source, srcVIX, MovingAveragePeriod, VolatilityStrengthPeriod, Multiplier);
def MovAvg = MovingAverage(movAvgType, source, MovingAveragePeriod);
def MovAvgLine = MovAvg;
plot RSVAE = if RSvolatAdjEMA then RSvolatAdjEMA else na;
#-- cloud
AddCloud(RSVAE, MovAvgLine, Color.DARK_GREEN, Color.DARK_RED, yes);
#-- Bar Color.
def Col = RSVAE > MovAvgLine; # ? #FF8C0033 : #2096F233
AssignPriceColor(if !colorBars then Color.CURRENT else if Col then Color.GREEN else COlor.RED);
#--- END of CODE
Last edited: