Dynamic Momentum Range Index (DMRI)//@version=5
indicator("Dynamic Momentum Range Index (DMRI)", shorttitle="DMRI", overlay=false)
// Inputs
n = input.int(14, title="Momentum Period", minval=1)
atrLength = input.int(14, title="ATR Length", minval=1)
maLength = input.int(20, title="Moving Average Length", minval=1)
// Calculations
pm = close - close // Price Momentum (PM)
atr = ta.atr(atrLength) // Average True Range (ATR)
va = pm / atr // Volatility Adjustment (VA)
// Moving Average and Dynamic Range Factor (DRF)
ma = ta.sma(close, maLength)
drf = math.abs(close - ma) / atr
// Dynamic Momentum Range Index (DMRI)
dmri = va * drf
// Normalization
maxVal = ta.highest(dmri, atrLength)
minVal = ta.lowest(dmri, atrLength)
dmriNormalized = (dmri - minVal) / (maxVal - minVal) * 100
// Zones for Interpretation
bullishZone = 70
bearishZone = 30
// Plotting DMRI
plot(dmriNormalized, title="DMRI", color=color.blue, linewidth=2)
hline(70, "Overbought", color=color.red)
hline(30, "Oversold", color=color.green)
hline(50, "Neutral", color=color.gray)
// Background Coloring
bgcolor(dmriNormalized > bullishZone ? color.new(color.green, 90) : na, title="Bullish Zone Highlight")
bgcolor(dmriNormalized < bearishZone ? color.new(color.red, 90) : na, title="Bearish Zone Highlight")
Volatilityadjusted
Dynamic Momentum Range Index (DMRI)//@version=5
indicator("Dynamic Momentum Range Index (DMRI)", shorttitle="DMRI", overlay=false)
// Inputs
n = input.int(14, title="Momentum Period", minval=1)
atrLength = input.int(14, title="ATR Length", minval=1)
maLength = input.int(20, title="Moving Average Length", minval=1)
// Calculations
pm = close - close // Price Momentum (PM)
atr = ta.atr(atrLength) // Average True Range (ATR)
va = pm / atr // Volatility Adjustment (VA)
// Moving Average and Dynamic Range Factor (DRF)
ma = ta.sma(close, maLength)
drf = math.abs(close - ma) / atr
// Dynamic Momentum Range Index (DMRI)
dmri = va * drf
// Normalization
maxVal = ta.highest(dmri, atrLength)
minVal = ta.lowest(dmri, atrLength)
dmriNormalized = (dmri - minVal) / (maxVal - minVal) * 100
// Zones for Interpretation
bullishZone = 70
bearishZone = 30
// Plotting DMRI
plot(dmriNormalized, title="DMRI", color=color.blue, linewidth=2)
hline(70, "Overbought", color=color.red)
hline(30, "Oversold", color=color.green)
hline(50, "Neutral", color=color.gray)
// Background Coloring
bgcolor(dmriNormalized > bullishZone ? color.new(color.green, 90) : na, title="Bullish Zone Highlight")
bgcolor(dmriNormalized < bearishZone ? color.new(color.red, 90) : na, title="Bearish Zone Highlight")
Dynamic RSI Mean Reversion StrategyDynamic RSI Mean Reversion Strategy
Overview:
This strategy uses an RSI with ATR-Adjusted OB/OS levels in order to enhance the quality of it's mean reversion trades. It also incorporates a form of trend filtering in an effort to minimize downside and maximize upside. The backtest has fewer trades, as it uses substantial filtering to enhance trade quality. As you can see, I didn't cherry pick the results, so the results aren't the most beautiful thing you'll see in your life. I did this to ensure nobody gets misled. If you need a higher frequency of trades, consider removing the trend filter or increasing the length of the EMAs used for trend detection.
Features:
Dynamic OB/OS Levels: Uses ATR to adjust overbought and oversold thresholds dynamically, making the RSI more responsive in varying volatility conditions. This approach enhances signal strength by expanding the RSI range in high volatility and tightening it in low volatility.
Mean Reversion Focus: Designed for mean reversion but incorporates a trend-following filter to reduce countertrend trades. When the RSI is high, it often indicates an uptrend, so a trend filter prevents shorting in these cases and the same goes for downtrends and longing.
Trend Filtering: A moving average cross trend filter checks for the trend direction, with the RSI signal line color-coded to reflect trend shifts. Entries occur when the RSI crosses above or below the dynamic thresholds and is not a countertrend trade.
Stop Losses: Stop losses are set based on ATR distance from the entry price, providing volatility-adjusted protection.
Note:
If you're using this strategy on assets with a higher price, remember to increase the initial capital in the strategy settings. Otherwise, the strategy won't generate any (or many) trades and you'll end up with some inaccurate results.
Recommended Use:
Test it on different assets and timeframes. I’ve found the best results with standard RSI inputs, a relatively slow ATR, and a slower MA cross for trend filtering. Thus, the defaults are set that way. If the trend metrics are too slow, you’ll filter out too many good trades while allowing crummy ones; if too fast, most trades may be filtered out. As always, this has a lot of configurability so experiment to find the balance that works for your trading style.
ATR Adjusted RSIATR Adjusted RSI Indicator
By Nathan Farmer
The ATR Adjusted RSI Indicator is a versatile indicator designed primarily for trend-following strategies, while also offering configurations for overbought/oversold (OB/OS) signals, making it suitable for mean-reversion setups. This tool combines the classic Relative Strength Index (RSI) with a unique Average True Range (ATR)-based smoothing mechanism, allowing traders to adjust their RSI signals according to market volatility for more reliable entries and exits.
Key Features:
ATR Weighted RSI:
At the core of this indicator is the ATR-adjusted RSI line, where the RSI is smoothed based on volatility (measured by the ATR). When volatility increases, the smoothing effect intensifies, resulting in a more stable and reliable RSI reading. This makes the indicator more responsive to market conditions, which is especially useful in trend-following systems.
Multiple Signal Types:
This indicator offers a variety of signal-generation methods, adaptable to different market environments and trading preferences:
RSI MA Crossovers: Generates signals when the RSI crosses above or below its moving average, with the flexibility to choose between different moving average types (SMA, EMA, WMA, etc.).
Midline Crossovers: Provides trend confirmation when either the RSI or its moving average crosses the 50 midline, signaling potential trend reversals.
ATR-Inversely Weighted RSI Variations: Uses the smoothed, ATR-adjusted RSI for a more refined and responsive trend-following signal. There are variations both for the MA crossover and the midline crossover.
Overbought/Oversold Conditions: Ideal for mean reversion setups, where signals are triggered when the RSI or its moving average crosses over overbought or oversold levels.
Flexible Customization:
With a wide range of customizable options, you can tailor the indicator to fit your personal trading style. Choose from various moving average types for the RSI, modify the ATR smoothing length, and adjust overbought/oversold levels to optimize your signals.
Usage:
While this indicator is primarily designed for trend-following, its OB/OS configurations make it highly effective for mean-reverting setups as well. Depending on your selected signal type, the relevant indicator line will change color between green and red to visually signal long or short opportunities. This flexibility allows traders to switch between trending and sideways market strategies seamlessly.
A Versatile Tool:
The ATR Adjusted RSI Indicator is a valuable component of any trading system, offering enhanced signals that adapt to market volatility. However, it is not recommended to rely on this indicator alone, especially without thorough backtesting. Its performance varies across different assets and timeframes, so it’s essential to experiment with the parameters to ensure consistent results before applying it in live trading.
Recommendation:
Before incorporating this indicator into live trading, backtest it extensively. Given its flexibility and wide range of signal-generation methods, backtesting allows you to optimize the settings for your preferred assets and timeframes. Only consider using it on it's own if you are confident in its performance based on your own backtest results, and even then, it is not recommended.
[-_-] Volatility Calibrated ATRDescription:
An indicator based on ATR adjusted for volatility of the market. It uses Heikin Ashi data to find short and long opportunities and displays a dynamic stop loss level. Additionally, it has alerts for when the trend changes (which is an entry signal).
How it works:
It works by dynamically calculating the Period for ATR which depends on current volatility level that is calculated by a function that uses Standard Deviation of price. ATR is then smoothed by Weighted Moving Average and multiplied by ATR Factor, resulting in a plot that changes its colour to red when we're in a downtrend and green when in an uptrend. This plot should be used as a dynamic Stop Loss level. Trend change is determined by price crossing the dynamic Stop Loss level. The squared red and green labels appear when the trend changes, and should be used as Entry signals.
Parameters:
- Source -> data used for calculations
- ATR Factor -> higher values produce less noise and longer trends, lower values give more signals
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!
Stochastic based on Closing Prices - Identify and Rank TrendsStochClose is a trend indicator that can be used on its own to measure trend strength, in a scan to rank a group of securities according to trend strength or as part of a trend following strategy. Moreover, it acts as a volatility-adjusted trend indicator that puts securities on an equal footing.
StochClose measures the location of the current close relative to the close-only high-low range over a given period of time. In contrast to the traditional Stochastic Oscillator, this indicator only uses closing prices. Traditional Stochastic uses intraday highs and lows to calculate the range. The focus on closing prices reduces signal noise caused by intraday highs and lows, and filters out errant or irrationally exuberant price spikes.
Here are some examples when the high or low was out of proportion and suspect. Perhaps most famously, there were errant spike lows in dozens of ETFs in August 2015 (XLK, IJR, ITB). There were other spikes in VMBS (October 2014), IJR (October 2008) and KRE (May 2011). Elsewhere, there were suspicious spikes in IEI (April 2020), CHD (March 2020), CCRN (March 2020) and FNB (March 2020)
The preferred setting to identify medium and long-term uptrends is 125 days with 5 days smoothing. 125 days covers around six months. Thus, StochClose(125,5) is a 5-day SMA of the 125-day Stochastic based on closing prices. Smoothing with the 5-day SMA introduces a little lag, but reduces whipsaws and signal noise.
StochClose fluctuates between 0 and 100 with 50 as the midpoint. Values above 80 indicate that the current price is near the high end of the 125-day range, while values below 20 indicate that price is near the low end of the range. For signals, a move above 60 puts the indicator firmly in the top half of the range and points to an uptrend. A move below 40 puts the indicator firmly in the bottom half of the range and points to a downtrend.
StochClose values can also be ranked to separate the leaders from the laggards. In contrast to Rate-of-Change and Percentage Above/Below a Moving Average, StochClose acts as a volatility-adjusted indicator that can identify trend strength or weakness. The Consumer Staples SPDR is unlikely to win in a Rate-of-Change contest with the Technology SPDR. However, it is just as easy for the Consumer Staples SPDR to get in the top of its range as it is for the Technology SPDR. StochClose puts securities on an equal footing.
StochClose measures trend direction and trend strength with one number. The indicator value tells us immediately if the security is trending higher or lower. Furthermore, we can compare this value against the values for other securities. Securities with higher StochClose values are stronger than those with lower values.