Stop Loss Cascades (Breakouts) [Kioseff Trading]Hello friends and traders!
🔹Introduction
This indicator " Stop-Loss Clustering (Breakouts) " attempts to model trader stop-loss placement logic and identify price areas where a large amount of stop losses might cluster.
The idea is, if stop losses are indeed highly concentrated in a specific area, price extending through that area may produce high-velocity breakout conditions via forced order flow .
I'll cover this topic more thoroughly throughout the description. For now, just know that stop loss location & size data is not publicly available . Any model of their concentration locations is highly assumptive.
However, there's some reasonable academic research we can reference to make worthwhile estimates.
Academic references supporting the concepts discussed are listed at the end of this description. To maintain readability, I won't cite individual statements inline.
🔹The Premise
🔸Liquidity, Behavior, and Stop Cascades
Markets operate through a continuous limit order book , where two fundamental order types interact:
Limit orders , which provide liquidity by resting in the book
Market orders , which consume liquidity by exhausting those resting orders
This mechanical interaction drives price movement - incoming order flow consuming available liquidity .
This begs the question.. Does liquidity distribute evenly across the LOB?
If it did : If liquidity were evenly distributed, price impact could be modeled as a relatively smooth function of incoming order flow.
But it doesn’t : Liquidity is unevenly distributed. Academic research supports this claim and, regardless, this is an intuitive conclusion most traders arrive at.
Liquidity forms localized concentrations and gaps.
Liquidity concentrations are commonly referenced as: liquidity shelves , liquidity clusters , liquidity zones .
Liquidity gaps are commonly referenced as: liquidity vacuums , thin book zones .
As a result, identical order flow can produce very different price movements depending on the state of the order book.
Let’s consider an example..
Assume price is trading at $99.
The price levels $100, $101, $102 have resting sell limit order concentrations of 100.
This is where you come in.
You execute a market order buy for 300 size.
Your order first exhausts all sell-side resting order concentrations at the $100 level.
You still have 200 size that needs to be filled, and the ask price has moved from $100 to $101.
Your order will now sequentially exhaust available liquidity at the $101 level, the ask price will increase to $102, and your final 100 size will exhaust the $102 level.
To keep the example simple, we’ll say that your order moved price from $99 to $102, and now the ask price is $103.
But, you still want to accumulate.
The nearest sell-side levels in the LOB are $103, $104, $105.
The $103 level has a sell limit order concentration of 500.
$104 and $105 both have concentrations of 50.
You execute your same market order buy for 300 size.
This time, price doesn’t move.. At all..
Instead, you consumed 300 of the 500 size at $103 with your order, and the level remains a barrier.
Your order was absorbed by available liquidity.
This example demonstrates how price movement depends on available liquidity , not simply the size of incoming orders.
In the first scenario, liquidity was thin and the order walked through multiple price levels, causing price to move quickly.
In the second scenario, a large concentration of resting liquidity absorbed the same order, preventing price from advancing.
🔸Liquidity Does Not Distribute Evenly
Alright, we understand that liquidity doesn’t distribute evenly. And we understand that high concentrations of liquidity can act as price barriers (liquidity shelves) while sparse liquidity can permit rapid price movement - we saw this in our example above.
There’s an important question we should ask next before we move on..
If liquidity distributes unevenly, then where does it tend to cluster? And where does it tend to thin?
Of course, knowing these tendencies provides multi-purpose advantages.
If price approaches a liquidity vacuum - a local block of the order book with thin resting liquidity - rapid price movement can occur without requiring unusually strong aggressive order flow.
If price approaches a liquidity shelf - a local block of the order book with thick resting liquidity - price can stall or contract even if the same level of aggressive order flow that previously moved price continues.
With this in mind, order flow intensity alone does not determine price movement . The distribution of liquidity across surrounding price levels plays a similarly important role.
So, is there any evidence of where liquidity tends to concentrate ?
🔸Empirical Observations
Empirical research on limit order books shows that liquidity does not distribute smoothly across the LOB . Instead, depth tends to concentrate at specific price levels, producing irregular profiles with localized peaks in resting liquidity.
These concentrations arise because order placement is not random . Traders frequently anchor decisions to widely observed reference prices such as:
• prior highs
• prior lows
• round numbers
• widely referenced price extremes
Because many traders monitor the same price history, order placement decisions often reference similar price levels.
This concept is simpler than it sounds.
Let’s use market structure traders for example.
Market structure traders frequently reference prior swing highs and swing lows when making decisions about entries, exits, and risk.
A trader entering a long position may place their stop-loss below a recent swing low , reasoning that if price breaks that level, the trade idea is invalidated.
A trader entering a short position may place their stop-loss above a recent swing high for the same reason.
Timeframe price aggregation may differ; however, we’re all looking at roughly the same recent highs and lows when evaluating a chart (structure).
When many traders collectively reference the same prices, orders may accumulate near those levels. This produces localized depth concentrations, which traders refer to as liquidity shelves .
Liquidity shelves act as temporary barriers where the book contains disproportionately large resting liquidity compared to surrounding prices.
🔸Research documenting liquidity clustering includes :
Bourghelle & Cellier (2007) , who find that limit orders cluster at prominent price levels (especially round numbers), creating localized depth concentrations that can act as price barriers.
Kavajecz & Odders-White (2004) , who demonstrate that prices identified as support or resistance coincide with higher resting limit order depth
These findings suggest that many commonly observed price levels may correspond to real concentrations of liquidity rather than being purely visual artifacts on a chart.
Kavajecz & Odders-White (2004) is an important observation for support/resistance traders!
Kavajecz & Odders-White (2004) show that levels traders commonly call support and resistance often align with areas where more limit orders are resting in the order book.
This suggests a plausible mechanical pathway through which support and resistance levels can emerge!
🔸Liquidity Shelves and Price Interaction
When liquidity clusters around a price level, the resulting liquidity shelf can influence how price behaves when it approaches that area.
Price interaction with these shelves is state-dependent :
If incoming order flow is absorbed, price may stall or reverse
If resting liquidity is consumed, price may transition rapidly to the next liquidity zone
Once a shelf is depleted, follow-through can accelerate due to thinner liquidity beyond the level
Research on order book dynamics supports this mechanical view of price movement.
For example:
Jean-Philippe Bouchaud, J. Doyne Farmer, and Fabrizio Lillo (2009) demonstrate that price impact emerges from the interaction between order flow and finite liquidity
From this perspective, price does not move simply because a level is crossed.
Price moves because available liquidity at that level has been consumed.
🔸Latent Liquidity and Stop Clustering
In addition to visible liquidity from limit orders, markets also contain latent liquidity .
This is where ”Stop-Loss Clustering (Breakouts)” becomes important - we’re almost done!
Latent liquidity consists of conditional orders such as stop-losses that are not visible in the order book until triggered .
Although these orders aren’t public information, empirical studies show that stop orders tend to cluster near widely referenced price levels .
Research by Carol Osler (2001, 2002) using institutional FX order data finds that stop-loss orders frequently accumulate just beyond salient price levels such as prior highs and lows.
When these stops trigger, they convert into aggressive market orders and can generate bursts of directional order flow that may accelerate price movement.
🔸Stop-Loss Cascades
Stop losses add another layer of latent order flow that isn’t visible in the order book until it triggers.
If enough of them sit around the same price area.. Think “hidden pressure” waiting to activate. Nothing happens while price trades nearby, but once that level is traded at, those stops convert into market orders and immediately begin consuming available liquidity.
This matters because stop placement is unlikely to be random in most instances. Traders frequently anchor stops to widely observed prices such as prior highs, prior lows, or other prominent structure points, or use volatility methods such as ATR, etc.
So when price approaches one of these areas, two things can happen.
If the resting liquidity there is large enough, the incoming orders can be absorbed and price may stall or reject.
But if that liquidity gets consumed, the stops sitting just beyond the level begin triggering. Those triggered stops add additional market orders, which consume more liquidity and can push price further into the next layer of stops.
This creates a cascading effect:
price reaches a stop cluster
stops trigger and convert into market orders
liquidity gets consumed faster
price moves further, triggering more stops
When this chain reaction starts, price can transition very quickly from a slow battle near the level to rapid expansion through it.
This is one of the mechanical reasons why some reference-point breaks barely move, while others accelerate rapidly.
🔹How It Works
Now that we understand the why - let’s discuss how the indicator works.
🔸Absorbtion Extremes
The image above shows the absorption extremes model.
In this model, the indicator treats recent & relevant swing points as plausible stop clustering candidates.
You can find similar swing point identification mechanics in other indicators.
However, this model assigns subsequent volume to the swing level after its formation.
There are limitations and assumptions - let’s go over them.
The images above explain how the indicator determines the intensity of a possible stop-cluster around a swing level.
There are limitations and assumptions
1: The indicator assigns all “directional volume” to a swing level after it’s formed and while it remains the closest active swing point to the current price.
“Buy volume” is assigned to the closest active swing low.
“Sell volume” is assigned to the closest active swing high.
I say “buy volume” and “sell volume” because there’s assumptions on what constitutes the relevant classification.
The indicators follow the traditional two-region tick model for classifying buy volume and sell volume.
Higher close = “buy volume” proxy
Lower close = “sell volume” proxy
Depending on the granularity you select (the indicator is capable of using tick data), this model can be more/less accurate.
However, even with tick-level data and bid/ask quotes, trade direction must still be inferred using classification rules. Because some trades occur inside the spread or involve hidden liquidity, perfect classification is not possible without exchange aggressor flags.
For assumptions..
The model assigns ALL classified volume to the swing level.
In reality, traders use a wide range of risk management methods, and not every position will place a stop loss directly at the most recent swing point. ATR-based stops, percentage-based stops, and other volatility-based methods are also common.
Because the true distribution of stop placement is unobservable, the model assumes that positions entered are structurally invalidated at the closest swing level based on their classified direction.
As a result, the values displayed by the indicator should be interpreted as relative proxies for potential stop concentration, rather than precise estimates of actual stop-loss size.
The displayed magnitudes are intentionally exaggerated and comparative, designed to highlight where stop pressure may accumulate relative to other levels.
The images above show how to interpret the indicator when using this model.
The image above shows the triggered stop-cluster graph.
Each point corresponds to a triggered stop-cluster - assuming it exists.
The greater the size attached to that cluster, the further distant the data point is placed.
Far away from zero line = large size.
Close to zero line = low size.
Radiating/glowing points indicate a potentially large cluster trigger.
🔸 Volatility-At-Entry Model (Time Scaled)
The Volatility-At-Entry model uses ATR scaled by various timeframes to predict plausible stop loss placements.
For this model, the indicator uses the same tick classification model to assign volume directionally.
Volume is then dispersed across six common timeframes (1m, 5m, 15m, 30m, 1h, 4h) and 3 common ATR multiples for risk management (1ATR, 1.5ATR, 2ATR).
This model assumes traders are entering positions across various timeframes and are scaling risk congruent with those timeframes.
For instance,
A trader using the 1-minute chart for opportunity is more likely to use a stop loss closer to entry than a trader using the 4-hour chart for opportunity.
If this assumption is reasonable to you - great, we can move forward!
The image above visualizes the model.
Purple-shaded regions indicate a price area with less opportunity for stop loss clustering. Either transaction intensity around eligible price areas was low, or position accumulation wasn’t given sufficient time.
Pink-shaded regions indicate a price area with greater opportunity for stop loss clustering. Volume was significant around these regions or price has traded within proximity for extended periods.
This model naturally shows more future opportunity than historical outcomes. You can select to show historical outcomes in the settings, this image shows examples of such outcomes.
The image above shows the triggered stop loss graph in effect for this model. Stop clustered are distributed across more price areas with this model - from low intensity to high intensity. Therefore, a cluster is almost always “triggering” to some degree.
A classification model for what’s typical and what’s unusual is used for the graph in this case. Radiating points always indicate large stop clusters triggered. Anything within the green/pink line indicates usual size.
Typical Move
The image above explains the nearest cluster information table.
The size and location of the nearest buy-stop cluster and sell-stop cluster are recorded.
Additionally, the indicator identifies whether clusters of similar size were triggered in the past, and how price behaved following those events.
Since all models here are highly assumptive, and similar sized clusters might only have one or two relative neighbors, treat these measurements as a description of history rather than a prediction.
The model takes the logarithm of the current stop-volume (buy or sell) to normalize its scale and compare it with a historical dataset of previously observed stop-volume sizes that have also been log-scaled.
It then identifies historical observations whose sizes are most similar to the current value, either by selecting all observations within a tolerance range around that value (where the range is based on the typical spacing between historical observations), or by selecting the single closest match.
Finally, the model retrieves the historical price moves associated with those matched observations, producing a sample of “typical moves” that occurred when stop-volume magnitude was similar to the current situation.
Ratio Meter
The stop-cluster ratio meter shows the current sum of active and triggered all buy-side clusters and sell-side clusters.
This meter is useful for quick scanning across assets to see if active or recently triggered stop clusters are lopsided.
Additional Features
The single most important setting outside model selection is the lower timeframe used to retrieve volume from.
This setting is set to 1-minute data by default because it works with paid and free plans. If you want better granularity, I strongly suggest changing this setting to either 1-second or 1-tick. This will sacrifice the number of identifiable cluster locations, because better granularity data has less programmatically retrievable values.
🔹Closing Remarks
Stop-loss clustering is an appealing concept because it offers a plausible explanation for why some breakouts accelerate so quickly while others stall. When a large number of conditional orders sit near the same price, a breakout through that area can trigger a cascade of market orders that rapidly consume liquidity and push price toward the next available zone.
However, it’s important to remember that the models used in this indicator are approximations, not direct measurements. True stop-loss locations and sizes are not publicly observable, and many traders use different risk management techniques that cannot be perfectly inferred from chart data alone. The goal of this indicator is therefore not to identify exact stop locations, but to highlight price areas where stop pressure may plausibly accumulate relative to surrounding levels.
Like any model based on behavioral assumptions and historical observations, results should be interpreted probabilistically. Large clusters do not guarantee breakouts, and small clusters do not guarantee quiet price behavior. Instead, the indicator is best used as a tool for context and situational awareness.
References
General Microstructure and Price Formation
Madhavan, A. (2000). Market microstructure: A survey. Journal of Financial Markets, 3(3), 205–258.
O'Hara, M. (1995). Market Microstructure Theory. Blackwell.
Biais, B., Glosten, L., & Spatt, C. (2005). Market microstructure: A survey of microfoundations, empirical results, and policy implications. Journal of Financial Markets, 8(2), 217–264.
Limit Order Books and Liquidity as Resting Orders
Gould, M. D., Porter, M. A., Williams, S., McDonald, M., Fenn, D. J., & Howison, S. D. (2013). Limit order books. Quantitative Finance, 13(11), 1709–1742.
Rosu, I. (2009). A dynamic model of the limit order book. Review of Financial Studies, 22(11), 4601–4641.
Biais, B., Hillion, P., & Spatt, C. (1995). An empirical analysis of the limit order book and the order flow in the Paris Bourse. Journal of Finance, 50(5), 1655–1689.
Liquidity Clustering and Depth Concentration
Kavajecz, K. A., & Odders-White, E. R. (2004). Technical analysis and liquidity provision. Review of Financial Studies, 17(4), 1043–1071.
Bourghelle, D., & Cellier, A. (2007). Limit order clustering and price barriers on financial markets. Working paper / SSRN.
Order Flow and Price Impact
Bouchaud, J.-P., Farmer, J. D., & Lillo, F. (2009). How markets slowly digest changes in supply and demand. In Handbook of Financial Markets: Dynamics and Evolution.
Stop Orders and Price Cascades
Osler, C. L. (2003). Currency orders and exchange-rate dynamics: Explaining the success of technical analysis. Journal of Finance, 58(5), 1791–1819.
Osler, C. L. (2005). Stop-loss orders and price cascades in currency markets. Journal of International Money and Finance, 24(2), 219–241.
Liquidity Provision and Execution
Ho, T., & Stoll, H. (1981). Optimal dealer pricing under transactions and return uncertainty. Journal of Financial Economics, 9(1), 47–73.
Almgren, R., & Chriss, N. (2000). Optimal execution of portfolio transactions. Journal of Risk, 3(2), 5–39.
Menkveld, A. J. (2013). High frequency trading and the new market makers. Journal of Financial Markets, 16(4), 712–740.
Behavioral Anchoring and Attention
Kahneman, D., & Tversky, A. (1974). Judgment under uncertainty: Heuristics and biases. Science, 185(4157), 1124–1131.
Barber, B. M., & Odean, T. (2008). All that glitters: The effect of attention and news on the buying behavior of individual and institutional investors. Review of Financial Studies, 21(2), 785–818.
George, T. J., & Hwang, C. Y. (2004). The 52-week high and momentum investing. Journal of Finance, 59(5), 2145–2176.
Mizrach, B., & Weerts, S. (2007). Highs and lows: A behavioral and technical analysis. SSRN working paper.
Stops
Bracket PreviewThe Bracket Preview indicator allows the user to set their intended bracket order distance (distance, in ticks, to take-profit and stop-loss) from the current live price so that a preview is generated and updated in real-time as price moves. This gives the trader a quick reference of where the bracket orders would be placed if a position were entered at that specific moment in time. This can be helpful by making it more obvious to the trader before a trade is placed exactly where these levels would be in relation to previous price action or if it would be better to wait for price to move to a more favorable level or accept a different Risk-Reward (RR) from this specific trade.
• “If I entered a long position now, would my target be in front of or beyond a recent consolidation area where it is likely to run into resistance and potentially reverse before hitting my take-profit?”
• “Would this bracket order place my stop-loss above or below a previous pivot or would I need to move it after entering the trade and potentially increase the risk on this trade to have it in a more logical level?”
• “If price is in a range and I enter now, would my stop be in the middle of the range while my target is outside the top of the range? Maybe I should wait for price to move to an area where my target would be inside but near the top of the range while my stop loss is below the range so that I’m not taking unnecessary risk or being forced to take an unfavorable RR.”
Indicador Pine Script®
Realtime ATR-Based Stop Loss Numerical OverlayRealtime ATR-Based Stop Loss Numerical Overlay
A simple, effective tool for dynamic risk management based on ATR (Average True Range) without adding cluttered and distracting lines all over your chart.
📌 Description
This script plots a real-time stop loss level using the Average True Range (ATR) on your chart, helping you set consistent, volatility-based stops. It supports both:
✅ Current chart timeframe
✅ Custom fixed timeframe inputs (1m, 5m, 15m, 1h, etc.)
The stop level is calculated as:
Stop = ATR × Multiplier
and updates in real-time. An overlay table displays on the bottom-right of your chart with the calculated stop value in a clean, simple way.
⚙️ Settings
ATR Timeframe Source:
Choose between using the current chart's timeframe or a fixed one (e.g. 5, 15, 60, D, etc).
ATR Length:
Period used to calculate the ATR (default is 14).
Stop Loss Multiplier:
Multiplies the ATR value to define your stop (e.g., 1.5 × ATR).
Wait for Timeframe Closes:
If enabled, the ATR value waits for the selected timeframe’s candle to close before updating. If unselected, it will update in real time.
🛠️ How to Use
Add this script to your chart from your indicators list.
Configure your desired timeframe, ATR length, and multiplier in the settings panel.
Use the value shown in the table overlay as your suggested stop loss distance from entry.
Adjust your position sizing accordingly to fit your risk tolerance.
This tool is especially useful for traders looking for adaptive risk management that evolves with market volatility — whether scalping intraday or swing trading.
💡 Pro Tip
The ATR stop can also be used to dynamically trail your stop behind price movement.
Indicador Pine Script®
Visual ATR StopThis indicator uses the Average True Range (ATR) to display a visual range for stop placement. Two multiplier values (example, 1 and 3) can be set to create a filled area below the price. This area represents the range between the two ATR levels, adjusted by subtracting the current price, providing a simple way to visualize stop-loss placement based on volatility.
The indicator is customizable; for example, negative values can place the area above the price for short positions. The filled color can also be removed, which allows precise levels to be marked above and below.
Indicador Pine Script®
ATR Bands with Optional Risk/Reward Colors█ OVERVIEW
This indicator projects ATR bands and, optionally, colors them based on a risk/reward advantage for those who trade breakouts/breakdowns using moving averages as partial or full exit points.
█ DEFINITIONS
► True Range
The True Range is a measure of the volatility of a financial asset and is defined as the maximum difference among one of the following values:
- The high of the current period minus the low of the current period.
- The absolute value of the high of the current period minus the closing price of the previous period.
- The absolute value of the low of the current period minus the closing price of the previous period.
► Average True Range
The Average True Range was developed by J. Welles Wilder Jr. and was introduced in his 1978 book titled "New Concepts in Technical Trading Systems". It is calculated as an average of the true range values over a certain number of periods (usually 14) and is commonly used to measure volatility and set stop-loss and profit targets (1).
For example, if you are looking at a daily chart and you want to calculate the 14-day ATR, you would take the True Range of the previous 14 days, calculate their average, and this would be the ATR for that day. The process is then repeated every day to obtain a series of ATR values over time.
The ATR can be smoothed using different methods, such as the Simple Moving Average (SMA), the Exponential Moving Average (EMA), or others, depending on the user's preferences or analysis needs.
► ATR Bands
The ATR bands are created by adding or subtracting the ATR from a reference point (usually the closing price). This process generates bands around the central point that expand and contract based on market volatility, allowing traders to assess dynamic support and resistance levels and to adapt their trading strategies to current market conditions.
█ INDICATOR
► ATR Bands
The indicator provides all the essential parameters for calculating the ATR: period length, time frame, smoothing method, and multiplier.
It is then possible to choose the reference point from which to create the bands. The most commonly used reference points are Open, High, Low, and Close, but you can also choose the commonly used candle averages: HL2, HLC3, HLCC4, OHLC4. Among these, there is also a less common "OC2", which represents the average of the candle body. Additionally, two parameters have been specifically created for this indicator: Open/Close and High/Low.
With the "Open/Close" parameter, the upper band is calculated from the higher value between Open and Close, while the lower one is calculated from the lower value between Open and Close. In the case of bullish candles, therefore, the Close value is taken as the starting point for the upper band and the Open value for the lower one; conversely, in bearish candles, the Open value is used for the upper band and the Close value for the lower band. This setting can be useful for precautionally generating broader bands when trading with candlesticks like hammers or inverted hammers.
The "High/Low" parameter calculates the upper band starting from the High and the lower band starting from the Low. Among all the available options, this one allows drawing the widest bands.
Other possible options to improve the drawing of ATR bands, aligning them with the price action, are:
• Doji Smoothing: When the current candle is a doji (having the same Open and Close price), the bands assume the values they had on the previous candle. This can be useful to avoid steep fluctuations of the bands themselves.
• Extend to High/Low: Extends the bands to the High or Low values when they exceed the value of the band.
• Round Last Cent: Expands the upper band by one cent if the price ends with x.x9, and the lower band if the price ends with x.x1. This function only works when the asset's tick is 0.01.
► Risk/Reward Advantage
The indicator optionally colors the ATR bands after setting a breakpoint, one or two risk/reward ratios, and a series of moving averages. This function allows you to know in advance whether entering a trade can provide an advantage over the risk. The band is colored when the ratio between the distance from the break point to the band and the distance from the break point to the first available moving average reaches at least the set ratio value. It is possible to set two colorings, one for a minimum risk/reward ratio and one for an optimal risk/reward ratio.
The break point can be chosen between High/Low (High in case of breakout, Low in case of breakdown) or Open/Close (on breakouts, Close with bullish candles or Open with bearish candles; on breakdowns, Close with bearish candles or Open with bullish candles).
It is possible to choose up to 10 moving averages of various types, including the VWAP with the Anchor Period (2).
Depending on the "Price to MA" setting, the bands can be individually or simultaneously colored.
By selecting "Single Direction," the risk/reward calculation is performed only when all moving averages are above or below the break point, resulting in only one band being colored at a time. For this reason, when the break point is in between the moving averages, the calculation is not executed. This setting can be useful for strategies involving price movement from a level towards a series of specific moving averages (for example, in reversals starting from a certain level towards the VWAP with possible partial take profits on some previous moving averages, or simply in trend following towards one or more moving averages).
Choosing "Both Directions" the risk/reward ratio is calculated based on the first available moving averages both above and below the price. This setting is useful for those who operate in range bound markets or simply take advantage of movements between moving averages.
█ NOTE
This script may not be suitable for scalping strategies that require immediate entries due to the inability to know the ATR of a candle in advance until its closure. Once the candle is closed, you should have time to place a stop or stop-limit order, so your strategy should not anticipate an immediate start with the next candle. Even more conveniently, if your strategy involves an entry on a pullback, you can place a limit order at the breakout level.
(1) www.tradingview.com
(2) For convenience, the code for the Anchor Period has been entirely copied from the VWAP code provided by TradingView.
Indicador Pine Script®
AIR Supertrend (Average Interpercentile Range)Supertrend (ST) is a popular stop loss and trend identification script. The simplicity of seeing a clean trend on a chart makes it attractive, yet it is restricted by only allowing the source, length and multiplier to be adjusted, & these tend to have a limited effect on the properties of the identified trend.
There is a wide variety of interesting ST scripts on TradingView that give the user more control, but none to my knowledge, based on measuring the statistical dispersion of Average Interpercentile Range (AIR).
Two more levels of control:
Normally, ATR Average True Range is used to calculate the range in ST. ATR is initially calculated using RMA to smooth out True Range. This script gives the user the option of changing the MA to some more interesting varieties & modifying their parameters.
The default range setting when you load the indicator on a chart will be AIR.
The real strength of the indicator, however, and the reason I am publishing it, is to release AIR. Play round with the percentile range setting. Lowering it will allow you to stay longer in a trade in a volatile market. Raising it will make it tighter.
For comparison, you can switch back the range setting to ATR and load up RMA to see how the original, classic ST plots.
Alerts are included in this version. Alway use a stop loss.
DISCLAIMER: None of this is financial advice.
Credits to these authors, whose hard work inspired parts of this script:
@ KivancOzbilgic - SuperTrend
@ KioseffTrading - Tillson T3 MA
@ cheatcountry - Hann Window Smoothing
@ mutantdog - Interquartile Range function in his 'Blaze' script
Indicador Pine Script®
TrailingStopsLibrary "TrailingStops"
This library contains functions to output trailing stop lines.
f_marketStructureStop(_restartMode, _flipMode, _restartLowIn, _restartHighIn)
Parameters:
_restartMode - Defines how the stop lines persist. Allowed values are:
"Always On" - The stop lines are always present and they just reset when they're crossed.
"Flip" - The stop lines flip when they're crossed.
"Manual" - The stop lines turn off when they're crossed, and turn back on again when _restartLowIn or _restartHighIn are passed into the function as true.
_flipMode - Defines whether the stop lines are broken by wicks or closes. Allowed values are "Wick", and "Close".
_restartLowIn - If _restartMode is "Manual", passing this parameter as true restarts the Low stop line.
_restartHighIn - If _restartMode is "Manual", passing this parameter as true restarts the High stop line.
@returns - floats for the Low and High stop line.
Biblioteca Pine Script®
ATR BandsIn many strategies, it's quite common to use a scaled ATR to help define a stop-loss, and it's not uncommon to use it for take-profit targets as well. While it's possible to use the built-in ATR indicator and manually calculate the offset value, we felt this wasn't particularly intuitive or efficient, and could lead to the potential for miscalculations. And while there are quite a few indicators that plot ATR bands in some form or another already on TV, we could not find one that actually performed the exact way that we wanted. They all had at least one of the following gaps:
The ATR offset was not configurable (usually hard-coded to be based off the high or low, while we generally prefer to use close)
It would only print a single band (either the upper or lower), which would require the same indicator to be added twice
The ATR scaling factor was either not configurable or only stepped in whole numbers (often time fractional factors like 1.5 yield better results)
To that end, we took to making this enhanced version to meet all of the above requirements. While we were doing so, we decided to take this opportunity to also make some non-functional enhancements as well:
Updated the indicator to the most recent version of Pine
Updated the indicator definition to allow alternate (non-chart) timeframe usage
Made the input types explicitly defined to improve consistency
Updated the inputs with appropriate minimum values and step sizes where appropriate
Separated settings into logical groups
Added helptext to the indicator settings noting usage and common settings values
Explicitly titled the on-chart plots of the ATR bands so that they can more easily be identified and referenced in other indicators/scripts, as well as the Data Window
Food for thought : When looking at some of the behaviors of these ATR bands, you can see that when price first levels out, you can draw a "consolidation zone" from the first peak of the upper ATR band to the first valley of the lower ATR band that price will generally respect. Look for price to break and close outside of that zone. When that happens, price will usually (but not always) make a notable move in that direction, which can be used as either a potential trigger or as an additional confluence with other indicators/price action.
Finally, while we have made what we feel are some noteworthy updates and enhancements to this indicator, and have every intention of continuing to do so as we find worthy opportunities for enhancement, credit is still due to the original author: AlexanderTeaH
Indicador Pine Script®
Trailing StopMost of the trailing stops on TradingView are made of using the lowest lows and the highest highs. Not many are based around what I called the volatile trailing stop.
This is where the trailing stop will move around according to a set percentage difference from the previous closing value. This allows you to say "If the current bar moves x percent, then stop". The script I've made here is a simple version of that with a few options for smoothing and setting the percent change.
Disclaimer: This is not financial advice, please do your own research before making any decisions.
Indicador Pine Script®
EMAC - Exponential Moving Average CrossEMAC - Exponential Moving Average Cross
This strategy is based in part on original 10ema Basic Swing Trade Strategy by Matt Delong: www.tradingview.com
Link to original 10ema Basic Swing Trade Strategy:
This is the Original EMAC - Exponential Moving Average Cross strategy built as a class for reallifetrading dot com and so has all the default settings and has not been optimized. I would not recommend using this strategy with the default settings and is for educational purposes only. For the fully optimized version please come back around the same time tomorrow 6/16/21 for the EMAC - Exponential Moving Average Cross - Optimized
If you have any questions feel free to reach out to me with a comment and I will try to get back to you quickly with a reply.
Estratégia Pine Script®
Tiger's Stop - Objective Stoploss SettingTrading is a lot about risk management too. I created this script to help with setting and moving a proper stop-loss. It plots an area that is a result of adding and subtracting both average true range and something I call "false range".
►The Average True Range is calculated as the candle's high-low. If there is a gap, it is added to complete the result.
►My own False Range just candle bodies. It is calculated as an absolute value of (close-open).
Then, Rolling Moving Average is applied on both ATR and False Range to get an idea of how far the price tends to extend out of pure randomness. The resulting value is multiplied by a Multiplier.
The next step is an addition of the values to the higher part of the candle for short or a lower part of the candle for long. I prefer a special calculation instead of using Highs and Lows because it allows for more precise observation and stop-loss set up for less wicky symbols.
►►►Additional Functions
• Smoothing - applies moving average to candles from which range distance is calculated. This can achieve good smoothness but higher values will lead to using outdated price in the SL area calculation.
• Enable/Disable - if you know the direction you are going to trade in, it is good to disable either Long Stop-Loss Area or Short Stop-Loss Area. Just untick it in the settings.
►►►Actual Using
Before using the script to set your stop-loss, check the historical data and find a similar set-up. Is it engulfing you use as a trigger? Find a different one and see how effective the stop-loss based on the ATR*multiplier was. This will help you to optimize Multiplier value. A picture shows such research for a double top. You should find more similar situations to find an optimal value.
Ultimately, the indicator still gives you relatively a lot of freedom with your stop-loss settings (at least, that is with the default settings). You need to decide how loose stop-loss you want to set. Average True Range is the furthermost part which will make for a very large stop-loss, on the other hand, False Range might be triggered by a villainous wick unnecessarily. The choice should depend on the specific symbol you trade and perhaps, you will learn to set stops regardless of the indicator.
A little trick : 1. You can set the loosest stop-loss and set a TradingView alert for where the tightest stop-loss would be. When alerted, you will get the opportunity to reconsider the trade and take a loss if needs be or exit if a candle closes there. 2. Mostly for cryptocurrencies, you can set the tightest stop-loss to protect yourself from sudden spikes. If the price approaches it slowly enough, you can move the stop-loss to the further part of the channel. This is not the same as moving stop-loss indefinitely with hopes of reversal if you plan it from the beginning and a smaller stop is meant to protect you from spikes that are not always predictable and drive to both directions.
►►►Advantages of trailing stop-loss
I usually stick with my original stop-loss instead of moving to break even. If my entry area was functional support once, it may work again and is, therefore, still a good entry zone. But an alternative used to preserve as much of the profit as possible is trailing.
Trailing is setting a specific value in ticks or a calculation of how to move the stop-loss whenever the price moves in your favor. Tiger's Stop can be used this way. Whenever there is a new value as the candle closes and that value is closer to price than your current stop-loss, you can update it. However, if it moves further from your price, don't change the stop-loss. This can be a little tiresome if you do it manually but should be worth the effort.
I usually start trailing only after the price moves significantly in my favor that allowing it to return to the entry price would not make any sense.
►►►Feedback and optimization
The preview chart is chosen entirely at random and the values are not optimized for any specific symbol. If you opt to use it, let me know which values work for you the best, I'll add it to the description when I update it.
Furthermore, let me know if you think any sort of alerts would be useful with my script.
Good luck!
Indicador Pine Script®
Indicador Pine Script®
Stop Loss PanelHere is a label panel that shows the stop-loss number for Long or Short trades based on volatility using average true range and and a mult of that.
Indicador Pine Script®
Trailing SL Alerts [QuantNomad]It's alerts version of my Trailing SL strategy:
Use "Once Per Bar" param when creating alerts.
Indicador Pine Script®
Maximum True RamgePlots the the highest true range for the entire dataset.
Beneficial for determine an emergency stopp loss.
Indicador Pine Script®
Market Adaptive Stop-LossI realized that the zone changes in the stoploss remained slow, so I couldn't make enough use of the characteristics of technical indicators when opening positions.
This pushed me to keep stop-loss under the influence of a dependent variable.
This script helped me a lot (everget) :
I've redesigned the stop-loss to be affected by intersections.
Therefore, this script is also suitable for adaptive moving averages, fractional periods.
Script features:
1.You can select calculation methods created by using various technical analysis methods from the scripts' settings:
-Moving Average Convergence Divergence ( Macd )
-Stochastic Oscillator ( Stoch )
-Stochastic Relative Strength Index (StochRSI)
-Stochastic Money Flow Index (StochMFI ) (More info : )
-Know Sure Thing ( KST )
-OBV ( On Balance Volume )
-SMA ( Simple Moving Average )
-EMA ( Exponential Moving Average )
-FISHERTRANSFORM ( Fisher Transform )
-AWESOMEOSCILLATOR( Awesome Oscillator )
-PSAR ( Parabolic Stop and Reverse - Parabolic SAR )
-HULLMA( Hull Moving Average )
-VWMA ( Volume Weighted Moving Average )
-RMA (Moving Average using in Relative Strength Index calculations.)
-COG (Center of Gravity )
-ACC-DIST ( Accumulation / Distribution Index )
2 - The region is determined according to the above calculation methods and if it is larger or smaller than the previous stop loss level.
And if the price in the negative zone is lower than the stoploss, it is the exact signal and is shown with more highlighted colors.
And, in the positive zone, where the price is greater than the stoploss, the trade zones are certain.
Shown with more highlighted colors.
If the zones are correct but stop-loss is not suitable for opening positions:
In other words, if the stop-loss is above/under the highest-lowest levels in the positive zone or if the stop loss is located in the lower zone in the negative zone, these zones are shown to be darker and dimmed so that they do not cause false movements.
*** SUMMARY : As a result, you can use this script with support and resistances,and trend lines to get good results.
I hope it helps in your analyzes. Best regards.
Indicador Pine Script®
Kase Dev Stops Backtest The Kase Dev Stops system finds the optimal statistical balance between letting profits run,
while cutting losses. Kase DevStop seeks an ideal stop level by accounting for volatility (risk),
the variance in volatility (the change in volatility from bar to bar), and volatility skew
(the propensity for volatility to occasionally spike incorrectly).
Kase Dev Stops are set at points at which there is an increasing probability of reversal against
the trend being statistically significant based on the log normal shape of the range curve.
Setting stops will help you take as much risk as necessary to stay in a good position, but not more.
WARNING:
- For purpose educate only
- This script to change bars colors.
Estratégia Pine Script®
Kase Dev Stops The Kase Dev Stops system finds the optimal statistical balance between letting profits run,
while cutting losses. Kase DevStop seeks an ideal stop level by accounting for volatility (risk),
the variance in volatility (the change in volatility from bar to bar), and volatility skew
(the propensity for volatility to occasionally spike incorrectly).
Kase Dev Stops are set at points at which there is an increasing probability of reversal against
the trend being statistically significant based on the log normal shape of the range curve.
Setting stops will help you take as much risk as necessary to stay in a good position, but not more.
Indicador Pine Script®
Average True Range Trailing Stops TFAverage True Range for trailing stops, can be set to any timeframe independently of currently-displayed timeframe
This indicator is derived from
but more customizable.
Many thanks to HPotter for the original version
Indicador Pine Script®
Indicador Pine Script®
SUPERTREND ATR WITH TRAILING STOP LOSS## THIS SCRIPT IS ON GITHUB
## MORE BACKTEST
SuperTrend is a moving stop and reversal line based on the volatility (ATR).
The strategy will ride up your stop loss when price moviment 1%.
The strategy will close your operation when the market price crossed the stop loss.
The strategy will close operation when the line based on the volatility will crossed
The strategy has the following parameters:
+ **ATR PERIOD** - To select number of bars back to execute calculation
+ **ATR MULTPLIER** - To add a multplier factor on volatility
+ **INITIAL STOP LOSS** - Where can isert the value to first stop.
+ **POSITION TYPE** - Where can to select trade position.
+ **BACKTEST PERIOD** - To select range.
## DISCLAIMER
1. I am not licensed financial advisors or broker dealers. I do not tell you when or what to buy or sell. I developed this software which enables you execute manual or automated trades multiple trades using TradingView. The software allows you to set the criteria you want for entering and exiting trades.
2. Do not trade with money you cannot afford to lose.
3. I do not guarantee consistent profits or that anyone can make money with no effort. And I am not selling the holy grail.
4. Every system can have winning and losing streaks.
5. Money management plays a large role in the results of your trading. For example: lot size, account size, broker leverage, and broker margin call rules all have an effect on results. Also, your Take Profit and Stop Loss settings for individual pair trades and for overall account equity have a major impact on results. If you are new to trading and do not understand these items, then I recommend you seek education materials to further your knowledge.
**YOU NEED TO FIND AND USE THE TRADING SYSTEM THAT WORKS BEST FOR YOU AND YOUR TRADING TOLERANCE.**
**I HAVE PROVIDED NOTHING MORE THAN A TOOL WITH OPTIONS FOR YOU TO TRADE WITH THIS PROGRAM ON TRADINGVIEW.**
## NOTE
I accept suggestions to improve the script.
If you encounter any problems i will be happy to share with me.
+ Authors: @exit490
+ Revision: v1.0.0
+ Date: 5-Aug-2019
+ Pinescript version: 4
## LICENSE
Copyright 2019 Mauricio Pimenta / exit490
SuperTrend with Trailing Stop Loss script may be freely distributed under the (../LICENSE).
Estratégia Pine Script®
TRAILING STOP LOSS TO LONG AND SHORT##THIS SCRIPT IS ON GITHUB
This TradingView strategy it is designed to integrate with other strategies with indicators.
It performs a trailing stop loss from entry and exit conditions.
In this strategy you can add conditions for long and short positions.
The strategy will ride up your stop loss when price moviment 1%.
The strategy will close your operation when the market price crossed the stop loss.
Also is possible to select the period that strategy will execute the backtest.
The strategy has the following parameters:
+ **INITIAL STOP LOSS** - Where can isert the value to first stop.
+ **POSITION TYPE** - Where can to select trade position.
+ **BACKTEST PERIOD** - To select range.
## DISCLAIMER
1. I am not licensed financial advisors or broker dealers. I do not tell you when or what to buy or sell. I developed this software which enables you execute manual or automated trades multiple trades using TradingView. The software allows you to set the criteria you want for entering and exiting trades.
2. Do not trade with money you cannot afford to lose.
3. I do not guarantee consistent profits or that anyone can make money with no effort. And I am not selling the holy grail.
4. Every system can have winning and losing streaks.
5. Money management plays a large role in the results of your trading. For example: lot size, account size, broker leverage, and broker margin call rules all have an effect on results. Also, your Take Profit and Stop Loss settings for individual pair trades and for overall account equity have a major impact on results. If you are new to trading and do not understand these items, then I recommend you seek education materials to further your knowledge.
**YOU NEED TO FIND AND USE THE TRADING SYSTEM THAT WORKS BEST FOR YOU AND YOUR TRADING TOLERANCE.**
**I HAVE PROVIDED NOTHING MORE THAN A TOOL WITH OPTIONS FOR YOU TO TRADE WITH THIS PROGRAM ON TRADINGVIEW.**
## NOTE
I accept suggestions to improve the script.
If you encounter any problems I will be happy to share with me.
+ Authors: @exit490
+ Revision: v1.0.0
+ Date: 03-Aug-2019
+ Pinescript version: 4
## LICENSE
Copyright 2019 Mauricio Pimenta / exit490
Trailing Stop Loss script may be freely distributed under the MIT license .
Estratégia Pine Script®
Indicador Pine Script®






















