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.
Ranging
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.
Moving Average - TREND POWER v1.1- (AS)0)NOTE:
This is first version of this indicator. It's way more complicated than it should be. Check out Moving Average-TREND POWER v2.1-(AS), its waaaaay less complicated and might be better.Enjoy...
1)INTRODUCTION/MAIN IDEA:
In simpliest form this script is a trend indicator that rises if Moving average if below price or falling if above and going back to zero if there is a crossover with a price. To use this indicator you will have to adjust settings of MAs and choose conditions for calculation.
While using the indicator we might have to define CROSS types or which MAs to use. List of what cross types are defined in the script and Conditiones to choose from.The list will be below.
2) COMPOSITION:
-MA1 can be defined by user in settings, possible types: SMA, EMA, RMA, HMA, TEMA, DEMA, LSMA, WMA.
-MA2 is always ALMA
3) OVERLAY:
Default is false but if you want to see MA1/2 on chart you can change code to true and then turn on overlay in settings. Most plot settings are avalible only in OV=false.
if OV=true possible plots ->MA1/2, plotshape when choosen cross type
if OV=false -> main indicator,TSHs,Cross counter
4)PRESETS :
Indicator has three modes that can be selected in settings. First two are presets and do not require selecting conditions as they set be default.
-SIMPLE - most basic
-ABSOLUTE - shows only positive values when market is trending or zero when in range
-CUSTOM - main and the most advanced form that will require setting conditions to use in calculating trend
4.1)SIMPLE – this is the most basic form of conditions that uses only First MA. If MA1 is below selected source (High/Low(High for Uptrend and Low for DNtrend or OHLC4) on every bar value rises by 0.02. if it above Low or OHLC4 it falls by 0.02 with every bar. If there is a cross of MA with price value is zero. This preset uses CROSS_1_ULT(list of all cross types below)
4.2) ABSOLUTE – does not show direction of the trend unlike others and uses both MA1 and MA2. Uses CROSS type 123_ULT
4.3) CUSTOM – here we define conditions manually. This mode is defined in parts (5-8 of description)
5)SETTINGS:
SOURCE/OVERLAY(line1) – select source of calculation form MA1/MA2, select for overlay true (look point 3)
TRESHOLDS(line2). – set upper and lower THS, turn TSHs on/off
MA1(line3) – Length/type of MA/Offset(only if MA type is LSM)
MA2(line4) – length/offset/sigma -(remember to set ma in the way that in Uptrend MA2MA1 in DNtrend)
Use faster MA types for short term trends and slower types / bigger periods for longer term trends, defval MA1/2 settings
are pretty much random so using them is not recomended.
CROSSshape(line5) – choose which cross type you want to plot on chart(only in OV=true) or what type you want to use in counting via for loops,
CROSScount(line6) – set lookback for type of cross choosen above
BOOLs in lines 5 and 6 - plotshape if OV=true/plot CROSScount histogram (if OV=false)
Lines 7 and 8 – PRESET we want to use /SRC for calculation of indicator/are conditions described below/which MAs to use/Condition for
reducing value t 0 - (if PRESET is ABSOLUTE or SIMPLE only SRC should be set(Line 8 does not matter if not CUSTOM))
5)SOURCE for CONDS:
Here you can choose between H/L and OHLC. If H/L value grow when MAlow. If OHLC MAOHLC. H/L is set by default and recommended. This can be selected for all presets not only CUSTOM
6)CROSS types LIST:
“1 means MA1, 2 is MA2 and 3 I cross of MA1/MA2. L stands for low and H for high so for example 2H means cross of MA2 and high”
NAME -DEFINITION Number of possible crosses
1L - cross of MA1 and low 1
1H - cross of MA1 and high 1
1HL - cross of MA1 and low or MA1 and high 2 -1L/1H
2L - cross of MA2 and low 1
2H - cross of MA2 and high 1
2HL - cross of MA2 and low or MA1 and high 2 -2L/2H
12L - cross of MA1 and low or MA2 and low 2 -1L/2L
12H - cross of MA1 and high or MA2 and high 2 -1H/2H
12HL - MA1/2 and high/low 4 -1H/1L/2H/2L
3 -cross of MA1 and MA2 1
123HL -crosses from 12HL or 3 5 -12HL/3
1_ULT - cross of MA1 with any of price sources(close,low,high,ohlc4 etc…)
2_ULT - cross of MA2 with any of price sources(close,low,high,ohlc4 etc…)
123_ULT – all crosses possible of MA1/2 (all of the above so a lot)
7)CRS CONDS:
“conditions to reduce value back to zero”
>/< - 0 if indicator shows Uptrend and there’s a cross with high of selected MA or 0 if in DNtrend and cross with low. Better for UP/DN trend detection
ALL – 0 if cross of MA with high or low no matter the trend, better for detecting consolidation
ULT – if any cross of selected MA, most crosses so goes to 0 most often
8)MA selection and CONDS:
-MA1: only MA1 is used,if MA1 below price value grows and the other way around
MA1price =-0.02
-MA2 – only MA2 is used, same conditions as MA1 but using MA2
MA2price =-0.02
-BOTH – MA1 and MA2 used, grows when MA1 if below, grows faster if MA1 and MA2 are below and fastest when MA1 and MA2 are below and MA2price=-0.02
-MA1 and MA2 >price=-0.03
-MA1 and MA2 ?price and MA2>MA1=-0.04
9)CONDITIONS SELECTION SUMMARRY:
So when CUSTOM we choose :
1)SOURCE – H/L or OHLC
2)MAs – MA1/MA2/BOTH
3)CRS CONDS (>/<,ALL,ULT)
So for example...
if we take MA1 and ALL value will go to zero if 1HL
if MA1 and >/< - 0 if 1L or 1H (depending if value is positive or negative).(1L or 1H)
If ALL and BOTH zero when 12HL
If BOTH and ULT value goes back to zero if Theres any cross of MA1/MA2 with price or cross of MA1 and MA2.(123_ULT)
If >/< and BOTH – 0 if 12L in DNtrend or 12H if UPtrend
10) OTHERS
-script was created on EURUSD 5M and wasn't tested on different markets
-default values of MA1/MA2 aren't optimalized so do not
-There might be a logical error in the script so let me know if you find it (most probably in 'BOTH')
-thanks to @AlifeToMake for help
-if you have any ideas to improve let me know
-there are also tooltips to help
True Trend Oscillator [wbburgin]The True Trend oscillator identifies trending or ranging markets with a stochastic ATR and RSI. Here are some examples for how it can be used.
Uptrends
If the candlesticks are lime green, this signals an uptrend. On the oscillator, you can identify an uptrend if the bull strength (the green line) is above the bear strength (the red line). The strength of the uptrend and the downtrend can be found by looking at the slope of these lines.
Downtrends
If the candlesticks are red, this signals a downtrend. On the oscillator, notice how the bear strength line is above the bull strength line.
Ranging Markets and Pullbacks
The True Trend oscillator can also be used to identify ranging markets or pullbacks. Let's look at the previous example again:
If you notice that the bull and bear lines are bouncing above the red weak-trend zone (as in the example above), this signals an extended trend. On the contrary, when the bull and bear lines fall into the weak-trend zone, this may indicate a larger pullback or a range to look to enter a trade again, as in this example, where the ranging candles in gray demonstrate temporary pullbacks in a larger bullish trend:
Ranges can also occur before trend reversals, so a range may also indicate a smart time to secure profits.
You can customize the ranging threshold in the settings. It can be set from 0-100 because the indicator is a stochastic.
Hope you all find this indicator useful!
Drawdown and Drawback || Ranging Hey!
So this indicator tries to spot ranges;
Above the zero line is the data from green candles and below the zero line is the data from the red candles;
When the white area is > than the black area, it indicates that the DrawBack is higher than the DrawDown;
This might work counterintuitively for some people because, for a bullish candle, this means it has to go down for the indicator to recognize it as “good”/ see it as a DrawBack value;
The same is true for a bearish candle, the price has to move up after for it to be seen as a DrawBack value;
There are a few input values:
Length_: This is how many bars a candle gets for the price to move in, the default is 8 bars, so after a bar is formed, from the following 8 bars the DrawBack/DrawDown is saved;
EMA_Length: This is the EMA length, you can change the EMA length and also the MA variant, so you have full flexibility about what might work best for you;
RB_Size: This is how many points a Real Body of a candle has to have before it gets registered within the indicator, what I found it, is that if you put this too low your data gets ruined by candles that have 1-5 points if you use it on a low TimeFrame, but if you want to use it on higher timeframes you maybe have to make the default a bit higher.
Everything is plotted with an Offset of 1, I like it this way so you get a realistic view of the market as you will -most likely- place trades on the next candle either way not on the current candle. But that is just my opinion.
I also added 2 yellow Hlines for visual purposes to see if they were within a certain boundary, see if these add anything for yourself, because they can also make it look a bit messy;
If you have any questions about the code or the indicator itself, feel free to ask them!
I hope it helps at least one person ;)
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)
Market Bias (CEREBR)Hello Everyone. I hope you are all doing great. It's been a long time since I posted my first script here, and I got a lot of response from that.
So, I thought I should share this script also to everyone, and anyone that may find it useful. Personally, I use it to tell the general market conditions.
Here's how I works : The script tries to determine the overall direction of the market, using smoothed Heiken Ashi candles. The coloring system (using bright and dark colors) is an attempt to detect strong market and weak market conditions. There's also an oscillator within the script, but for now it isn't plotted. Credits to @jackvmk, I used part of his open-script code in this indicator.\
I have considered using the slope of the indicator plot as a filter for ranging market conditions. The plot goes relatively flat in 'flat' markets. However, I have not done anything about that yet. Maybe some other time.
I hope you find this useful. If you find a way to use this, please share it with the community in the comment section.
NOTE: THIS IS BY NO MEANS FINANCIAL ADVICE. You'll have to make your studies and come up with a way to apply this indicator to your trading style and strategy.
By the way, I would be going with the name 'CEREBR' for any subsequent scripts I release from now on.
Happy Trading, guys.
Fusion: ATR Ranging using PercentileA simple (but improved on my first attempt) way to determine a ranging market.
The defaults are for a specific use of my own so by no means feel a need to use them, adjust as needed.
By default this sits on the main chart however if you want to see the lines behind the result make a copy and put the copy on it's own chart and then just check the "Show ATR" and "Show PLI" (Percentile Linear Interpolation) flags.
There is no reason for using a Hull MA over any other except that it's a preference of mine, that is, it's not for some magical reason I figured out. That said, the Hull is perhaps my favorite because of what I learned about it after quite a bit of research so take that as you will.
Credit to: "Hull Suite by InSilico" from which I used the HMAs.
The code is structured to easily drop into bigger system so use as a lone indicator or add to some bigger project you are creating. If you do add this to a bigger system please drop me a note as it's nice to know your system is being used in something greater.
Finally, if you find value please do make a comment, give thumbs up etc.
Enjoy and good luck!
Sideways detection bollinger bandsSideways detection indicator using Bollinger bands .
In this case we take the original ratio between lower and upper and we smooth it even harder in order to get a better idea about the accuracy of the trend.
If the initial ratio is not between 0 and 1 and the smooth ratio is higher than our selected value, we get an idea if we are a in trending market or not.
Of course using it as a standalone has no usage, and it has to be combined with other tools like moving average, oscillators and so on.
IF you have any questions let me know
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.
Trending/RangingThis script is a useful tool to use to identify the current market. It includes three other indicators:
1. ATR (combined with a SMA of the ATR)
2. ADX
3. RSI
It allows you to filter for when the market is trending vs. when the market is ranging by using any of the three indicators. You can also combine them to find extremely good trends to trade, or if you're a channel trader, identify when you wouldn't want to trade. This indicator also includes a time frame setting to allow you to ZOOM OUT and explore the long term trend of the security you are trading. I highly recommend using this indicator as a filter for when you enter a trade or not depending on the system you like to trade.
Price Action IndexI've created a simple oscillator which I think does a good job of easily showing you when price is worth watching or not. I think all too often you get stuck looking at something like an RSI and end up trading noise.
From my observations and experiences, I've found that there are 2 major catalysts for price movement--
Price is either trending and reaches a top or bottom, or
Price is consolidating and ready to make a move in some direction
These movements can be seen quite well from a Bollinger Band, which is what mostly gave me the inspiration. When I watch a chart with a BB on it I see that either you're looking to trade price moving out of a squeeze or riding price up/down the band until it crosses over and makes a move to the moving average.
My solution was to multiply the direction of price by the strength of its deviation.
Price gets converted into a signal between -1.0 (bottom of the range) and 1.0 (top of the range)
Standard Deviation gets converted into a stochastic signal between 0 (next to no deviation from mean) and 100 (highest deviation in lookback)
These 2 get multiplied by each other
The result tells you if price action is trending bullish and if its approaching max strength (perhaps Overbought), example: Price is hitting highs (1.0) and deviation is also at its highest (100) = 100, opposite for bearish
Result can also tell you if price is at the top of the range but the deviation is so tiny and we're mostly pinned to the mean (1.0 * 5 = only 5)
How to Trade this Indicator--
If the indicator is stuck near the middle and purple:
- Don't make directional trades or you'll be eaten alive by the chop
- Good idea to sell options, Iron Condors/Butterflies, etc
- Wait for a move to breakout --> the purple will fade away and give way to a direction
--- As in all trading scenarios, be mindful of fakeouts/short moves to one direction that very quickly get reversed
If the indicator is heading higher:
- This would indicate there is a bull trend going on, get long
- If we are reaching the overbought area, this is an ideal place to take profits or look at spreads like Bearish Call Spreads (sell calls)
- I think you can make your own determination of when to sell by either selling when we're in the overbought area (if it reaches there) or staying bullish so long as it is above the zone
If the indicator is heading lower:
- Bear trend, shorting is possible
- Can use this as a contrarian signal to buy lows
A couple of charts with the indicator and a purple squeeze box I've drawn (can sometimes get noisy in real-time, but hindsight is 20/20)--
Bitcoin on Daily with default 20 length
Gamestop on 30 minute time frame with 100 length
Please feel free to use this indicator for your trading or your own indicators. This particular script is very stripped down/bare bones from what I have been working on as an ongoing project. If TradingView ever returns scripts you can sell, I would probably open that up for a small premium.
[SCL] True Market StructureSee market structure at a glance with Higher Highs and Lower Lows. Bullish/Bearish/Ranging market bias is automatically derived. Optionally get alerted for breaks in market structure. Uses true Local Highs/Lows instead of simply the highest/lowest "pivot" for x bars. Can be useful as a support for learning market structure or for alerts for a change in structure while you're not at the computer.
Tool: Chop & Trade ZonesA simple yet powerful way to filter out choppy ranges or sideways moves without missing out on good trades
It calculates the %-distance of the price to a moving average so you can ignore buy/sell signals around the center line.
The upper and lower line are thresholds to catch reversals of the trend when the distance to moving average is increasing.
Thanks @dgtrd and @imzeeshan for the inspiration 🙏
Trending True RangeDisplay a smoothed true range during trending markets, thus filtering any measurement occurring during ranging markets. Whether the market is trending or ranging is determined by the position of the efficiency ratio relative to its Wilder moving average.
Settings
Resolution : resolution of the indicator
Length : period of the efficiency ratio and the Wilder moving averages used in the script
Usage
If you are not interested in volatility during ranging markets, this indicator might result useful to you. An interesting aspect is that it both measures volatility, but also determine whether the market is trending or ranging, with a zero value indicating a ranging market.
Indicator against Atr, with both length = 14, our indicator might be easier to interpret.
Note
Thx to my twitter followers for their suggestions regarding this indicator. I apologize if it's a bit short, the original code was longer and included more options, but forcing a script to be lengthy is a really bad idea, so I stayed with something less flashy but certainly more practical, "classic Grover" some might say.
Thx for reading!
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)
Range Action Verification Index (RAVI)Range Action Verification Index (RAVI) indicator script. This indicator was originally developed by Tushar Chande (see his book "Beyond Technical Analysis: How to Develop and Implement a Winning Trading System").
Kay_BBands v2This is the second version of Kay_BBands. But this is infused with ADX.
When +DI (Directional Index) is above -DI, then Upper band will be visible and vice-versa.
This is when the ADX is above the threshold. 20 is the default but can be set to 25.
When the ADX is below the specified threshold, both bands gets visible, showing no trending conditions.
Use it with another band with setting 20/21, 0.6 deviation. Prices keeping above or below the 2nd bands upper or lower bounds shows trending conditions.