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.
Rangingmarket
Range Detector [LuxAlgo]The Range Detector indicator aims to detect and highlight intervals where prices are ranging. The extremities of the ranges are highlighted in real-time, with breakouts being indicated by the color changes of the extremities.
🔶 USAGE
Ranging prices are defined by a period of stationarity, that is where prices move within a specific range.
Detecting ranging markets is a common task performed manually by traders. Price breaking one of the extremities of a range can be indicative of a new trend, with an uptrend if price breaks the upper range extremity, and a downtrend if price breaks the lower range extremity.
Ranges are highlighted as zones and are set retrospectively, that is the starting point of a range is offset in the past. The exact moment a range is detected is highlighted by a gray background color. The average between the maximum/minimum of a zone is also highlighted as a dotted line and is also set retrospectively.
The range extremities are set in real-time, blue extremities indicate the range extremities were not broken, green extremities indicate that price broke the upper range extremity, while red extremities indicate price broke the lower range extremity.
Extremities are extended until a new range is detected, allowing past ranges extremities can be used as future support/resistances.
🔶 DETAILS
The detection algorithm used to detect ranges tests if all the prices within a user-set window are all within two extremities. These extremities are determined by the mean of the detection window plus/minus an ATR value.
When a new range is detected, the script checks if this new range overlaps with a previously detected range, if this is the case, both ranges are merged into one; updating the extremities of the previous range.
This can be observed with the real-time extremities changing within a highlighted zone.
🔶 SETTINGS
Minimum Range Length: Minimum amount of bars needed to detect a range.
Range Width: Multiplicative factor for the ATR used to detect new ranges. Lower values detect ranges with a lower width. Using higher values might return false positives.
ATR Length: ATR length used to determine the range width.
Predictive Ranges [LuxAlgo]The Predictive Ranges indicator aims to efficiently predict future trading ranges in real-time, providing multiple effective support & resistance levels as well as indications of the current trend direction.
Predictive Ranges was a premium feature originally released by LuxAlgo in 2020.
The feature was discontinued & made legacy, however, due to its popularity and reproduction attempts, we deemed it necessary to release it open source to the community.
🔶 USAGE
The primary purpose of this indicator is to provide potential support & resistance levels on the chart by estimating future trading ranges.
When the price reaches one of the upper/lower levels of the Predictive Ranges we can expect the price to reverse.
If the price exits the predicted range, new levels are given in real-time & they do not repaint. Higher "Factor" values allow returning longer term and wider ranges less susceptible to be exited.
🔹 Estimating Trend Directions
Users are able to easily estimate trend directions by looking at the central levels of the predictive ranges, which represent an estimate of the price central tendency.
If this central level increases it means the price is up-trending, if it is decreasing price is down-trending.
🔶 SETTINGS
Length: ATR Length used for the indicator calculation. Higher values will tend to return ranges of equal width.
Factor: Control the ranges width. Higher values will return less frequent ranges, each having a higher width.
Timeframe: Indicator timeframe output.
Source: Input source of the indicator. It is recommended to use input sources on the same scale as the price.
Moving Average-TREND POWER v2.0-(AS)HELLO:
-This indicator is a waaaay simpler version of my other script - Moving Average-TREND POWER v1.1-(AS).
HOW DOES IT WORK:
-Script counts number of bars below or above selected Moving Average (u can se them by turning PLOT BARS on). Then multiplies number of bars by 0.01 and adds previous value. So in the uptrend indicator will be growing faster with every bar when price is above MA. When MA crosess price Value goes to zero so it shows when the market is ranging.
If Cross happens when number of bars is higher than Upper threshold or below Lower threshold indicator will go back to zero only if MA crosses with high in UPtrend and low in DNtrend. If cross happens inside THSs Value will be zero when MA crosses with any type of price source like for example (close,high,low,ohlc4,hl etc.....).This helps to get more crosess in side trend and less resets during a visible trend
HOW TO SET:
Just select what type of MA you want to use and Length. Then based on your preference set values of THSs'
OTHER INFORMATIONS:
-Script was created and tested on EURUSD 5M.
-For bigger trends choose slowerMAs and bigger periods and the other way around for short trends (FasterMAs/shorter periods)
-Below script code you can find not used formulas for calculating indicator value(thanks chat GPT), If you know some pinescript I encourage you to try try them or maybe bulid better ones. Script uses most basic one.
-Pls give me some feedback/ideas to improve and check out first version. Its way more complicated for no real reason but still worth to take a look'
-Also let me know if you find some logical errors in the code.
Enjoy and till we meet again.
Heiken Ashi Swing Range FilterIt uses heiken-ashi candles to find swing highs and lows, then check if candles are inside the range of them. This way you can filter out ranging market.
It may be better to use it in higher timeframe than current.
Range Detector Indicator [Misu]█ This indicator shows an upper and lower band based on Highs and Lows.
Depending on this, the indicator interprets a ranging market, an uptrend or a downtrend.
█ Usages:
The purpose of this indicator is to identify when the price is ranging.
It's also used to identify changes in trends, breaking points, and trend reversals.
But it can also be used to show resistance or support levels.
█ Features:
> Price Action Change Alerts
> Price Action Change Labels
> Color Bars
> Show Bands
█ Parameters:
Deviation: A parameter used to calculate pivots.
Depth: A parameter used to calculate pivots.
Activate Range Detection: Check the box to activate range detection.
Band% Offset: A factor that is used to vary the bands offset.
Donchian Channels+Standard Donchian Channels, this includes a Trend EMA which can be configured and the channels will use to give buy and sell signals. The channels are also colored in such a way to indicate a trend reversals. My favorite part that sets this apart from others is, if using the bClose option (which I recommend you do) the trend will not reverse until there is a close above/below the previous channel high/low. i.e. a reversal into an uptrend requires the current bar to close above the previous upper channel rather than just a new high.
The coloring of the current trend allows for a quick read of current market conditions and I use this on any timeframe across all forms of charts (forex stock, futures , crypto, etc). When taking one of the signals I use the opposite channel as the stop loss (when buying use bottom, and selling use top channel)
Update 1:
- Added my name to the code
- Updated the picture to show off the indicator better
- Raised the brightness of the fill color a bit, looks nicer I think
As a warning: I have obviously hand picked this picture to really show off this indicator's power to work in a trending market. Donchian Channels are a trending indicator and work best in trending markets with decent pull backs. If there are multiple signals going in each direction, it is a choppy market and you should stay out until it starts trending again. I generally use a 1:1.5 risk to reward ratio but sometimes will stretch it to 1:2 if it is a nice trade and I feel the market is in my favor as you can see from the trades placed in the picture (and I use that method for any commodity / chart and timeframe). I use the close of the white candle and then (since they are trades going short) I use the upper Donchian Channel as my stop loss.
I personally like to have the lines and labels turned off and enable all other options. Labels are just there to really stand out so you don't miss the white candle indication for a trade. OH! Also, I've had comments from friends that the white candles are hard to see, I turn off my candle borders in settings; makes it super easy to see them then. I turn lines off as the fill does the job well enough and it seems cleaner in my eyes.
If you'd like to see this picture on your chart, it is Micro E-Mini S&P 500 Futures from July 10, 2022 @ 18:00 on the 1-min chart.
just now
Update 2:
- Added day trading time highlights
- Added ranging market indicator (This I'm still working on so use at your own discretion, it's intended purpose is to tell when the Donchian Channels are not going to give great signals and to use a ranging indicator instead)
- Added multi-timeframe trend screener (handy if you want to quickly see the trend direction (based on the Trend EMA you set) of several time frames without having to change charts). It will draw in the bottom right of the chart.
Donchian with Trend IndicatorStandard Donchian Channels, this includes a Trend EMA which can be configured and the channels will use to give buy and sell signals. The channels are also colored in such a way to indicate a trend reversal. My favorite part that sets this apart from others is, if using the bClose option (which I recommend you do) the trend will not reverse until there is a close above/below the previous channel high/low. i.e. a reversal into an uptrend requires the current bar to close above the previous upper channel rather than just a new high.
The coloring of the current trend allows for a quick read of current market conditions and I use this on any timeframe across all forms of charts (forex stock, futures, crypto, etc). When taking one of the signals I use the opposite channel as the stop loss (when buying use bottom, and selling use top channel)
{Gunzo} Vertical Horizontal Filter (Trading ranges)Vertical Horizontal Filter indicator is a tool that can be used to identify market conditions (ranging or trending). It measures if the price is going vertical (uni-directional) or horizontal (non-directional).
OVERVIEW :
The Vertical Horizontal Filter is a technical analysis indicator created by Adam White in 1991. He described it in the “Issues of Futures” magazine for the first time. The indicator is only composed of one line that measures the level of trend activity.
If the VHF line is increasing, we consider that the trend is getting stronger (up-trend or down-trend). Otherwise, if the VHF line is decreasing, we consider that the trend is weakening (going sideways or even ranging) as the market is getting calmer
CALCULATION :
The level of trend activity is calculated as the ratio between the distance from the highest to the lowest value (on the last N days) and the movement of the closing price.
VHF = ( highest (high) – lowest (low) ) / sum( close – previous close)
SETTINGS :
VHF length : Length of the vertical horizontal filter (28 or 18 recommended)
VHF source : Source of the vertical horizontal filter (close recommended)
VHF smoothing length : Extra smoothing applied on the VHF line to filter noise (1 or 6 or 9 or 14 recommended)
Display ranging market rectangles : Display rectangles on the chart around the area where VHF is decreasing (ranging market)
Display trending market rectangles : Display rectangles on the chart around the area where VHF is increasing (trending market up or down)
Minimum rectangle size : Hide rectangles that are smaller than X candles
Display signal line : Display circles at the bottom of the chart with the raw VHF direction (green if increasing /red if decreasing)
Display VHF tops and bottoms : Display triangles if the VHF line is reaching a new high or new low over the last 100 candles. When consecutive triangles appear, it may be a sign that the current market conditions are ending. Green triangles mean the possible end of the ranging market and red triangles mean the possible end of the trending market.
VISUALIZATIONS :
This indicator has 3 possible visualizations :
Rectangles : the rectangles are drawn on areas where the VHF is decreasing (red) or increasing (green) for a minimum number of consecutive candles. The first candles of an area may not be representative of the market conditions as the VHF line is still in extreme values but going slowly in the opposite direction. The market conditions (ranging or trending) get stronger with the VHF line keeping the same direction.
Signal line : The signal line is the VHF raw data : the red circle is a decreasing VHF line, and the green circle is an increasing VHF line.
Tops and bottoms : The tops and bottoms are signals indicating that the VHF line is reaching extreme values, there is a high probability that the market conditions are going to change after that.
USAGE :
This indicator can be used as a filter for strategies based on other technical analysis indicators.
If you are using trending indicators like moving averages, you should consider using them only when the market is trending. You can use VHF increasing to confirm that the market is not ranging.
If you are using oscillating indicators like stochastic or commodity channel index, you may prefer using them when the market is ranging as trending indicators may not be useful. You can use the VHF decreasing to confirm that the market is ranging.
Price Cross Range StrengthPurpose:
This script shows when price is in a range or trending. When the green line rises above the threshold the price is trending. When the green line falls below the threshold it's ranging. You may try adjusting the lookback way far back to find more areas of resistance.
Logic:
It shows how many instances the current price has been crossed in the past measured bars. The logic is that any price area that has been crossed many times is a strong area where ranging occurs.
Ideas:
1. Can be used as a dynamic length to other moving averages.
IO_VRSIOriginal Idea by Invsto
In this indicator, I explore the core concepts of RSI and extend it with smoothening to determine volatility.
Usage:
LIME/GREEN : High Volatility and BULLISH trend
RED/FUCHSIA : High Volatility and BEARISH trend
GRAY: Low volatility/Potential Chop Zone
IO_GuppyDistanceThis indicator measures the distance between the Guppy EMAs.
Fast and Slow Guppy distances are plotted based on traditional Chris Moody Guppy colors.
Green = Long Term Bullish
Red = Long Term Bearish
Gray = Neither
Similarly colors for ST Bullish and Bearish signals based on Guppy.
Thank you, CM and xkavalis!
IO_EMA_Delta_OscillatorThis is a EMA Delta Oscillator: An attempt to show ranging markets based on the slope of the EMA.
Green = Bullish Market
Blue = Ranging Market
Red = Bearish Market
The EMA Slope is normalized to make it work like an oscillator with values between 0 and 1.
Bar colors show the oscillator colors, bar borders show the actual candle colors.
- Invsto
(sarangab)