INVITE-ONLY SCRIPT

Volatility Compression Breakout - LeafAlgo Pro Strategy

The Volatility Compression Breakout strategy is designed to identify periods of low volatility followed by potential breakout opportunities in the market. It aims to capture moments when the price consolidates within a narrow range, indicating a decrease in volatility, and anticipates a subsequent expansion in price movement. This strategy is based on our indicator of the same name (tradingview.com/script/Lc8WH9UF-Volatility-Compression-Breakout/), but differs by offering many more options for the band/channel type and trend filters in addition to implementing the ability to use this strategy with algorithmic plug-ins (see details at the bottom).

This strategy features six types of bands/channels and five types of trend filters, for a total of 30 combinations. The six band/channel types are the Adaptive Gaussian MA channel (based on the Adaptive Gaussian MA that we previously published (tradingview.com/script/th7NZUPM-Adaptive-Gaussian-Moving-Average/)), standard Bollinger Bands, smoothed Bollinger Bands (basis is an EMA of the typical Bollinger Basis), Keltner Channels, a Quadratic Regression Channel (based on the channel that we previously published in the LeafAlgo Pro indicator (tradingview.com/script/4QIJTFTf-LeafAlgo-Pro/)), and Volatility-Based Mean Reversion Bands (tradingview.com/script/Iy7HR2sE-Volatility-Based-Mean-Reversion-Bands/). The five trend filters include an EMA, SMA, Weighted MA, McGinley Dynamic, and the Adaptive Gaussian MA itself.


Examples of the different band/channel types (all with EMA as the trend filter):

Adaptive Gaussian MA Channel:
snapshot

Bollinger Bands:
snapshot

Smoothed Bollinger Bands:
snapshot

Keltner Channels:
snapshot

Quadratic Regression Channel:
snapshot

Volatility-Based Mean Reversion Bands:
snapshot


Examples of the different trend filters (all with Keltner Channels):

EMA:
snapshot

SMA:
snapshot

WMA:
snapshot

McGinley Dynamic:
snapshot

Adaptive Gaussian MA:
snapshot


How the Long/Short Entry Signals are Calculated:

A breakout signal upwards, accompanied by a long entry, is created when the high is greater than the secondary upper band (the upper band plus a standard deviation or with a multiplier, depending on which band/channel type is selected), the latest close is above the trend filter line, and the previous close was below the trend filter line. A break downwards, accompanied by a short entry, is created when the low is below the secondary lower band, the close is below the trend filter line, and the previous close was above the trend filter line. These conditions, along with a confirmed barstate, make up the strategy entry signals.


Coloration:

When the close price is above both the middle/basis and the trend filter, the bars are colored lime green, indicating a potential bullish market sentiment. When the close price is positioned above the basis but below the trend filter, or below the basis but above the trend filter, the bars are colored yellow, signifying a neutral or indecisive market condition. Conversely, when the close price falls below both the basis and the trend filter, the bars are colored fuchsia, suggesting a potential bearish market sentiment. Additionally, the coloration of the middle/basis line and the trend filter provides further visual cues for assessing the trend. When the close price is above the basis, the line is colored lime green, indicating a bullish trend. Conversely, when the close price is below the basis, the line is colored fuchsia, highlighting a bearish trend. Similarly, the trend line is colored lime green when the close price is above it, representing a bullish trend, and fuchsia when the close price is below it, indicating a bearish trend. The fill between the primary and secondary upper bands is colored lime and the fill between the primary and secondary lower bands is colored fuchsia. These colorations can be toggled on/off in the strategy settings menu.


How Changing Parameters Can Be Beneficial:

Modifying the parameters allows you to adapt the indicator to different market conditions and trading styles. For example, with Keltner Channels, increasing the compression period can help identify broader volatility patterns and major market shifts. On the other hand, decreasing the compression period provides more precise and timely signals for short-term traders. Adjusting the compression multiplier affects the width of the Keltner Channels. Higher multipliers increase the breakout threshold, filtering out smaller price movements and providing more reliable signals during significant market shifts. Lower multipliers make the indicator more sensitive to smaller price ranges, generating more frequent but potentially less reliable signals.

