Bar Balance [LucF]Bar Balance extracts the number of up, down and neutral intrabars contained in each chart bar, revealing information on the strength of price movement. It can display stacked columns representing raw up/down/neutral intrabar counts, or an up/down balance line which can be calculated and visualized in many different ways.
WARNING: This is an analysis tool that works on historical bars only. It does not show any realtime information, and thus cannot be used to issue alerts or for automated trading. When realtime bars elapse, the indicator will require a browser refresh, a change to its Inputs or to the chart's timeframe/symbol to recalculate and display information on those elapsed bars. Once a trader understands this, the indicator can be used advantageously to make discretionary trading decisions.
Traders used to work with my Delta Volume Columns Pro will feel right at home in this indicator's Inputs . It has lots of options, allowing it to be used in many different ways. If you value the bar balance information this indicator mines, I hope you will find the time required to master the use of Bar Balance well worth the investment.
█ OVERVIEW
The indicator has two modes: Columns and Line .
Columns
• In Columns mode you can display stacked Up/Down/Neutral columns.
• The "Up" section represents the count of intrabars where `close > open`, "Down" where `close < open` and "Neutral" where `close = open`.
• The Up section always appears above the centerline, the Down section below. The Neutral section overlaps the centerline, split halfway above and below it.
The Up and Down sections start where the Neutral section ends, when there is one.
• The Up and Down sections can be colored independently using 7 different methods.
• The signal line plotted in Line mode can also be displayed in Columns mode.
Line
• Displays a single balance line using a zero centerline.
• A variable number of independent methods can be used to calculate the line (6), determine its color (5), and color the fill (5).
You can thus evaluate the state of 3 different components with this single line.
• A "Divergence Levels" feature will use the line to automatically draw expanding levels on divergence events.
Features available in both modes
• The color of all components can be selected from 15 base colors, with 16 gradient levels used for each base color in the indicator's gradients.
• A zero line can show a 6-state aggregate value of the three main volume balance modes.
• The background can be colored using any of 5 different methods.
• Chart bars can be colored using 5 different methods.
• Divergence and large neutral count ratio events can be shown in either Columns or Line mode, calculated in one of 4 different methods.
• Markers on 6 different conditions can be displayed.
█ CONCEPTS
Intrabar inspection
Intrabar inspection means the indicator looks at lower timeframe bars ( intrabars ) making up a given chart bar to gather its information. If your chart is on a 1-hour timeframe and the intrabar resolution determined by the indicator is 5 minutes, then 12 intrabars will be analyzed for each chart bar and the count of up/down/neutral intrabars among those will be tallied.
Bar Balances and calculation methods
The indicator uses a variety of methods to evaluate bar balance and to derive other calculations from them:
1. Balance on Bar : Uses the relative importance of instant Up and Down counts on the bar.
2. Balance Averages : Uses the difference between the EMAs of Up and Down counts.
3. Balance Momentum : Starts by calculating, separately for both Up and Down counts, the difference between the same EMAs used in Balance Averages and an SMA of double the period used for the EMAs. These differences are then aggregated and finally, a bounded momentum of that aggregate is calculated using RSI.
4. Markers Bias : It sums the bull/bear occurrences of the four previous markers over a user-defined period (the default is 14).
5. Combined Balances : This is the aggregate of the instant bull/bear bias of the three main bar balances.
6. Dual Up/Down Averages : This is a display mode showing the EMA calculated for each of the Up and Down counts.
Interpretation of neutral intrabars
What do neutral intrabars mean? When price does not change during a bar, it can be because there is simply no interest in the market, or because of a perfect balance between buyers and sellers. The latter being more improbable, Bar Balance assumes that neutral bars reveal a lack of interest, which entails uncertainty. That is the reason why the option is provided to interpret ratios of neutral intrabars greater than 50% as divergences. It is also the rationale behind the option to dampen signal lines on the inverse ratio of neutral intrabars, so that zero intrabars do not affect the signal, and progressively larger proportions of neutral intrabars will reduce the signal's amplitude, as the balance calcs using the up/down counts lose significance. The impact of the dampening will vary with markets. Weaker markets such as cryptos will often contain greater numbers of neutral intrabars, so dampening the Line in that sector will have a greater impact than in more liquid markets.
█ FEATURES
1 — Columns
• While the size of the Up/Down columns always represents their respective importance on the bar, their coloring mode is independent. The default setup uses a standard coloring mode where the Up/Down columns over/under the zero line are always in the bull/bear color with a higher intensity for the winning side. Six other coloring modes allow you to pack more information in the columns. When choosing to color the top columns using a bull/bear gradient on Balance Averages, for example, you will end up with bull/bear colored tops. In order for the color of the bottom columns to continue to show the instant bar balance, you can then choose the "Up/Down Ratio on Bar — Dual Solid Colors" coloring mode to make those bars the color of the winning side for that bar.
• Line mode shows only the line, but Columns mode allows displaying the line along with it. If the scale of the line is different than that of the scale of the columns, the line will often appear flat. Traders may find even a flat line useful as its bull/bear colors will be easily distinguishable.
2 — Line
• The default setup for Line mode uses a calculation on "Balance Momentum", with a fill on the longer-term "Balance Averages" and a line color based on the "Markers Bias". With the background set on "Line vs Divergence Levels" and the zero line on the hard-coded "Combined Bar Balances", you have access to five distinct sources of information at a glance, to which you can add divergences, divergences levels and chart bar coloring. This provides powerful potential in displaying bar balance information.
• When no columns are displayed, Line mode can show the full scale of whichever line you choose to calculate because the columns' scale no longer interferes with the line's scale.
• Note that when "Balance on Bar" is selected, the Neutral count is also displayed as a ratio of the balance line. This is the only instance where the Neutral count is displayed in Line mode.
• The "Dual Up/Down Averages" is an exception as it displays two lines: one average for the Up counts and another for the Down counts. This mode will be most useful when Columns are also displayed, as it provides a reference for the top and bottom columns.
3 — Zero Line
The zero line can be colored using two methods, both based on the Combined Balances, i.e., the aggregate of the instant bull/bear bias of the three main bar balances.
• In "Six-state Dual Color Gradient" mode, a dot appears on every bar. Its color reflects the bull/bear state of the Combined Balances, and the dot's brightness reflects the tally of balance biases.
• In "Dual Solid Colors (All Bull/All Bear Only)" a dot only appears when all three balances are either bullish or bearish. The resulting pattern is identical to that of Marker 1.
4 — Divergences
• Divergences are displayed as a small circle at the top of the scale. Four different types of divergence events can be detected. Divergences occur whenever the bull/bear bias of the method used diverges with the bar's price direction.
• An option allows you to include in divergence events instances where the count of neutral intrabars exceeds 50% of the total intrabar count.
• The divergence levels are dynamic levels that automatically build from the line's values on divergence events. On consecutive divergences, the levels will expand, creating a channel. This implementation of the divergence levels corresponds to my view that divergences indicate anomalies, hesitations, points of uncertainty if you will. It excludes any association of a pre-determined bullish/bearish bias to divergences. Accordingly, the levels merely take note of divergence events and mark those points in time with levels. Traders then have a reference point from which they can evaluate further movement. The bull/bear/neutral colors used to plot the levels are also congruent with this view in that they are determined by price's position relative to the levels, which is how I think divergences can be put to the most effective use.
5 — Background
• The background can show a bull/bear gradient on four different calculations. You can adjust its brightness to make its visual importance proportional to how you use it in your analysis.
6 — Chart bars
• Chart bars can be colored using five different methods.
• You have the option of emptying the body of bars where volume does not increase, as does my TLD indicator, the idea behind this being that movement on bars where volume does not increase is less relevant.
7 — Intrabar Resolution
You can choose between three modes. Two of them are automatic and one is manual:
a) Fast, Longer history, Auto-Steps (~12 intrabars) : Optimized for speed and deeper history. Uses an average minimum of 12 intrabars.
b) More Precise, Shorter History Auto-Steps (~24 intrabars) : Uses finer intrabar resolution. It is slower and provides less history. Uses an average minimum of 24 intrabars.
c) Fixed : Uses the fixed resolution of your choice.
Auto-Steps calculations vary for 24/7 and conventional markets in order to achieve the proper target of minimum intrabars.
You can choose to view the intrabar resolution currently used to calculate delta volume. It is the default.
The proper selection of the intrabar resolution is important. It must achieve maximal granularity to produce precise results while not unduly slowing down calculations, or worse, causing runtime errors.
8 — Markers
Six markers are available:
1. Combined Balances Agreement : All three Bar Balances are either bullish or bearish.
2. Up or Down % Agrees With Bar : An up marker will appear when the percentage of up intrabars in an up chart bar is greater than the specified percentage. Conditions mirror to down bars.
3. Divergence confirmations By Price : One of the four types of balance calculations can be used to detect divergences with price. Confirmations occur when the bar following the divergence confirms the balance bias. Note that the divergence events used here do not include neutral intrabar events.
4. Balance Transitions : Bull/bear transitions of the selected balance.
5. Markers Bias Transitions : Bull/bear transitions of the Markers Bias.
6. Divergence Confirmations By Line : Marks points where the line first breaches a divergence level.
Markers appear when the condition is detected, without delay. Since nothing is plotted in realtime, markers do not appear on the realtime bar.
9 — Settings
• Two modes can be selected to dampen the line on the ratio of neutral intrabars.
• A distinct weight can be attributed to the count of the latter half of intrabars, on the assumption that later intrabars may be more important in determining the outcome of chart bars.
• Allows control over the periods of the different moving averages used in calculations.
• The default periods used for the various calculations define the following hierarchy from slow to fast:
Balance Averages: 50,
Balance Momentum: 20,
Dual Up/Down Averages: 20,
Marker Bias: 10.
█ LIMITATIONS
• This script uses a special characteristic of the `security()` function allowing the inspection of intrabars—which is not officially supported by TradingView.
• The method used does not work on the realtime bar—only on historical bars.
• The indicator only works on some chart resolutions: 3, 5, 10, 15 and 30 minutes, 1, 2, 4, 6, and 12 hours, 1 day, 1 week and 1 month. The script’s code can be modified to run on other resolutions, but chart resolutions must be divisible by the lower resolution used for intrabars and the stepping mechanism could require adaptation.
• When using the "Line vs Divergence Levels — Dual Color Gradient" color mode to fill the line, background or chart bars, keep in mind that a line calculation mode must be defined for it to work, as it determines gradients on the movement of the line relative to divergence levels. If the line is hidden, it will not work.
• When the difference between the chart’s resolution and the intrabar resolution is too great, runtime errors will occur. The Auto-Steps selection mechanisms should avoid this.
• Alerts do not work reliably when `security()` is used at intrabar resolutions. Accordingly, no alerts are configured in the indicator.
• The color model used in the indicator provides for fancy visuals that come at a price; when you change values in Inputs , it can take 20 seconds for the changes to materialize. Luckily, once your color setup is complete, the color model does not have a large performance impact, as in normal operation the `security()` calls will become the most important factor in determining response time. Also, once in a while a runtime error will occur when you change inputs. Just making another change will usually bring the indicator back up.
█ RAMBLINGS
Is this thing useful?
I'll let you decide. Bar Balance acts somewhat like an X-Ray on bars. The intrabars it analyzes are no secret; one can simply change the chart's resolution to see the same intrabars the indicator uses. What the indicator brings to traders is the precise count of up/down/neutral intrabars and, more importantly, the calculations it derives from them to present the information in a way that can make it easier to use in trading decisions.
How reliable is Bar Balance information?
By the same token that an up bar does not guarantee that more up bars will follow, future price movements cannot be inferred from the mere count of up/down/neutral intrabars. Price movement during any chart bar for which, let's say, 12 intrabars are analyzed, could be due to only one of those intrabars. One can thus easily see how only relying on bar balance information could be very misleading. The rationale behind Bar Balance is that when the information mined for multiple chart bars is aggregated, it can provide insight into the history behind chart bars, and thus some bias as to the strength of movements. An up chart bar where 11/12 intrabars are also up is assumed to be stronger than the same up bar where only 2/12 intrabars are up. This logic is not bulletproof, and sometimes Bar Balance will stray. Also, keep in mind that balance lines do not represent price momentum as RSI would. Bar Balance calculations have no idea where price is. Their perspective, like that of any historian, is very limited, constrained that it is to the narrow universe of up/down/neutral intrabar counts. You will thus see instances where price is moving up while Balance Momentum, for example, is moving down. When Bar Balance performs as intended, this indicates that the rally is weakening, which does necessarily imply that price will reverse. Occasionally, price will merrily continue to advance on weakening strength.
Divergences
Most of the divergence detection methods used here rely on a difference between the bias of a calculation involving a multi-bar average and a given bar's price direction. When using "Bar Balance on Bar" however, only the bar's balance and price movement are used. This is the default mode.
As usual, divergences are points of interest because they reveal imbalances, which may or may not become turning points. I do not share the overwhelming enthusiasm traders have for the purported ability of bullish/bearish divergences to indicate imminent reversals.
Superfluity
In "The Bed of Procrustes", Nassim Nicholas Taleb writes: To bankrupt a fool, give him information . Bar Balance can display lots of information. While learning to use a new indicator inevitably requires an adaptation period where we put it through its paces and try out all its options, once you have become used to Bar Balance and decide to adopt it, rigorously eliminate the components you don't use and configure the remaining ones so their visual prominence reflects their relative importance in your analysis. I tried to provide flexible options for traders to control this indicator's visuals for that exact reason—not for window dressing.
█ NOTES
For traders
• To avoid misleading traders who don't read script descriptions, the indicator shows nothing in the realtime bar.
• The Data Window shows key values for the indicator.
• All gradients used in this indicator determine their brightness intensities using advances/declines in the signal—not their relative position in a fixed scale.
• Note that because of the way gradients are optimized internally, changing their brightness will sometimes require bringing down the value a few steps before you see an impact.
• Because this indicator does not use volume, it will work on all markets.
For coders
• For those interested in gradients, this script uses an advanced version of the Advance/Decline gradient function from the PineCoders Color Gradient (16 colors) Framework . It allows more precise control over the range, steps and min/max values of the gradients.
• I use the PineCoders Coding Conventions for Pine to write my scripts.
• I used functions modified from the PineCoders MTF Selection Framework for the selection of timeframes.
█ THANKS TO:
— alexgrover who helped me think through the dampening method used to attenuate signal lines on high ratios of neutral intrabars.
— A guy called Kuan who commented on a Backtest Rookies presentation of their Volume Profile indicator . The technique I use to inspect intrabars is derived from Kuan's code.
— theheirophant , my partner in the exploration of the sometimes weird abysses of `security()`’s behavior at intrabar resolutions.
— midtownsk8rguy , my brilliant companion in mining the depths of Pine graphics. He is also the co-author of the PineCoders Color Gradient Frameworks .
"乌德勒支+VS+赫拉克勒斯"に関するスクリプトを検索
RedK_Directional Index / K xDMIHere's a modern take on the famous DMI/ADX. i first wrote this on another platform few years ago, so i'm happy to be able to share it on TradingView
quick refresher: what does DMI/ADX tell us:
------------------------------------------------------
in simple terms, at the core of this indicator, there are 3 main calculations / lines: the Plus Directional Index ( +DI ) which represents how much the bulls are able to push the high of a bar compared to previous one, the Minus Directional Index ( -DI ), showing how much the bears are able to push the low of a bar from previous one, then the Average Directional index ( ADX ) line, which creates an oscillator of the +DI and -DI to represent the strength of a trend -- usually the lines will be colored accordingly (bulls = green, bears = red, and any different color for the ADX )
Similar to my version of the RSI , we take a classic concept, then use the computing and visualization "super powers" available to us today, to extend and improve on what those masters created in the past. I guess they sort of expected us to do exactly that :)
this "extended" version of DMI/ADX provides couple of highly needed features (in my opinion) -- let's explore:
trying as much as possible to avoid jargon - pls forgive me if i failed in some places.
-------------------------------------------------------------------------------------------------
1 - the big change: the ability to visualize the ADX in a way that makes some more sense.
- the original calculation restricted the ADX to oscillate below zero - i'm sure they had a good reason to build it that way in the past - but to me, it becomes super hard to interpret what the ADX line means, especially when a negative trend (the bears) take over. by removing that restriction and allowing the ADX to oscillate up or down (and we're free to do that, so the indicator shows *us* what *we need* to see), we end up with an improved representation of the trend and the trend strength.
- also the original calculation applies a moving average (default 14 bars) of a moving average (another 14 of the Directional Indexes, which represent the strength of bulls vs bears) to calculate the ADX - that makes the ADX very "removed" from the base price values - i change that, and just smooth the initial +Di / -Di then calculate the ADX from there. again, this shows me the outcome of the (relatively) immediate moves.
2 - i use weighted average WMA () in all my averaging calculations .. i believe this type of average is the best to express the importance of recent days / bars vs the ones further in the past, compared to other averaging techniques
3 - ability to make the DMI volume-weighted .. but contrary to my RSI , this is not set by default.
4 - couple of options to view the unrestricted ADX (as an area or as histogram/columns .. which i call Vertical Bars) for improved visualization
other stuff:
5 - a "step" option for the ADX .. you can set the step option to an increment of, say 5 or 10. this is in case you prefer to see the trend more in "quality" terms - so the equivalent of weak, medium, strong, v. strong...etc -- since in reality, a number like 47.7683 doesn't really mean anything specific
6 - optional "strong trend" adjustable level
Settings & usage suggestion:
-----------------------------------
i prefer to use the defaults (length = 7, smoothing = 3, ..etc) -- i believe these are more suitable to the much faster trading that we have now. you can review the comparison chart and see if this works for you, and adjust as you need.
from a "signal" standpoint, you can use the xDMI as you use the classic DMI/ADX, bulls (or bears) are in control when the corresponding DI line crosses the other going up, *AND* moving above the "strong trend" level that you can set as an extra filter (usually a value between 20 to 30), while ADX will show the quality/strength of the trend.
i suggest you also utilize this indicator with other trend / momentum confirmation methods, and additional analysis and not in isolation - as well as inspecting the prevailing / longer time frame to ensure you're acting in the direction of the broader move / trend.
the above chart includes a side-by-side comparison between our new xDMI with the classic DMI/ADX using the same settings - then we add at the bottom panel also the xDMI, but with my default (faster) settings and showing other visualization options that can be utilized - the Moving Averages on the top / price panel is just to help put the price movement into perspective in terms of trend and trend strength.
The code is open and commented - please feel free to use, share, comment & provide feedback. if you're a DMI fan, and you find this useful in your trading, i would be more than happy to hear about it
Good luck!
BEST Engulfing + Breakout StrategyHello traders
This is a simple algorithm for a Tradingview strategy tracking a convergence of 2 unrelated indicators.
Convergence is the solution to my trading problems.
It's a puzzle with infinite possibilities and only a few working combinations.
Here's one that I like
- Engulfing pattern
- Price vs Moving average for detecting a breakout
Definition
Take out the notebooks :) and some coffee (good for focus). I'm bullish in coffee
The engulfing pattern is a two-candle reversal pattern.
The second candle completely ‘engulfs’ the real body of the first one, without regard to the length of the tail shadows.
The bullish Engulfing pattern appears in a downtrend and is a combination of one red candle followed by a larger green candle
The bearish Engulfing pattern appears in a downtrend and is a combination of one green candle followed by a larger red candle
Example: imgur.com
We're bored sir... what's the point of all this?
In summary, an engulfing is a pattern to track reversals. (the whole TradingView audience stands up now giving a standing ovation)
Adding the Price vs Moving average filters allows to track reversals with momentums (half of the audience collapsed because this is too awesome)
Ok sir... you picked up my interest
I included some cool backtest filters:
- date range filtering
- flexible take profit in USD value (plotted in blue)
- flexible stop loss in USD value (plotted in red)
All the best
Dave
BTC Volume absolute (fiat vs Tether vs futures)BTC volume split by fiat, Tether and futures in USD
fiat = COINBASE + BITFLYER + BITSTAMP + KRAKEN
Tether = BITFINEX + BINANCE + HUOBI + HITBTC
futures = BITMEX + BYBIT
Premium/Discount (Input)Used to show Contango or Backwardation in futures contracts vs spot price. You can input your own tickers so can technically can be used to compare anything.
* In this example I'm showing Okex Quarterly contract vs Okex spot index price because it showcases it better.
* If you are using this after 2019 the default setting will not work because I set it to Bitmex which does not currently have a "current contract in front" ticker available.
It should be fairly self explanatory, but just ask below if you have any questions.
Volume Profile Free Ultra SLI (100 Levels Value Area VWAP) - RRBVolume Profile Free Ultra SLI by RagingRocketBull 2019
Version 1.0
This indicator calculates Volume Profile for a given range and shows it as a histogram consisting of 100 horizontal bars.
This is basically the MAX SLI version with +50 more Pinescript v4 line objects added as levels.
It can also show Point of Control (POC), Developing POC, Value Area/VWAP StdDev High/Low as dynamically moving levels.
Free accounts can't access Standard TradingView Volume Profile, hence this indicator.
There are several versions: Free Pro, Free MAX SLI, Free Ultra SLI, Free History. This is the Free Ultra SLI version. The Differences are listed below:
- Free Pro: 25 levels, +Developing POC, Value Area/VWAP High/Low Levels, Above/Below Area Dimming
- Free MAX SLI: 50 levels, 2x SLI modes for Buy/Sell or even higher res 150 levels
- Free Ultra SLI: 100 levels, packed to the limit, 2x SLI modes for Buy/Sell or even higher res 300 levels
- Free History: auto highest/lowest, historic poc/va levels for each session
Features:
- High-Res Volume Profile with up to 100 levels (line implementation)
- 2x SLI modes for even higher res: 300 levels with 3x vertical SLI, 100 buy/sell levels with 2x horiz SLI
- Calculate Volume Profile on full history
- POC, Developing POC Levels
- Buy/Sell/Total volume modes
- Side Cover
- Value Area, VAH/VAL dynamic levels
- VWAP High/Low dynamic levels with Source, Length, StdDev as params
- Show/Hide all levels
- Dim Non Value Area Zones
- Custom Range with Highlighting
- 3 Anchor points for Volume Profile
- Flip Levels Horizontally
- Adjustable width, offset and spacing of levels
- Custom Color for POC/VA/VWAP levels, Transparency for buy/sell levels
WARNING:
- Compilation Time: 1 min 20 sec
Usage:
- specify max_level/min_level/spacing (required)
- select range (start_bar, range length), confirm with range highlighting
- select volume type: Buy/Sell/Total
- select mode Value Area/VWAP to show corresponding levels
- flip/select anchor point to position the buy/sell levels
- use Horiz Buy/Sell SLI mode with 100 or Vertical SLI with 300 levels if needed
- use POC/Developing POC/VA/VWAP High/Low as S/R levels. Usually daily values from 1-3 days back are used as levels for the current day.
SLI:
use SLI modes to extend the functionality of the indicator:
- Horiz Buy/Sell 2x SLI lets you view 100 Buy/Sell Levels at the same time
- Vertical Max_Vol 3x SLI lets you increase the resolution to 300 levels
- you need at least 2 instances of the indicator attached to the same chart for SLI to work
1) Enable Horiz SLI:
- attach 2 indicator instances to the chart
- make sure all instances have the same min_level/max_level/range/spacing settings
- select volume type for each instance: you can have a buy/sell or buy/total or sell/total SLI. Make sure your buy volume instance is the last attached to be displayed on top of sell/total instances without overlapping.
- set buy_sell_sli_mode to true for indicator instances with volume_type = buy/sell, for type total this is optional.
- this basically tells the script to calculate % lengths based on total volume instead of individual buy/sell volumes and use ext offset for sell levels
- Sell Offset is calculated relative to Buy Offset to stack/extend sell after buy. Buy Offset = Zero - Buy Length. Sell Offset = Buy Offset - Sell Length = Zero - Buy Length - Sell Length
- there are no master/slave instances in this mode, all indicators are equal, poc/va levels are not affected and can work independently, i.e. one instance can show va levels, another - vwap.
2) Enable Vertical SLI:
- attach the first instance and evaluate the full range to roughly determine where is the highest max_vol/poc level i.e. 0..20000, poc is in the bottom half (third, middle etc) or
- add more instances and split the full vertical range between them, i.e. set min_level/max_level of each corresponding instance to 0..10000, 10000..20000 etc
- make sure all instances have the same range/spacing settings
- an instance with a subrange containing the poc level of the full range is now your master instance (bottom half). All other instances are slaves, their levels will be calculated based on the max_vol/poc of the master instance instead of local values
- set show_max_vol_sli to true for the master instance. for slave instances this is optional and can be used to check if master/slave max_vol values match and slave can read the master's value. This simply plots the max_vol value
- you can also attach all instances and set show_max_vol_sli to true in all of them - the instance with the largest max_vol should become the master
Auto/Manual Ext Max_Vol Modes:
- for auto vertical max_vol SLI mode set max_vol_sli_src in all slave instances to the max_vol of the master indicator: "VolumeProfileFree_MAX_RRB: Max Volume for Vertical SLI Mode". It can be tricky with 2+ instances
- in case auto SLI mode doesn't work - assign max_vol_sli_ext in all slave instances the max_vol value of the master indicator manually and repeat on each change
- manual override max_vol_sli_ext has higher priority than auto max_vol_sli_src when both values are assigned, when they are 0 and close respectively - SLI is disabled
- master/slave max_vol values must match on each bar at all times to maintain proper level scale, otherwise slave's levels will look larger than they should relative to the master's levels.
- Max_vol (red) is the last param in the long list of indicator outputs
- the only true max_vol/poc in this SLI mode is the master's max_vol/poc. All poc/va levels in slaves will be irrelevant and are disabled automatically. Slaves can only show VWAP levels.
- VA Levels of the master instance in this SLI mode are calculated based on the subrange, not the whole range and may be inaccurate. Cross check with the full range.
WARNING!
- auto mode max_vol_sli_src is experimental and may not work as expected
- you can only assign auto mode max_vol_sli_src = max_vol once due to some bug with unhandled exception/buffer overflow in Tradingview. Seems that you can clear the value only by removing the indicator instance
- sometimes you may see a "study in error state" error when attempting to set it back to close. Remove indicator/Reload chart and start from scratch
- volume profile may not finish to redraw and freeze in an ugly shape after an UI parameter change when max_vol_sli_src is assigned a max_vol value. Assign it to close - VP should redraw properly, but it may not clear the assigned max_vol value
- you can't seem to be able to assign a proper auto max_vol value to the 3rd slave instance
- 2x Vertical SLI works and tested in both auto/manual, 3x SLI - only manual seems to work (you can have a mixed mode: 2nd instance - auto, 3rd - manual)
Notes:
- This code uses Pinescript v3 compatibility framework
- This code is 20x-30x faster (main for cycle is removed) especially on lower tfs with long history - only 4-5 sec load/redraw time vs 30-60 sec of the old Pro versions
- Instead of repeatedly calculating the total sum of volumes for the whole range on each bar, vol sums are now increased on each bar and passed to the next in the range making it a per range vs per bar calculation that reduces time dramatically
- 100 levels consist of 50 main plot levels and 50 line objects used as alternate levels, differences are:
- line objects are always shown on top of other objects, such as plot levels, zero line and side cover, it's not possible to cover/move them below.
- all line objects have variable lengths, use actual x,y coords and don't need side cover, while all plot levels have a fixed length of 100 bars, use offset and require cover.
- all key properties of line objects, such as x,y coords, color can be modified, objects can be moved/deleted, while this is not possible for static plot levels.
- large width values cause line objects to expand only up/down from center while their length remains the same and stays within the level's start/end points similar to an area style.
- large width values make plot levels expand in all directions (both h/v), beyond level start/end points, sometimes overlapping zero line, making them an inaccurate % length representation, as opposed to line objects/plot levels with area style.
- large width values translate into different widths on screen for line objects and plot levels.
- you can't compensate for this unwanted horiz width expansion of plot levels because width uses its own units, that don't translate into bars/pixels.
- line objects are visible only when num_levels > 50, plot levels are used otherwise
- Since line objects are lines, plot levels also use style line because other style implementations will break the symmetry/spacing between levels.
- if you don't see a volume profile check range settings: min_level/max_level and spacing, set spacing to 0 (or adjust accordingly based on the symbol's precision, i.e. 0.00001)
- you can view either of Buy/Sell/Total volumes, but you can't display Buy/Sell levels at the same time using a single instance (this would 2x reduce the number of levels). Use 2 indicator instances in horiz buy/sell sli mode for that.
- Volume Profile/Value Area are calculated for a given range and updated on each bar. Each level has a fixed length. Offsets control visible level parts. Side Cover hides the invisible parts.
- Custom Color for POC/VA/VWAP levels - UI Style color/transparency can only change shape's color and doesn't affect textcolor, hence this additional option
- Custom Width - UI Style supports only width <= 4, hence this additional option
- POC is visible in both modes. In VWAP mode Developing POC becomes VWAP, VA High and Low => VWAP High and Low correspondingly to minimize the number of plot outputs
- You can't change buy/sell level colors from input (only transparency) - this requires 2x plot outputs => 2x reduces the number of levels to fit the max 64 limit. That's why 2 additional plots are used to dim the non Value Area zones
- You can change level transparency of line objects. Due to Pinescript limitations, only discrete values are supported.
- Inverse transp correlation creates the necessary illusion of "covered" line objects, although they are shown on top of the cover all the time
- If custom lines_transp is set the illusion will break because transp range can't be skewed easily (i.e. transp 0..100 is always mapped to 100..0 and can't be mapped to 50..0)
- transparency can applied to lines dynamically but nva top zone can't be completely removed because plot/mixed type of levels are still used when num_levels < 50 and require cover
- transparency can't be applied to plot levels dynamically from script this can be done only once from UI, and you can't change plot color for the past length bars
- All buy/sell volume lengths are calculated as % of a fixed base width = 100 bars (100%). You can't set show_last from input to change it
- Range selection/Anchoring is not accurate on charts with time gaps since you can only anchor from a point in the future and measure distance in time periods, not actual bars, and there's no way of knowing the number of future gaps in advance.
- Adjust Width for Log Scale mode now also works on high precision charts with small prices (i.e. 0.00001)
- in Adjust Width for Log Scale mode Level1 width extremes can be capped using max deviation (when level1 = 0, shift = 0 width becomes infinite)
- There's no such thing as buy/sell volume, there's just volume, but for the purposes of the Volume Profile method, assume: bull candle = buy volume, bear candle = sell volume
P.S. I am your grandfather, Luke! Now, join the Dark Side in your father's steps or be destroyed! Once more the Sith will rule the Galaxy, and we shall have peace...
Hull MA and Candle crossHull MA vs price cossover . not 2 Hull MA's crossing, and also a price vs previous price crossover :
current price higher than previous = buy
current price lower than previous = sell
Price value set to OPEN to avoid repaint during candle
Volume Profile Free MAX SLI (50 Levels Value Area VWAP) by RRBVolume Profile Free MAX SLI by RagingRocketBull 2019
Version 1.0
All available Volume Profile Free MAX SLI versions are listed below (They are very similar and I don't want to publish them as separate indicators):
ver 1.0: style columns implementation
ver 2.0: style histogram implementation
ver 3.0: style line implementation
This indicator calculates Volume Profile for a given range and shows it as a histogram consisting of 50 horizontal bars.
It can also show Point of Control (POC), Developing POC, Value Area/VWAP StdDev High/Low as dynamically moving levels.
Free accounts can't access Standard TradingView Volume Profile, hence this indicator.
There are several versions: Free Pro, Free MAX SLI, Free History. This is the Free MAX SLI version. The Differences are listed below:
- Free Pro: 25 levels, +Developing POC, Value Area/VWAP High/Low Levels, Above/Below Area Dimming
- Free MAX SLI: 50 levels, packed to the limit, 2x SLI modes for Buy/Sell or even higher res 150 levels
- Free History: auto highest/lowest, historic poc/va levels for each session
Features:
- High-Res Volume Profile with up to 50 levels (3 implementations)
- 20-30x faster than the old Pro versions especially on lower tfs with long history
- 2x SLI modes for even higher res: 150 levels with 3x vertical SLI, 50 buy/sell levels with 2x horiz SLI
- Calculate Volume Profile on full history
- POC, Developing POC Levels
- Buy/Sell/Total volume modes
- Side Cover
- Value Area, VAH/VAL dynamic levels
- VWAP High/Low dynamic levels with Source, Length, StdDev as params
- Show/Hide all levels
- Dim Non Value Area Zones
- Custom Range with Highlighting
- 3 Anchor points for Volume Profile
- Flip Levels Horizontally
- Adjustable width, offset and spacing of levels
- Custom Color for POC/VA/VWAP levels and Transparency for buy/sell levels
Usage:
- specify max_level/min_level/spacing (required)
- select range (start_bar, range length), confirm with range highlighting
- select volume type: Buy/Sell/Total
- select mode Value Area/VWAP to show corresponding levels
- flip/select anchor point to position the buy/sell levels
- use Horiz SLI mode for 50 Buy/Sell or Vertical SLI for 150 levels if needed
- use POC/Developing POC/VA/VWAP High/Low as S/R levels. Usually daily values from 1-3 days back are used as levels for the current day.
SLI:
- use SLI modes to extend the functionality of the indicator:
- Horiz Buy/Sell 2x SLI lets you view 50 Buy/Sell Levels at the same time
- Vertical Max_Vol 3x SLI lets you increase the resolution to 150 levels
- you need at least 2 instances of the indicator attached to the same chart for SLI to work
1) Enable Horiz SLI:
- attach 2 indicator instances to the chart
- make sure all instances have the same min_level/max_level/range/spacing settings
- select volume type for each instance: you can have a buy/sell or buy/total or sell/total SLI. Make sure your buy volume instance is the last attached to be displayed on top of sell/total instances without overlapping.
- set buy_sell_sli_mode to true for indicator instances with volume_type = buy/sell, for type total this is optional.
- this basically tells the script to calculate % lengths based on total volume instead of individual buy/sell volumes and use ext offset for sell levels
- Sell Offset is calculated relative to Buy Offset to stack/extend sell after buy. Buy Offset = Zero - Buy Length. Sell Offset = Buy Offset - Sell Length = Zero - Buy Length - Sell Length
- there are no master/slave instances in this mode, all indicators are equal, poc/va levels are not affected and can work independently, i.e. one instance can show va levels, another - vwap.
2) Enable Vertical SLI:
- attach the first instance and evaluate the full range to roughly determine where is the highest max_vol/poc level i.e. 0..20000, poc is in the bottom half (third, middle etc) or
- add more instances and split the full vertical range between them, i.e. set min_level/max_level of each corresponding instance to 0..10000, 10000..20000 etc
- make sure all instances have the same range/spacing settings
- an instance with a subrange containing the poc level of the full range is now your master instance (bottom half). All other instances are slaves, their levels will be calculated based on the max_vol/poc of the master instance instead of local values
- set show_max_vol_sli to true for the master instance. for slave instances this is optional and can be used to check if master/slave max_vol values match and slave can read the master's value. This simply plots the max_vol value
- you can also attach all instances and set show_max_vol_sli to true in all of them - the instance with the largest max_vol should become the master
Auto/Manual Ext Max_Vol Modes:
- for auto vertical max_vol SLI mode set max_vol_sli_src in all slave instances to the max_vol of the master indicator: "VolumeProfileFree_MAX_RRB: Max Volume for Vertical SLI Mode". It can be tricky with 2+ instances
- in case auto SLI mode doesn't work - assign max_vol_sli_ext in all slave instances the max_vol value of the master indicator manually and repeat on each change
- manual override max_vol_sli_ext has higher priority than auto max_vol_sli_src when both values are assigned, when they are 0 and close respectively - SLI is disabled
- master/slave max_vol values must match on each bar at all times to maintain proper level scale, otherwise slave's levels will look larger than they should relative to the master's levels.
- Max_vol (red) is the last param in the long list of indicator outputs
- the only true max_vol/poc in this SLI mode is the master's max_vol/poc. All poc/va levels in slaves will be irrelevant and are disabled automatically. Slaves can only show VWAP levels.
- VA Levels of the master instance in this SLI mode are calculated based on the subrange, not the whole range. Cross check with the full range.
WARNING!
- auto mode max_vol_sli_src is experimental and may not work as expected
- you can only assign auto mode max_vol_sli_src = max_vol once due to some bug with unhandled exception/buffer overflow in Tradingview. Seems that you can clear the value only by removing the indicator instance
- sometimes you may see a "study in error state" error when attempting to set it back to close. Remove indicator/Reload chart and start from scratch
- volume profile may not finish to redraw and freeze in an ugly shape after an UI parameter change when max_vol_sli_src is assigned a max_vol value. Assign it to close - VP should redraw properly, but it may not clear the assigned max_vol value
- you can't seem to be able to assign a proper auto max_vol value to the 3rd slave instance
- 2x Vertical SLI works and tested in both auto/manual, 3x SLI - only manual seems to work
Notes:
- This code is 20x-30x faster (main for cycle is removed) especially on lower tfs with long history - only 2-3 sec load/redraw time vs 30-60 sec of the old Pro versions
- Instead of repeatedly calculating the total sum of volumes for the whole range on each bar, vol sums are now increased on each bar and passed to the next in the range making it a per range vs per bar calculation that reduces time dramatically
- hist_base for levels still results is ugly redraw
- if you don't see a volume profile check range settings: min_level/max_level and spacing, set spacing to 0 (or adjust accordingly based on the symbol's precision, i.e. 0.00001)
- you can view either of Buy/Sell/Total volumes, but you can't display Buy/Sell levels at the same time using a single instance (this would 2x reduce the number of levels). Use 2 indicator instances in horiz buy/sell sli mode for that.
- Volume Profile/Value Area are calculated for a given range and updated on each bar. Each level has a fixed length. Offsets control visible level parts. Side Cover hides the invisible parts.
- Custom Color for POC/VA/VWAP levels - UI Style color/transparency can only change shape's color and doesn't affect textcolor, hence this additional option
- Custom Width - UI Style supports only width <= 4, hence this additional option
- POC is visible in both modes. In VWAP mode Developing POC becomes VWAP, VA High and Low => VWAP High and Low correspondingly to minimize the number of plot outputs
- You can't change buy/sell level colors from input (only plot transparency) - this requires 2x plot outputs => 2x reduces the number of levels to fit the max 64 limit. That's why 2 additional plots are used to dim the non Value Area zones
- All buy/sell volume lengths are calculated as % of a fixed base width = 100 bars (100%). You can't set show_last from input to change it
- There's no such thing as buy/sell volume, there's just volume, but for the purposes of the Volume Profile method, assume: bull candle = buy volume, bear candle = sell volume
P.S. Gravitonium Levels Are Increasing. Unobtainium is nowhere to be found!
Links on Volume Profile and Value Area calculation and usage:
www.tradingview.com
stockcharts.com
onlinelibrary.wiley.com
Bitfinex Margin ComparisonDisplays the RSI of Longs vs Shorts from Bitfinex for most majors ( BTC , ETH, LTC, XRP, EOS, NEO).
Displays RSI of both longs and shorts to gauge the short term momentum of both while also showing the ratio of Longs vs Shorts as the background.
Premium ComparisonScript to display futures premium/discount vs basis; uses Bitmex XBTUSD 10.99% as basis vs XBTM18 and XBTU18 futures , but these are configurable.
ST_Trend_ReversalSTRONG TREND REVERSAL INDICATOR
The code is the percentage difference between the spot price of a given financial asset and its 200-day MA of that period. My standard setup is Daily, and I think it's got very good predictive power at that timeframe.
It can be read in two ways:
1. Values extremely above or below the 200-period MA present chances of buying/selling agains the prevailing trend.
2. Values closely above or below the 200-period MA are make-or-break market periods, where a medium-term trend becomes evident. Breaks above or below the MA are associated with strong chances of directional movements. But it's not fool-proof as false breaks have become commonplace nowadays.
Other way to use it is as confirmation of breakdowns: For example, an asset that loses its 200-day MA and then can't rally above it becomes exposed to steep losses afterwards.
It's also helpful to use in volatility trading: the closer the asset goes to its MA, the lower goes implied vol, and thus better opportiunities to be long volatility on those occasions where direction is hard to predict.
STRI = close/(200dMA)
Values over 100 indicate percentage premiums of spot vs its moving average.
Values below indicate percentage discounts of spot vs its moving average.
Ersoy-intersection(Kesisme)-Update-1website: www.ersoytoptas.com
Newspaper : tr.investing.com
hi , Friends
i wanna be someone who wants to help everyone
updated my script he published some time ago.
What happened?
* intersection When ever Bar Color Yellow Be
* Alarms to be more comprehensible
* Short and Long Days Choosing a Opportunities
* Source Opportunities
All Charts Usable( Example ;15,30,60 ... vs) and ALL MARKETS ( Stocks , forex , ... vs)
i strive to improve further
Easy to get
VIX vs VIX1Y SpreadSpread Calculation: Shows VIX1Y minus VIX
Positive = longer-term vol higher (normal contango)
Negative = near-term vol elevated (inverted term structure)
Can help identify longer term risk pricing of equity assets.
Sector Rotation - Risk Preference Indicator# Sector Rotation - Risk Preference Indicator
## Overview
This indicator measures market risk appetite by comparing the relative strength between **Aggressive** and **Defensive** sectors. It provides a clean, single-line visualization to help traders identify market sentiment shifts and potential trend reversals.
## How It Works
The indicator calculates a **Bullish/Bearish Ratio** by dividing the average price of aggressive sector ETFs by defensive sector ETFs, then normalizing to a baseline of 100.
**Formula:**
- Ratio = (Aggressive Sectors Average / Defensive Sectors Average) × 100
**Interpretation:**
- **Ratio > 100**: Risk-on sentiment (Aggressive sectors outperforming Defensive)
- **Ratio < 100**: Risk-off sentiment (Defensive sectors outperforming Aggressive)
- **Ratio ≈ 100**: Neutral (Both sector groups performing equally)
## Default Sectors
**Defensive Sectors** (Safe havens during uncertainty):
- XLP - Consumer Staples Select Sector SPDR Fund
- XLU - Utilities Select Sector SPDR Fund
- XLV - Health Care Select Sector SPDR Fund
**Aggressive Sectors** (Growth-oriented, higher risk):
- XLK - Technology Select Sector SPDR Fund
- XBI - SPDR S&P Biotech ETF
- XRT - SPDR S&P Retail ETF
## Features
✅ **Fully Customizable Sectors** - Choose any ETFs/tickers for each sector group
✅ **Smoothing Control** - Adjustable SMA period to reduce noise (default: 2)
✅ **Clean Visualization** - Single blue line for easy interpretation
✅ **Multi-timeframe Support** - Works on any timeframe
✅ **Lightweight** - Minimal calculations for fast performance
## Settings
### Defensive Sectors Group
- **Defensive Sector 1**: First defensive ETF ticker (default: XLP)
- **Defensive Sector 2**: Second defensive ETF ticker (default: XLU)
- **Defensive Sector 3**: Third defensive ETF ticker (default: XLV)
### Aggressive Sectors Group
- **Aggressive Sector 1**: First aggressive ETF ticker (default: XLK)
- **Aggressive Sector 2**: Second aggressive ETF ticker (default: XBI)
- **Aggressive Sector 3**: Third aggressive ETF ticker (default: XRT)
### Display Settings
- **Smoothing Length**: SMA period for ratio smoothing (default: 2, range: 1-50)
- Lower values = More responsive but noisier
- Higher values = Smoother but more lagging
## Use Cases
### 1. Market Regime Identification
- **Rising Ratio (trending up)** → Bull market / Risk-on environment
- Aggressive sectors leading, investors chasing growth
- Favorable for long positions in tech, growth stocks
- **Falling Ratio (trending down)** → Bear market / Risk-off environment
- Defensive sectors leading, investors seeking safety
- Consider defensive positioning or short opportunities
### 2. Divergence Analysis
- **Bullish Divergence**: Price makes new lows but ratio rises
- Suggests underlying strength returning
- Potential market bottom forming
- **Bearish Divergence**: Price makes new highs but ratio falls
- Suggests weakening momentum
- Potential market top forming
### 3. Trend Confirmation
- **Strong uptrend + Rising ratio** → Confirmed bullish trend
- **Strong downtrend + Falling ratio** → Confirmed bearish trend
- **Uptrend + Falling ratio** → Weakening trend, watch for reversal
- **Downtrend + Rising ratio** → Potential trend exhaustion
## Best Practices
⚠️ **Timeframe Selection**
- Recommended: Daily, 4H, 1H for cleaner signals
- Lower timeframes (15m, 5m) may produce noisy signals
⚠️ **Complementary Analysis**
- Use alongside price action and volume analysis
- Combine with support/resistance levels
- Not designed as a standalone trading system
⚠️ **Market Conditions**
- Most effective in trending markets
- Less reliable during ranging/consolidation periods
- Works best in liquid, well-traded sectors
⚠️ **Customization Tips**
- Can substitute with international sectors (EWU, EWZ, etc.)
- Can use crypto sectors (DeFi vs Layer1, etc.)
- Adjust smoothing based on trading style (day trading = 2-5, swing = 10-20)
## Display Options
### Default View (overlay=false)
- Shows in separate pane below chart
- Dedicated scale for ratio values
### Alternative View
- Can be moved to main chart pane (drag indicator)
I typically overlay this indicator on the SPY daily chart to observe divergences. I don’t focus on specific values but rather on the direction of the trend.
The author is not responsible for any trading losses incurred using this indicator.
## Support & Feedback
For questions, feature requests, or bug reports:
- Comment below
- Send a private message
- Check for updates regularly
If you find this indicator useful, please:
- ⭐ Leave a like/favorite
- 💬 Share your experience in comments
- 📊 Share charts showing interesting patterns
VIX Futures Spread (VX1 - VX2)Calculate the currente VIX front vs next contract spread.
Allow to identify if the market is in Contango or Backwardation
Display the result as a color coded histogram
Historical Volatility EstimatorsHistorical volatility is a statistical measure of the dispersion of returns for a given security or market index over a given period. This indicator provides different historical volatility model estimators with percentile gradient coloring and volatility stats panel.
█ OVERVIEW There are multiple ways to estimate historical volatility. Other than the traditional close-to-close estimator. This indicator provides different range-based volatility estimators that take high low open into account for volatility calculation and volatility estimators that use other statistics measurements instead of standard deviation. The gradient coloring and stats panel provides an overview of how high or low the current volatility is compared to its historical values.
█ CONCEPTS We have mentioned the concepts of historical volatility in our previous indicators, Historical Volatility, Historical Volatility Rank, and Historical Volatility Percentile. You can check the definition of these scripts. The basic calculation is just the sample standard deviation of log return scaled with the square root of time. The main focus of this script is the difference between volatility models.
Close-to-Close HV Estimator: Close-to-Close is the traditional historical volatility calculation. It uses sample standard deviation. Note: the TradingView build in historical volatility value is a bit off because it uses population standard deviation instead of sample deviation. N – 1 should be used here to get rid of the sampling bias.
Pros:
• Close-to-Close HV estimators are the most commonly used estimators in finance. The calculation is straightforward and easy to understand. When people reference historical volatility, most of the time they are talking about the close to close estimator.
Cons:
• The Close-to-close estimator only calculates volatility based on the closing price. It does not take account into intraday volatility drift such as high, low. It also does not take account into the jump when open and close prices are not the same.
• Close-to-Close weights past volatility equally during the lookback period, while there are other ways to weight the historical data.
• Close-to-Close is calculated based on standard deviation so it is vulnerable to returns that are not normally distributed and have fat tails. Mean and Median absolute deviation makes the historical volatility more stable with extreme values.
Parkinson Hv Estimator:
• Parkinson was one of the first to come up with improvements to historical volatility calculation. • Parkinson suggests using the High and Low of each bar can represent volatility better as it takes into account intraday volatility. So Parkinson HV is also known as Parkinson High Low HV. • It is about 5.2 times more efficient than Close-to-Close estimator. But it does not take account into jumps and drift. Therefore, it underestimates volatility. Note: By Dividing the Parkinson Volatility by Close-to-Close volatility you can get a similar result to Variance Ratio Test. It is called the Parkinson number. It can be used to test if the market follows a random walk. (It is mentioned in Nassim Taleb's Dynamic Hedging book but it seems like he made a mistake and wrote the ratio wrongly.)
Garman-Klass Estimator:
• Garman Klass expanded on Parkinson’s Estimator. Instead of Parkinson’s estimator using high and low, Garman Klass’s method uses open, close, high, and low to find the minimum variance method.
• The estimator is about 7.4 more efficient than the traditional estimator. But like Parkinson HV, it ignores jumps and drifts. Therefore, it underestimates volatility.
Rogers-Satchell Estimator:
• Rogers and Satchell found some drawbacks in Garman-Klass’s estimator. The Garman-Klass assumes price as Brownian motion with zero drift.
• The Rogers Satchell Estimator calculates based on open, close, high, and low. And it can also handle drift in the financial series.
• Rogers-Satchell HV is more efficient than Garman-Klass HV when there’s drift in the data. However, it is a little bit less efficient when drift is zero. The estimator doesn’t handle jumps, therefore it still underestimates volatility.
Garman-Klass Yang-Zhang extension:
• Yang Zhang expanded Garman Klass HV so that it can handle jumps. However, unlike the Rogers-Satchell estimator, this estimator cannot handle drift. It is about 8 times more efficient than the traditional estimator.
• The Garman-Klass Yang-Zhang extension HV has the same value as Garman-Klass when there’s no gap in the data such as in cryptocurrencies.
Yang-Zhang Estimator:
• The Yang Zhang Estimator combines Garman-Klass and Rogers-Satchell Estimator so that it is based on Open, close, high, and low and it can also handle non-zero drift. It also expands the calculation so that the estimator can also handle overnight jumps in the data.
• This estimator is the most powerful estimator among the range-based estimators. It has the minimum variance error among them, and it is 14 times more efficient than the close-to-close estimator. When the overnight and daily volatility are correlated, it might underestimate volatility a little.
• 1.34 is the optimal value for alpha according to their paper. The alpha constant in the calculation can be adjusted in the settings. Note: There are already some volatility estimators coded on TradingView. Some of them are right, some of them are wrong. But for Yang Zhang Estimator I have not seen a correct version on TV.
EWMA Estimator:
• EWMA stands for Exponentially Weighted Moving Average. The Close-to-Close and all other estimators here are all equally weighted.
• EWMA weighs more recent volatility more and older volatility less. The benefit of this is that volatility is usually autocorrelated. The autocorrelation has close to exponential decay as you can see using an Autocorrelation Function indicator on absolute or squared returns. The autocorrelation causes volatility clustering which values the recent volatility more. Therefore, exponentially weighted volatility can suit the property of volatility well.
• RiskMetrics uses 0.94 for lambda which equals 30 lookback period. In this indicator Lambda is coded to adjust with the lookback. It's also easy for EWMA to forecast one period volatility ahead.
• However, EWMA volatility is not often used because there are better options to weight volatility such as ARCH and GARCH.
Adjusted Mean Absolute Deviation Estimator:
• This estimator does not use standard deviation to calculate volatility. It uses the distance log return is from its moving average as volatility.
• It’s a simple way to calculate volatility and it’s effective. The difference is the estimator does not have to square the log returns to get the volatility. The paper suggests this estimator has more predictive power.
• The mean absolute deviation here is adjusted to get rid of the bias. It scales the value so that it can be comparable to the other historical volatility estimators.
• In Nassim Taleb’s paper, he mentions people sometimes confuse MAD with standard deviation for volatility measurements. And he suggests people use mean absolute deviation instead of standard deviation when we talk about volatility.
Adjusted Median Absolute Deviation Estimator:
• This is another estimator that does not use standard deviation to measure volatility.
• Using the median gives a more robust estimator when there are extreme values in the returns. It works better in fat-tailed distribution.
• The median absolute deviation is adjusted by maximum likelihood estimation so that its value is scaled to be comparable to other volatility estimators.
█ FEATURES
• You can select the volatility estimator models in the Volatility Model input
• Historical Volatility is annualized. You can type in the numbers of trading days in a year in the Annual input based on the asset you are trading.
• Alpha is used to adjust the Yang Zhang volatility estimator value.
• Percentile Length is used to Adjust Percentile coloring lookbacks.
• The gradient coloring will be based on the percentile value (0- 100). The higher the percentile value, the warmer the color will be, which indicates high volatility. The lower the percentile value, the colder the color will be, which indicates low volatility.
• When percentile coloring is off, it won’t show the gradient color.
• You can also use invert color to make the high volatility a cold color and a low volatility high color. Volatility has some mean reversion properties. Therefore when volatility is very low, and color is close to aqua, you would expect it to expand soon. When volatility is very high, and close to red, you would it expect it to contract and cool down.
• When the background signal is on, it gives a signal when HVP is very low. Warning there might be a volatility expansion soon.
• You can choose the plot style, such as lines, columns, areas in the plotstyle input.
• When the show information panel is on, a small panel will display on the right.
• The information panel displays the historical volatility model name, the 50th percentile of HV, and HV percentile. 50 the percentile of HV also means the median of HV. You can compare the value with the current HV value to see how much it is above or below so that you can get an idea of how high or low HV is. HV Percentile value is from 0 to 100. It tells us the percentage of periods over the entire lookback that historical volatility traded below the current level. Higher HVP, higher HV compared to its historical data. The gradient color is also based on this value.
█ HOW TO USE If you haven’t used the hvp indicator, we suggest you use the HVP indicator first. This indicator is more like historical volatility with HVP coloring. So it displays HVP values in the color and panel, but it’s not range bound like the HVP and it displays HV values. The user can have a quick understanding of how high or low the current volatility is compared to its historical value based on the gradient color. They can also time the market better based on volatility mean reversion. High volatility means volatility contracts soon (Move about to End, Market will cooldown), low volatility means volatility expansion soon (Market About to Move).
█ FINAL THOUGHTS HV vs ATR The above volatility estimator concepts are a display of history in the quantitative finance realm of the research of historical volatility estimations. It's a timeline of range based from the Parkinson Volatility to Yang Zhang volatility. We hope these descriptions make more people know that even though ATR is the most popular volatility indicator in technical analysis, it's not the best estimator. Almost no one in quant finance uses ATR to measure volatility (otherwise these papers will be based on how to improve ATR measurements instead of HV). As you can see, there are much more advanced volatility estimators that also take account into open, close, high, and low. HV values are based on log returns with some calculation adjustment. It can also be scaled in terms of price just like ATR. And for profit-taking ranges, ATR is not based on probabilities. Historical volatility can be used in a probability distribution function to calculated the probability of the ranges such as the Expected Move indicator. Other Estimators There are also other more advanced historical volatility estimators. There are high frequency sampled HV that uses intraday data to calculate volatility. We will publish the high frequency volatility estimator in the future. There's also ARCH and GARCH models that takes volatility clustering into account. GARCH models require maximum likelihood estimation which needs a solver to find the best weights for each component. This is currently not possible on TV due to large computational power requirements. All the other indicators claims to be GARCH are all wrong.
Superior-Range Bound Renko - Alerts - 11-29-25 - Signal LynxSuperior-Range Bound Renko – Alerts Edition with Advanced Risk Management Template
Signal Lynx | Free Scripts supporting Automation for the Night-Shift Nation 🌙
1. Overview
This is the Alerts & Indicator Edition of Superior-Range Bound Renko (RBR).
The Strategy version is built for backtesting inside TradingView.
This Alerts version is built for automation: it emits clean, discrete alert events that you can route into webhooks, bots, or relay engines (including your own Signal Lynx-style infrastructure).
Under the hood, this script contains the same core engine as the strategy:
Adaptive Range Bounding based on volatility
Renko Brick Emulation on standard candles
A stack of Laguerre Filters for impulse detection
K-Means-style Adaptive SuperTrend for trend confirmation
The full Signal Lynx Risk Management Engine (state machine, layered exits, AATS, RSIS, etc.)
The difference is in what we output:
Instead of placing historical trades, this version:
Plots the entry and RM signals in a separate pane (overlay = false)
Exposes alertconditions for:
Long Entry
Short Entry
Close Long
Close Short
TP1, TP2, TP3 hits (Staged Take Profit)
This makes it ideal as the signal source for automated execution via TradingView Alerts + Webhooks.
2. Quick Action Guide (TL;DR)
Best Timeframe:
4H and above. This is a swing-trading / position-trading style engine, not a micro-scalper.
Best Assets:
Volatile but structured markets, e.g.:
BTC, ETH, XAUUSD (Gold), GBPJPY, and similar high-volatility majors or indices.
Script Type:
indicator() – Alerts & Visualization Only
No built-in order placement
All “orders” are emitted as alerts for your external bot or manual handling
Strategy Type:
Volatility-Adaptive Trend Following + Impulse Detection
using Renko-like structure and multi-layer Laguerre filters.
Repainting:
Designed to be non-repainting on closed candles.
The underlying Risk Management engine is built around previous-bar data (close , high , low ) for execution-critical logic.
Intrabar values can move while the bar is forming (normal for any advanced signal), but once a bar closes, the alert logic is stable.
Recommended Alert Settings:
Condition: one of the built-in signals (see section 3.B)
Options: “Once Per Bar Close” is strongly recommended for automation
Message: JSON, CSV, or simple tokens – whatever your webhook / relay expects
3. Detailed Report: How the Alerts Edition Works
A. Relationship to the Strategy Version
The Alerts Edition shares the same internal logic as the strategy version:
Same Adaptive Lookback and volatility normalization
Same Range and Close Range construction
Same Renko Brick Emulator and directional memory (renkoDir)
Same Fib structures, Laguerre stack, K-Means SuperTrend, and Baseline signals (B1, B2)
Same Risk Management Engine and layered exits
In the strategy script, these signals are wired into strategy.entry, strategy.exit, and strategy.close.
In the alerts script:
We still compute the final entry/exit signals (Fin, CloseEmAll, TakeProfit1Plot, etc.)
Instead of placing trades, we:
Plot them for visual inspection
Expose them via alertcondition(...) so that TradingView can fire alerts.
This ensures that:
If you use the same settings on the same symbol/timeframe, the Alerts Edition and Strategy Edition agree on where entries and exits occur.
(Subject only to normal intrabar vs. bar-close differences.)
B. Signals & Alert Conditions
The alerts script focuses on discrete, automation-friendly events.
Internally, the main signals are:
Fin – Final entry decision from the RM engine
CloseEmAll – RM-driven “hard close” signal (for full-position exits)
TakeProfit1Plot / 2Plot / 3Plot – One-time event markers when each TP stage is hit
On the chart (in the separate indicator pane), you get:
plot(Fin) – where:
+2 = Long Entry event
-2 = Short Entry event
plot(CloseEmAll) – where:
+1 = “Close Long” event
-1 = “Close Short” event
plot(TP1/TP2/TP3) (if Staged TP is enabled) – integer tags for TP hits:
+1 / +2 / +3 = TP1 / TP2 / TP3 for Longs
-1 / -2 / -3 = TP1 / TP2 / TP3 for Shorts
The corresponding alertconditions are:
Long Entry
alertcondition(Fin == 2, title="Long Entry", message="Long Entry Triggered")
Fire this to open/scale a long position in your bot.
Short Entry
alertcondition(Fin == -2, title="Short Entry", message="Short Entry Triggered")
Fire this to open/scale a short position.
Close Long
alertcondition(CloseEmAll == 1, title="Close Long", message="Close Long Triggered")
Fire this to fully exit a long position.
Close Short
alertcondition(CloseEmAll == -1, title="Close Short", message="Close Short Triggered")
Fire this to fully exit a short position.
TP 1 Hit
alertcondition(TakeProfit1Plot != 0, title="TP 1 Hit", message="TP 1 Level Reached")
First staged take profit hit (either long or short). Your bot can interpret the direction based on position state or message tags.
TP 2 Hit
alertcondition(TakeProfit2Plot != 0, title="TP 2 Hit", message="TP 2 Level Reached")
TP 3 Hit
alertcondition(TakeProfit3Plot != 0, title="TP 3 Hit", message="TP 3 Level Reached")
Together, these give you a complete trade lifecycle:
Open Long / Short
Optionally scale out via TP1/TP2/TP3
Close remaining via Close Long / Close Short
All while the Risk Management Engine enforces the same logic as the strategy version.
C. Using This Script for Automation
This Alerts Edition is designed for:
Webhook-based bots
Execution relays (e.g., your own Lynx-Relay-style engine)
Dedicated external trade managers
Typical setup flow:
Add the script to your chart
Same symbol, timeframe, and settings you use in the Strategy Edition backtests.
Configure Inputs:
Longs / Shorts enabled
Risk Management toggles (SL, TS, Staged TP, AATS, RSIS)
Weekend filter (if you do not want weekend trades)
RBR-specific knobs (Adaptive Lookback, Brick type, ATR vs Standard Brick, etc.)
Create Alerts for Each Event Type You Need:
Long Entry
Short Entry
Close Long
Close Short
TP1 / TP2 / TP3 (optional, if your bot handles partial closes)
For each:
Condition: the corresponding alertcondition
Option: “Once Per Bar Close” is strongly recommended
Message:
You can use structured JSON or a simple token set like:
{"side":"long","event":"entry","symbol":"{{ticker}}","time":"{{timenow}}"}
or a simpler text for manual trading like:
LONG ENTRY | {{ticker}} | {{interval}}
Wire Up Your Bot / Relay:
Point TradingView’s webhook URL to your execution engine
Parse the messages and map them into:
Exchange
Symbol
Side (long/short)
Action (open/close/partial)
Size and risk model (this script does not position-size for you; it only signals when, not how much.)
Because the alerts come from a non-repainting, RM-backed engine that you’ve already validated via the Strategy Edition, you get a much cleaner automation pipeline.
D. Repainting Protection (Alerts Edition)
The same protections as the Strategy Edition apply here:
Execution-critical logic (trailing stop, TP triggers, SL, RM state changes) uses previous bar OHLC:
open , high , low , close
No security() with lookahead or future-bar dependencies.
This means:
Alerts are designed to fire on states that would have been visible at bar close, not on hypothetical “future history.”
Important practical note:
Intrabar: While a bar is forming, internal conditions can oscillate.
Bar Close: With “Once Per Bar Close” alerts, the fired signal corresponds to the final state of the engine for that candle, matching your Strategy Edition expectations.
4. For Developers & Modders
You can treat this Alerts script as an ”RM + Alert Framework” and inject any signal logic you want.
Where to plug in:
Find the section:
// BASELINE & SIGNAL GENERATION
You’ll see how B1 and B2 are built from the RBR stack and then combined:
baseSig = B2
altSig = B1
finalSig = sigSwap ? baseSig : altSig
To use your own logic:
Replace or wrap the code that sets baseSig / altSig with your own conditions:
e.g., RSI, MACD, Heikin Ashi filters, candle patterns, volume filters, etc.
Make sure your final decision is still:
2 → Long / Buy signal
-2 → Short / Sell signal
0 → No trade
finalSig is then passed into the RM engine and eventually becomes Fin, which:
Drives the Long/Short Entry alerts
Interacts with the RM state machine to integrate properly with AATS, SL, TS, TP, etc.
Because this script already exposes alertconditions for key lifecycle events, you don’t need to re-wire alerts each time — just ensure your logic feeds into finalSig correctly.
This lets you use the Signal Lynx Risk Management Engine + Alerts wrapper as a drop-in chassis for your own strategies.
5. About Signal Lynx
Automation for the Night-Shift Nation 🌙
Signal Lynx builds tools and templates that help traders move from:
“I have an indicator” → “I have a structured, automatable strategy with real risk management.”
This Superior-Range Bound Renko – Alerts Edition is the automation-focused companion to the Strategy Edition. It’s designed for:
Traders who backtest with the Strategy version
Then deploy live signals with this Alerts version via webhooks or bots
While relying on the same non-repainting, RM-driven logic
We release this code under the Mozilla Public License 2.0 (MPL-2.0) to support the Pine community with:
Transparent, inspectable logic
A reusable Risk Management template
A reference implementation of advanced adaptive logic + alerts
If you are exploring full-stack automation (TradingView → Webhooks → Exchange / VPS), keep Signal Lynx in your search.
License: Mozilla Public License 2.0 (Open Source).
If you build improvements or helpful variants, please consider sharing them back with the community.
Superior-Range Bound Renko - Strategy - 11-29-25 - SignalLynxSuperior-Range Bound Renko Strategy with Advanced Risk Management Template
Signal Lynx | Free Scripts supporting Automation for the Night-Shift Nation 🌙
1. Overview
Welcome to Superior-Range Bound Renko (RBR) — a volatility-aware, structure-respecting swing-trading system built on top of a full Risk Management (RM) Template from Signal Lynx.
Instead of relying on static lookbacks (like “14-period RSI”) or plain MA crosses, Superior RBR:
Adapts its range definition to market volatility in real time
Emulates Renko Bricks on a standard, time-based chart (no Renko chart type required)
Uses a stack of Laguerre Filters to detect genuine impulse vs. noise
Adds an Adaptive SuperTrend powered by a small k-means-style clustering routine on volatility
Under the hood, this script also includes the full Signal Lynx Risk Management Engine:
A state machine that separates “Signal” from “Execution”
Layered exit tools: Stop Loss, Trailing Stop, Staged Take Profit, Advanced Adaptive Trailing Stop (AATS), and an RSI-style stop (RSIS)
Designed for non-repainting behavior on closed candles by basing execution-critical logic on previous-bar data
We are publishing this as an open-source template so traders and developers can leverage a professional-grade RM engine while integrating their own signal logic if they wish.
2. Quick Action Guide (TL;DR)
Best Timeframe:
4 Hours (H4) and above. This is a high-conviction swing-trading system, not a scalper.
Best Assets:
Volatile instruments that still respect market structure:
Bitcoin, Ethereum, Gold (XAUUSD), high-volatility Forex pairs (e.g., GBPJPY), indices with clean ranges.
Strategy Type:
Volatility-Adaptive Trend Following + Impulse Detection.
It hunts for genuine expansion out of ranges, not tiny mean-reversion nibbles.
Key Feature:
Renko Emulation on time-based candles.
We mathematically model Renko Bricks and overlay them on your standard chart to define:
“Equilibrium” zones (inside the brick structure)
“Breakout / impulse” zones (when price AND the impulse line depart from the bricks)
Repainting:
Designed to be non-repainting on closed candles.
All RM execution logic uses confirmed historical data (no future bars, no security() lookahead). Intrabar flicker during formation is allowed, but once a bar closes the engine’s decisions are stable.
Core Toggles & Filters:
Enable Longs and Shorts independently
Optional Weekend filter (block trades on Saturday/Sunday)
Per-module toggles: Stop Loss, Trailing Stop, Staged Take Profits, AATS, RSIS
3. Detailed Report: How It Works
A. The Strategy Logic: Superior RBR
Superior RBR builds its entry signal from multiple mathematical layers working together.
1) Adaptive Lookback (Volatility Normalization)
Instead of a fixed 100-bar or 200-bar range, the script:
Computes ATR-based volatility over a user-defined period.
Normalizes that volatility relative to its recent min/max.
Maps the normalized value into a dynamic lookback window between a minimum and maximum (e.g., 4 to 100 bars).
High Volatility:
The lookback shrinks, so the system reacts faster to explosive moves.
Low Volatility:
The lookback expands, so the system sees a “bigger picture” and filters out chop.
All the core “Range High/Low” and “Range Close High/Low” boundaries are built on top of this adaptive window.
2) Range Construction & Quick Ranges
The engine constructs several nested ranges:
Outer Range:
rangeHighFinal – dynamic highest high
rangeLowFinal – dynamic lowest low
Inner Close Range:
rangeCloseHighFinal – highest close
rangeCloseLowFinal – lowest close
Quick Ranges:
“Half-length” variants of those, used to detect more responsive changes in structure and volatility.
These ranges define:
The macro box price is trading inside
Shorter-term “pressure zones” where price is coiling before expansion
3) Renko Emulation (The Bricks)
Rather than using the Renko chart type (which discards time), this script emulates Renko behavior on your normal candles:
A “brick size” is defined either:
As a standard percentage move, or
As a volatility-driven (ATR) brick, optionally inhibited by a minimum standard size
The engine tracks a base value and derives:
brickUpper – top of the emulated brick
brickLower – bottom of the emulated brick
When price moves sufficiently beyond those levels, the brick “shifts”, and the directional memory (renkoDir) updates:
renkoDir = +2 when bricks are advancing upward
renkoDir = -2 when bricks are stepping downward
You can think of this as a synthetic Renko tape overlaid on time-based candles:
Inside the brick: equilibrium / consolidation
Breaking away from the brick: momentum / expansion
4) Impulse Tracking with Laguerre Filters
The script uses multiple Laguerre Filters to smooth price and brick-derived data without traditional lag.
Key filters include:
LagF_1 / LagF_W: Based on brick upper/lower baselines
LagF_Q: Based on HLCC4 (high + low + 2×close)/4
LagF_Y / LagF_P: Complex averages combining brick structures and range averages
LagF_V (Primary Impulse Line):
A smooth, high-level impulse line derived from a blend of the above plus the outer ranges
Conceptually:
When the impulse line pushes away from the brick structure and continues in one direction, an impulse move is underway.
When its direction flips and begins to roll over, the impulse is fading, hinting at mean reversion back into the range.
5) Fib-Based Structure & Swaps
The system also layers in Fib levels derived from the adaptive ranges:
Standard levels (12%, 23.6%, 38.2%, 50%, 61%, 76.8%, 88%) from the main range
A secondary “swap” set derived from close-range dynamics (fib12Swap, fib23Swap, etc.)
These Fibs are used to:
Bucket price into structural zones (below 12, between 23–38, etc.)
Detect breakouts when price and Laguerre move beyond key Fib thresholds
Drive zSwap logic (where a secondary Fib set becomes the active structure once certain conditions are met)
6) Adaptive SuperTrend with K-Means-Style Volatility Clustering
Under the hood, the script uses a small k-means-style clustering routine on ATR:
ATR is measured over a fixed period
The range of ATR values is split into Low, Medium, High volatility centroids
Current ATR is assigned to the nearest centroid (cluster)
From that, a SuperTrend variant (STK) is computed with dynamic sensitivity:
In quiet markets, SuperTrend can afford to be tighter
In wild markets, it widens appropriately to avoid constant whipsaw
This SuperTrend-based oscillator (LagF_K and its signals) is then combined with the brick and Laguerre stack to confirm valid trend regimes.
7) Final Baseline Signals (+2 / -2)
The “brain” of Superior RBR lives in the Baseline & Signal Generation block:
Two composite signals are built: B1 and B2:
They combine:
Fib breakouts
Renko direction (renkoDir)
Expansion direction (expansionQuickDir)
Multiple Laguerre alignments (LagF_Q, LagF_W, LagF_Y, LagF_Z, LagF_P, LagF_V)
They also factor in whether Fib structures are expanding or contracting.
A user toggle selects the “Baseline” signal:
finalSig = B2 (default) or B1 (alternate baseline)
finalSig is then filtered through the RM state machine and only when everything aligns, we emit:
+2 = Long / Buy signal
-2 = Short / Sell signal
0 = No new trade
Those +2 / -2 values are what feed the Risk Management Engine.
B. The Risk Management (RM) Engine
This script features the Signal Lynx Risk Management Engine, a proprietary state machine built to separate Signal from Execution.
Instead of firing orders directly on indicator conditions, we:
Convert the raw signal into a clean integer (Fin = +2 / -2 / 0)
Feed it into a Trade State Machine that understands:
Are we flat?
Are we in a long or short?
Are we in a closing sequence?
Should we permit re-entry now or wait?
Logic Injection / Template Concept:
The RM engine expects a simple integer:
+2 → Buy
-2 → Sell
Everything else (0) is “no new trade”
This makes the script a template:
You can remove the Superior RBR block
Drop in your own logic (RSI, MACD, price action, etc.)
As long as you output +2 or -2 into the same signal channel, the RM engine can drive all exits and state transitions.
Aggressive vs Conservative Modes:
The input AgressiveRM (Aggressive RM) governs how we interpret signals:
Conservative Mode (Aggressive RM = false):
Uses a more filtered internal signal (AF) to open trades
Effectively waits for a clean trend flip / confirmation before new entries
Minimizes whipsaw at the cost of fewer trades
Aggressive Mode (Aggressive RM = true):
Reacts directly to the fresh alert (AO) pulses
Allows faster re-entries in the same direction after RM-based exits
Still respects your pyramiding setting; this script ships with pyramiding = 0 by default, so it will not stack multiple positions unless you change that parameter in the strategy() call.
The state machine enforces discipline on top of your signal logic, reducing double-fires and signal spam.
C. Advanced Exit Protocols (Layered Defense)
The exit side is where this template really shines. Instead of a single “take profit or stop loss,” it uses multiple, cooperating layers.
1) Hard Stop Loss
A classic percentage-based Stop Loss (SL) relative to the entry price.
Acts as a final “catastrophic protection” layer for unexpected moves.
2) Standard Trailing Stop
A percentage-based Trailing Stop (TS) that:
Activates only after price has moved a certain percentage in your favor (tsActivation)
Then trails price by a configurable percentage (ts)
This is a straightforward, battle-tested trailing mechanism.
3) Staged Take Profits (Three Levels)
The script supports three staged Take Profit levels (TP1, TP2, TP3):
Each stage has:
Activation percentage (how far price must move in your favor)
Trailing amount for that stage
Position percentage to close
Example setup:
TP1:
Activate at +10%
Trailing 5%
Close 10% of the position
TP2:
Activate at +20%
Trailing 10%
Close another 10%
TP3:
Activate at +30%
Trailing 5%
Close the remaining 80% (“runner”)
You can tailor these quantities for partial scaling out vs. letting a core position ride.
4) Advanced Adaptive Trailing Stop (AATS)
AATS is a sophisticated volatility- and structure-aware stop:
Uses Hirashima Sugita style levels (HSRS) to model “floors” and “ceilings” of price:
Dungeon → Lower floors → Mid → Upper floors → Penthouse
These levels classify where current price sits within a long-term distribution.
Combines HSRS with Bollinger-style envelopes and EMAs to determine:
Is price extended far into the upper structure?
Is it compressed near the lower ranges?
From this, it computes an adaptive factor that controls how tight or loose the trailing level (aATS / bATS) should be:
High Volatility / Penthouse areas:
Stop loosens to avoid getting wicked out by inevitable spikes.
Low Volatility / compressed structure:
Stop tightens to lock in and protect profit.
AATS is designed to be the “smart last line” that responds to context instead of a single fixed percentage.
5) RSI-Style Stop (RSIS)
On top of AATS, the script includes a RSI-like regime filter:
A McGinley Dynamic mean of price plus ATR bands creates a dynamic channel.
Crosses above the top band and below the lower band change a directional state.
When enabled (UseRSIS):
RSIS can confirm or veto AATS closes:
For longs: A shift to bearish RSIS can force exits sooner.
For shorts: A shift to bullish RSIS can do the same.
This extra layer helps avoid over-reactive stops in strong trends while still respecting a regime change when it happens.
D. Repainting Protection
Many strategies look incredible in the Strategy Tester but fail in live trading because they rely on intrabar values or future-knowledge functions.
This template is built with closed-candle realism in mind:
The Risk Management logic explicitly uses previous bar data (open , high , low , close ) for the key decisions on:
Trailing stop updates
TP triggers
SL hits
RM state transitions
No security() lookahead or future-bar access is used.
This means:
Backtest behavior is designed to match what you can actually get with TradingView alerts and live automation.
Signals may “flicker” intrabar while the candle is forming (as with any strategy), but on closed candles, the RM decisions are stable and non-repainting.
4. For Developers & Modders
We strongly encourage you to mod this script.
To plug your own strategy into the RM engine:
Look for the section titled:
// BASELINE & SIGNAL GENERATION
You will see composite logic building B1 and B2, and then selecting:
baseSig = B2
altSig = B1
finalSig = sigSwap ? baseSig : altSig
You can replace the content used to generate baseSig / altSig with your own logic, for example:
RSI crosses
MACD histogram flips
Candle pattern detectors
External condition flags
Requirements are simple:
Your final logic must output:
2 → Buy signal
-2 → Sell signal
0 → No new trade
That output flows into the RM engine via finalSig → AlertOpen → state machine → Fin.
Once you wire your signals into finalSig, the entire Risk Management system (Stops, TPs, AATS, RSIS, re-entry logic, weekend filters, long/short toggles) becomes available for your custom strategy without re-inventing the wheel.
This makes Superior RBR not just a strategy, but a reference architecture for serious Pine dev work.
5. About Signal Lynx
Automation for the Night-Shift Nation 🌙
Signal Lynx focuses on helping traders and developers bridge the gap between indicator logic and real-world automation. The same RM engine you see here powers multiple internal systems and templates, including other public scripts like the Super-AO Strategy with Advanced Risk Management.
We provide this code open source under the Mozilla Public License 2.0 (MPL-2.0) to:
Demonstrate how Adaptive Logic and structured Risk Management can outperform static, one-layer indicators
Give Pine Script users a battle-tested RM backbone they can reuse, remix, and extend
If you are looking to automate your TradingView strategies, route signals to exchanges, or simply want safer, smarter strategy structures, please keep Signal Lynx in your search.
License: Mozilla Public License 2.0 (Open Source).
If you make beneficial modifications, please consider releasing them back to the community so everyone can benefit.
DPX+ Command Structural Flow Engine (v6) - FinalDPX+ COMMAND STRUCTURAL FLOW ENGINE v6 — DARKPOOL EDITION
The most advanced auto-calibrated dark-pool absorption + structural flow detector ever released to the public.
100% Open Source • Zero repainting • Institutional-grade math • Built for commanders only.
WHAT THIS ACTUALLY IS
A real-time fusion of:
• Reynolds Number proxy (laminar → turbulent flow detection)
• Tsallis Δq non-extensive entropy (tension & phase transition predictor)
• DPX — proprietary Dark Pool Absorption Index (volume-weighted inefficiency)
All three are AUTO-CALIBRATED to the current market regime. No manual thresholds. Works on BTC, SPX, TSLA, 1m or monthly — same settings.
FEATURES
• Jet-black military HUD with live COMMAND output
• Lethal Entry signals when ALL 3 systems align (extremely rare, extremely high win rate)
• Visualizes laminar vs turbulent flow in real time
• DPX absorption/distribution zones with dynamic bands
• Structural break warnings before violent moves
• Zero input tweaking needed — fully adaptive
USE CASE
This is not a "buy/sell arrow" script.
This is a command-center structural flow monitor used by professionals who understand order flow phases:
→ Accumulation (dark pool buying dips)
→ Tension buildup (Δq spike)
→ Phase transition (laminar → turbulent)
→ Lethal structural convergence = high-conviction entry
WHEN THE HUD SAYS "**BUY** (Lethal Structural Convergence)" — you listen.
Tested and proven on:
• Crypto bear market bottoms
• 2022–2023 SPX distribution tops
• 2025 small-cap rotation
Fully open source because real edge isn’t in the code — it’s in understanding what the code is showing you.
If you know, you know.
#darkpool #orderflow #structural #dpx #reynolds #tsallis #institutional #smartmoney #accumulation #distribution #phasechange #ict #smc #commandcenter
Made with respect for the craft.
Drop a ♥ if this speaks to you.
4H Bias: Previous Candle FocusStructural Bias Confirmation Checklist
Has price broken a significant swing high/low on the 4HR?
Has price held beyond this level for at least one complete 4HR
candle?
Does the candle anatomy (OHLC vs OLHC pattern) confirm
directional intent?
Are subsequent 4HR candles showing continued momentum in
the bias direction?
Has a liquidity sweep occurred into the previous structure before
the continuation?
Bitcoin vs. S&P 500 Performance Comparison**Full Description:**
**Overview**
This indicator provides an intuitive visual comparison of Bitcoin's performance versus the S&P 500 by shading the chart background based on relative strength over a rolling lookback period.
**How It Works**
- Calculates percentage returns for both Bitcoin and the S&P 500 (ES1! futures) over a specified lookback period (default: 75 bars)
- Compares the returns and shades the background accordingly:
- **Green/Teal Background**: Bitcoin is outperforming the S&P 500
- **Red/Maroon Background**: S&P 500 is outperforming Bitcoin
- Displays a real-time performance difference label showing the exact percentage spread
**Key Features**
✓ Rolling performance comparison using customizable lookback period (default 75 bars)
✓ Clean visual representation with adjustable transparency
✓ Works on any timeframe (optimized for daily charts)
✓ Real-time performance differential display
✓ Uses ES1! (E-mini S&P 500 continuous futures) for accurate comparison
✓ Fine-tuning adjustment factor for precise calibration
**Use Cases**
- Identify market regimes where Bitcoin outperforms or underperforms traditional equities
- Spot trend changes in relative performance
- Assess risk-on vs risk-off periods
- Compare Bitcoin's momentum against broader market conditions
- Time entries/exits based on relative strength shifts
**Settings**
- **S&P 500 Symbol**: Default ES1! (can be changed to SPX or other indices)
- **Lookback Period**: Number of bars for performance calculation (default: 75)
- **Adjustment Factor**: Fine-tune calibration to match specific data feeds
- **Transparency Controls**: Customize background shading intensity
- **Show/Hide Label**: Toggle performance difference display
**Best Practices**
- Use on daily timeframe for swing trading and position analysis
- Combine with other momentum indicators for confirmation
- Watch for color transitions as potential regime change signals
- Consider using multiple timeframes for comprehensive analysis
**Technical Details**
The indicator calculates rolling percentage returns using the formula: ((Current Price / Price ) - 1) × 100, then compares Bitcoin's return to the S&P 500's return over the same period. The background color dynamically updates based on which asset is showing stronger performance.
RCV Essentials════════════════════════════════════════════
RCV ESSENTIALS - MULTI-TIMEFRAME & SESSION ANALYSIS TOOL
════════════════════════════════════════════
📊 WHAT THIS INDICATOR DOES
This professional-grade indicator combines two powerful analysis modules:
1. TRADING SESSION TRACKER - Visualizes high/low ranges for major global market sessions (NY Open, London Open, Asian Session, etc.)
2. MULTI-TIMEFRAME CANDLE DISPLAY - Shows up to 8 higher timeframes simultaneously on your chart (15m, 30m, 1H, 4H, 1D, 1W, 1M, 3M)
════════════════════════════════════════════
🎯 KEY FEATURES
════════════════════════════════════════════
TRADING SESSIONS MODULE:
✓ Track up to 6 custom trading sessions simultaneously
✓ Real-time high/low range detection during active sessions
✓ Pre-configured for NYO (7-9am), LNO (2-3am), Asian Session (4:30pm-12am)
✓ 60+ global timezone options
✓ Customizable colors, labels, and transparency
✓ Daily divider lines (optional Sunday skip for traditional markets)
✓ Only displays on ≤30m timeframes for optimal clarity
MULTI-TIMEFRAME CANDLES MODULE:
✓ Display 1-8 higher timeframes with up to 10 candles each
✓ Real-time candle updates (non-repainting)
✓ Fully customizable colors (separate bullish/bearish for body/border/wick)
✓ Adjustable candle width, spacing, and positioning
✓ Smart label system (top/bottom/both, aligned or follow candles)
✓ Automatic timeframe validation (only shows TFs higher than chart)
✓ Memory-optimized with automatic cleanup
════════════════════════════════════════════
🔧 HOW IT WORKS
════════════════════════════════════════════
TECHNICAL IMPLEMENTATION:
Session Tracking Algorithm:
• Detects session start/end using time() function with timezone support
• Continuously monitors and updates high/low during active session
• Finalizes range when session ends using var persistence
• Draws boxes using real-time bar_index positioning
• Maintains session ranges across multiple days for reference
Multi-Timeframe System:
• Uses ta.change(time()) detection to identify new MTF candle formation
• Constructs candles using custom Type definitions (Candle, CandleSet, Config)
• Stores OHLC data in arrays with automatic size management
• Renders using box objects (bodies) and line objects (wicks)
• Updates current candle every tick; historical candles remain static
• Calculates dynamic positioning based on user settings (offset, spacing, width)
Object-Oriented Architecture:
• Custom Type "Candle" - Stores OHLC values, timestamps, visual elements
• Custom Type "CandleSet" - Manages arrays of candles + settings per timeframe
• Custom Type "Config" - Centralizes all display configuration
• Efficient memory management via unshift() for new candles, pop() for old
Performance Optimizations:
• var declarations minimize recalculation overhead
• Conditional execution (sessions only on short timeframes)
• Maximum display limits prevent excessive object creation
• Timeframe validation at barstate.isfirst reduces redundant checks
════════════════════════════════════════════
📈 HOW TO USE
════════════════════════════════════════════
SETUP:
1. Add indicator to chart (works best on 1m-30m timeframes)
2. Open Settings → "Trading Sessions" group
- Enable desired sessions (NYO, LNO, AS, or custom)
- Select your timezone from 60+ options
- Adjust colors and transparency
3. Open Settings → "Multi-TF Candles" group
- Enable timeframes (TF1-TF8)
- Configure each timeframe and display count
- Customize colors and layout
READING THE CHART:
• Session boxes show high/low ranges during active sessions
• MTF candles display to the right of current price
• Labels identify each timeframe (15m, 1H, 4H, etc.)
• Real-time updates on the most recent MTF candle
TRADING APPLICATIONS:
Session Breakout Strategy:
→ Identify session high/low (e.g., Asian session 16:30-00:00)
→ Wait for break above/below range
→ Confirm with higher timeframe candle close
→ Enter in breakout direction, stop at opposite side of range
Multi-Timeframe Confirmation:
→ Spot setup on primary chart (e.g., 5m)
→ Verify 15m, 1H, 4H candles align with trade direction
→ Only take trades where higher TFs confirm
→ Exit when higher TF candles show reversal
Combined Session + MTF:
→ Asian session establishes range overnight
→ London Open breaks Asian high
→ Confirm with bullish 15m + 1H candles
→ Enter long with stop below Asian high
════════════════════════════════════════════
🎨 ORIGINALITY & INNOVATION
════════════════════════════════════════════
What makes this indicator original:
1. INTEGRATED DUAL-MODULE DESIGN
Unlike separate session or MTF indicators, this combines both in a single performance-optimized script, enabling powerful correlation analysis between session behavior and timeframe structure.
2. ADVANCED RENDERING SYSTEM
Uses custom Pine Script v5 Types with dynamic box/line object management instead of basic plot functions. This enables:
• Precise visual control over positioning and spacing
• Real-time updates without repainting
• Efficient memory handling via automatic cleanup
• Support for 8 simultaneous timeframes with independent settings
3. INTELLIGENT SESSION TRACKING
The algorithm continuously recalculates ranges bar-by-bar during active sessions, then preserves the final range. This differs from static zone indicators that simply draw fixed boxes at predefined levels.
4. MODULAR ARCHITECTURE
Custom Type definitions (Candle, CandleSet, Config) create extensible, maintainable code structure while supporting complex multi-timeframe operations with minimal performance impact.
5. PROFESSIONAL FLEXIBILITY
Extensive customization: 6 configurable sessions, 8 timeframe slots, 60+ timezones, granular color/sizing/spacing controls, multiple label positioning modes—adaptable to any market or trading style.
6. SMART VISUAL DESIGN
Automatic timeframe validation, dynamic label alignment options, and intelligent spacing calculations ensure clarity even with multiple timeframes displayed simultaneously.
════════════════════════════════════════════
⚙️ CONFIGURATION OPTIONS
════════════════════════════════════════════
TRADING SESSIONS:
• Session 1-6: On/Off toggles
• Time Ranges: Custom start-end times
• Labels: Custom text for each session
• Colors: Individual color per session
• Timezone: 60+ options (Americas, Europe, Asia, Pacific, Africa)
• Range Transparency: 0-100%
• Outline: Optional border
• Label Display: Show/hide session names
• Daily Divider: Dotted lines at day changes
• Skip Sunday: For traditional markets vs 24/7 crypto
MULTI-TF CANDLES:
• Timeframes 1-8: Enable/disable individually
• Timeframe Selection: Any TF (seconds to months)
• Display Count: 1-10 candles per timeframe
• Bullish Colors: Body/Border/Wick (independent)
• Bearish Colors: Body/Border/Wick (independent)
• Candle Width: 1-10+ bars
• Right Margin: 0-200+ bars from edge
• TF Spacing: Gap between timeframe groups
• Label Color: Any color
• Label Size: Tiny/Small/Normal/Large/Huge
• Label Position: Top/Bottom/Both
• Label Alignment: Follow Candles or Align
════════════════════════════════════════════
📋 TECHNICAL SPECIFICATIONS
════════════════════════════════════════════
• Pine Script Version: v5
• Chart Overlay: True
• Max Boxes: 500
• Max Lines: 500
• Max Labels: 500
• Max Bars Back: 5000
• Update Frequency: Real-time (every tick)
• Timeframe Compatibility: Chart TF must be lower than selected MTFs
• Session Display: Activates only on ≤30 minute timeframes
• Memory Management: Automatic cleanup via array operations






