Changing the type of trend filter can drastically change your results. Test out each trend filter type and determine which one will work best for your purposes. Further, the MA periods in the trend filter settings can help you align your trades with the prevailing market direction. Increasing the period smoothes out the trend, filtering out shorter-term fluctuations and focusing on more sustained moves. Decreasing the period allows for quicker responses to changes in trend, capturing shorter-term price swings.

By adjusting the parameters and incorporating additional analysis techniques, you can customize the strategy to suit your trading style and preferences. However, it is crucial to exercise caution, conduct thorough analysis, and practice proper risk management to increase the likelihood of successful trades. Remember that no strategy can guarantee profits, and continuous learning and adaptation are key to long-term trading success.


Take Profit/Stop Loss Settings:

Take profit, stop loss, and trailing percentages are also included, found at the bottom of the Input tab under “TT and TTP” as well as “Stop Loss”. The take profit and stop loss levels will be reflected as green and red lines respectively on the chart as they occur. Make sure to understand the TP/SL ratio that you desire before use, as the desired hit rate/profitability percentage will be affected accordingly. The option for adding in a trailing stop has also been included, with options to choose between an ATR-based trail or a percentage-based trail. This strategy does NOT guarantee future returns. Apply caution in trading regardless of discretionary or algorithmic. Understand the concepts of risk/reward and the intricacies of each strategy choice before utilizing them in your personal trading.


Profitview/Pineconnector Settings:

If you wish to utilize Profitview’s automation system, find the included “Profitview Settings” under the Input tab of the strategy settings menu. If not, skip this section entirely as it can be left blank. Options will be “OPEN LONG TITLE”, “OPEN SHORT TITLE”, “CLOSE LONG TITLE”, and “CLOSE SHORT TITLE”. If you wished to trade SOL, for example, you would put “SOL LONG”, “SOL SHORT”, “SOL CLOSE LONG”, and “SOL CLOSE SHORT” in these areas. Within your Profitview extension, ensure that your Alerts all match these titles. To set an alert for use with Profitview, go to the “Alerts” tab in TradingView, then create an alert. Make sure that your desired asset and timeframe are currently displayed on your screen when creating the alert. Under the “Condition” option of the alert, select the strategy, then select the expiration time. If using TradingView Premium, this can be open-ended. Otherwise, select your desired expiration time and date. This can be updated whenever desired to ensure the strategy does not expire. Under “Alert actions”, nothing necessarily needs to be selected unless so desired. Leave the “Alert name” option empty. For the “Message”, delete the generated message and replace it with {{strategy.order.alert_message}} and nothing else. If using Pineconnector, follow the same directions for setting up an alert, but use the ",buy,,risk=" syntax as noted in the tooltips.


Additional Sample Settings (for ETHUSDT-Binance 45M):

Band/Channel Type - Keltner Channels (Compression Period of 20, Multiplier of 1.8x)
Trend Filter - WMA (50 length, no offset, close as the source)
TP/SL - 3.0% TP / 2.0% SL, 0.005 trailed TP, no trailed SL
algorithmATRBands and ChannelsBBbreakoutbreakoutsignalkcstrategytrendVolatility

Invite-only script

Access to this script is restricted to users authorized by the author and usually requires payment. You can add it to your favorites, but you will only be able to use it after requesting permission and obtaining it from its author. Contact LeafAlgo for more information, or follow the author's instructions below.

TradingView does not suggest paying for a script and using it unless you 100% trust its author and understand how the script works. In many cases, you can find a good open-source alternative for free in our Community Scripts.

Author's instructions

For full access to all of our premium indicators and strategies, visit our website (link on our page). For a 7-day free trial message us directly on TradingView.

Want to use this script on a chart?

Warning: please read before requesting access.

Take your trading to new heights with LeafAlgo Premium Indicators and Strategies. Use code SSMS4MGK at checkout for a 50% discount on your first purchase at LeafAlgo.com !

Join our Discord community today!
discord.gg/rNQ2QW59Pn
Also on:

Disclaimer