E9 Bollinger RangeThe E9 Bollinger Range is a technical trading tool that leverages Bollinger Bands to track volatility and price deviations, along with additional trend filtering via EMAs.
The script visually enhances price action with a combination of trend-filtering EMAs, bar colouring for trend direction, signals to indicate potential buy and sell points based on price extension and engulfing patterns.
Here’s a breakdown of its key components:
Bollinger Bands: The strategy plots multiple Bollinger Band deviations to create different price levels. The furthest deviation bands act as warning signs for traders when price extends significantly, signaling potential overbought or oversold conditions.
Bar Colouring: Visual bar colouring is applied to clearly indicate trend direction: green bars for an uptrend and red bars for a downtrend.
EMA Filtering: Two EMAs (50 and 200) are used to help filter out false signals, giving traders a better sense of the underlying trend.
This combination of signals, visual elements, and trend filtering provides traders with a systematic approach to identifying price deviations and taking advantage of market corrections.
Brief History of Bollinger Bands
Bollinger Bands were developed by John Bollinger in the early 1980s as a tool to measure price volatility in financial markets. The bands consist of a moving average (typically 20 periods) with upper and lower bands placed two standard deviations away. These bands expand and contract based on market volatility, offering traders a visual representation of price extremes and potential reversal zones.
John Bollinger’s work revolutionized technical analysis by incorporating volatility into trend detection. His bands remain widely used across markets, including stocks, commodities, and cryptocurrencies. With the ability to highlight overbought and oversold conditions, Bollinger Bands have become a staple in many trading strategies.
Bollinger_bands
Bollinger Bands Enhanced StrategyOverview
The common practice of using Bollinger bands is to use it for building mean reversion or squeeze momentum strategies. In the current script Bollinger Bands Enhanced Strategy we are trying to combine the strengths of both strategies types. It utilizes Bollinger Bands indicator to buy the local dip and activates trailing profit system after reaching the user given number of Average True Ranges (ATR). Also it uses 200 period EMA to filter trades only in the direction of a trend. Strategy can execute only long trades.
Unique Features
Trailing Profit System: Strategy uses user given number of ATR to activate trailing take profit. If price has already reached the trailing profit activation level, scrip will close long trade if price closes below Bollinger Bands middle line.
Configurable Trading Periods: Users can tailor the strategy to specific market windows, adapting to different market conditions.
Major Trend Filter: Strategy utilizes 100 period EMA to take trades only in the direction of a trend.
Flexible Risk Management: Users can choose number of ATR as a stop loss (by default = 1.75) for trades. This is flexible approach because ATR is recalculated on every candle, therefore stop-loss readjusted to the current volatility.
Methodology
First of all, script checks if currently price is above the 200-period exponential moving average EMA. EMA is used to establish the current trend. Script will take long trades on if this filtering system showing us the uptrend. Then the strategy executes the long trade if candle’s low below the lower Bollinger band. To calculate the middle Bollinger line, we use the standard 20-period simple moving average (SMA), lower band is calculated by the substruction from middle line the standard deviation multiplied by user given value (by default = 2).
When long trade executed, script places stop-loss at the price level below the entry price by user defined number of ATR (by default = 1.75). This stop-loss level recalculates at every candle while trade is open according to the current candle ATR value. Also strategy set the trailing profit activation level at the price above the position average price by user given number of ATR (by default = 2.25). It is also recalculated every candle according to ATR value. When price hit this level script plotted the triangle with the label “Strong Uptrend” and start trail the price at the middle Bollinger line. It also started to be plotted as a green line.
When price close below this trailing level script closes the long trade and search for the next trade opportunity.
Risk Management
The strategy employs a combined and flexible approach to risk management:
It allows positions to ride the trend as long as the price continues to move favorably, aiming to capture significant price movements. It features a user-defined ATR stop loss parameter to mitigate risks based on individual risk tolerance. By default, this stop-loss is set to a 1.75*ATR drop from the entry point, but it can be adjusted according to the trader's preferences.
There is no fixed take profit, but strategy allows user to define user the ATR trailing profit activation parameter. By default, this stop-loss is set to a 2.25*ATR growth from the entry point, but it can be adjusted according to the trader's preferences.
Justification of Methodology
This strategy leverages Bollinger bangs indicator to open long trades in the local dips. If price reached the lower band there is a high probability of bounce. Here is an issue: during the strong downtrend price can constantly goes down without any significant correction. That’s why we decided to use 200-period EMA as a trend filter to increase the probability of opening long trades during major uptrend only.
Usually, Bollinger Bands indicator is using for mean reversion or breakout strategies. Both of them have the disadvantages. The mean reversion buys the dip, but closes on the return to some mean value. Therefore, it usually misses the major trend moves. The breakout strategies usually have the issue with too high buy price because to have the breakout confirmation price shall break some price level. Therefore, in such strategies traders need to set the large stop-loss, which decreases potential reward to risk ratio.
In this strategy we are trying to combine the best features of both types of strategies. Script utilizes ate ATR to setup the stop-loss and trailing profit activation levels. ATR takes into account the current volatility. Therefore, when we setup stop-loss with the user-given number of ATR we increase the probability to decrease the number of false stop outs. The trailing profit concept is trying to add the beat feature from breakout strategies and increase probability to stay in trade while uptrend is developing. When price hit the trailing profit activation level, script started to trail the price with middle line if Bollinger bands indicator. Only when candle closes below the middle line script closes the long trade.
Backtest Results
Operating window: Date range of backtests is 2020.10.01 - 2024.07.01. It is chosen to let the strategy to close all opened positions.
Commission and Slippage: Includes a standard Binance commission of 0.1% and accounts for possible slippage over 5 ticks.
Initial capital: 10000 USDT
Percent of capital used in every trade: 30%
Maximum Single Position Loss: -9.78%
Maximum Single Profit: +25.62%
Net Profit: +6778.11 USDT (+67.78%)
Total Trades: 111 (48.65% win rate)
Profit Factor: 2.065
Maximum Accumulated Loss: 853.56 USDT (-6.60%)
Average Profit per Trade: 61.06 USDT (+1.62%)
Average Trade Duration: 76 hours
These results are obtained with realistic parameters representing trading conditions observed at major exchanges such as Binance and with realistic trading portfolio usage parameters.
How to Use
Add the script to favorites for easy access.
Apply to the desired timeframe and chart (optimal performance observed on 4h BTC/USDT).
Configure settings using the dropdown choice list in the built-in menu.
Set up alerts to automate strategy positions through web hook with the text: {{strategy.order.alert_message}}
Disclaimer:
Educational and informational tool reflecting Skyrex commitment to informed trading. Past performance does not guarantee future results. Test strategies in a simulated environment before live implementation
Johnny's Adjusted BB Buy/Sell Signal"Johnny's Adjusted BB Buy/Sell Signal" leverages Bollinger Bands and moving averages to provide dynamic buy and sell signals based on market conditions. This indicator is particularly useful for traders looking to identify strategic entry and exit points based on volatility and trend analysis.
How It Works
Bollinger Bands Setup: The indicator calculates Bollinger Bands using a specified length and multiplier. These bands serve to identify potential overbought (upper band) or oversold (lower band) conditions.
Moving Averages: Two moving averages are calculated — a trend moving average (trendMA) and a long-term moving average (longTermMA) — to gauge the market's direction over different time frames.
Market Phase Determination: The script classifies the market into bullish or bearish phases based on the relationship of the closing price to the long-term moving average.
Strong Buy and Sell Signals: Enhanced signals are generated based on how significantly the price deviates from the Bollinger Bands, coupled with the average candle size over a specified lookback period. The signals are adjusted based on whether the market is bullish or bearish:
In bullish markets, a strong buy signal is triggered if the price significantly drops below the lower Bollinger Band. Conversely, a strong sell signal is activated when the price rises well above the upper band.
In bearish markets, these signals are modified to be more conservative, adjusting the thresholds for triggering strong buy and sell signals.
Features:
Flexibility: Users can adjust the length of the Bollinger Bands and moving averages, as well as the multipliers and factors that determine the strength of buy and sell signals, making it highly customizable to different trading styles and market conditions.
Visual Aids: The script vividly plots the Bollinger Bands and moving averages, and signals are visually represented on the chart, allowing traders to quickly assess trading opportunities:
Regular buy and sell signals are indicated by simple shapes below or above price bars.
Strong buy and sell signals are highlighted with distinctive colors and placed prominently to catch the trader's attention.
Background Coloring: The background color changes based on the market phase, providing an immediate visual cue of the market's overall sentiment.
Usage:
This indicator is ideal for traders who rely on technical analysis to guide their trading decisions. By integrating both Bollinger Bands and moving averages, it provides a multi-faceted view of market trends and volatility, making it suitable for identifying potential reversals and continuation patterns. Traders can use this tool to enhance their understanding of market dynamics and refine their trading strategies accordingly.
MTF BB+KC Avg
Bollinger Bands (BB) are a widely used technical analysis created by John Bollinger in the early 1980’s. Bollinger Bands consist of a band of three lines which are plotted in relation to instrument prices. The line in the middle is usually a Simple Moving Average (SMA) set to a period of 20 days (The type of trend line and period can be changed by the trader; however a 20 day moving average is by far the most popular). This indicator does not plot the middle line. The Upper and Lower Bands are used as a way to measure volatility by observing the relationship between the Bands and price. Typically the Upper and Lower Bands are set to two standard deviations away from the middle line, however the number of standard deviations can also be adjusted in the indicator.
Keltner Channels (KC) are banded lines similar to Bollinger Bands and Moving Average Envelopes. They consist of an Upper Envelope above a Middle Line (not plotted in this indicator) as well as a Lower Envelope below the Middle Line. The Middle Line is a moving average of price over a user-defined time period. Either a simple moving average or an exponential moving average are typically used. The Upper and Lower Envelopes are set a (user-defined multiple) of a range away from the Middle Line. This can be a multiple of the daily high/low range, or more commonly a multiple of the Average True Range.
This indicator is built on AVERAGING the BB and KC values for each bar, so you have an efficient metric of AVERAGE volatility. The indicator visualizes changes in volatility which is of course dynamic.
What to look for
High/Low Prices
One thing that must be understood about this indicator's plots is that it averages by adding BB levels to KC levels and dividing by 2. So the plots provide a relative definition of high and low from two very popular indicators. Prices are almost always within the upper and lower bands. Therefore, when prices move up near the upper or lower bands or even break through the band, many traders would see that price action as OVER-EXTENDED (either overbought or oversold, as applicable). This would preset a possible selling or buying opportunity.
Cycling Between Expansion and Contraction
Volatility can generally be seen as a cycle. Typically periods of time with low volatility and steady or sideways prices (known as contraction) are followed by period of expansion. Expansion is a period of time characterized by high volatility and moving prices. Periods of expansion are then generally followed by periods of contraction. It is a cycle in which traders can be better prepared to navigate by using Bollinger Bands because of the indicators ability to monitor ever changing volatility.
Walking the Bands
Of course, just like with any indicator, there are exceptions to every rule and plenty of examples where what is expected to happen, does not happen. Previously, it was mentioned that price breaking above the Upper Band or breaking below the Lower band could signify a selling or buying opportunity respectively. However this is not always the case. “Walking the Bands” can occur in either a strong uptrend or a strong downtrend.
During a strong uptrend, there may be repeated instances of price touching or breaking through the Upper Band. Each time that this occurs, it is not a sell signal, it is a result of the overall strength of the move. Likewise during a strong downtrend there may be repeated instances of price touching or breaking through the Lower Band. Each time that this occurs, it is not a buy signal, it is a result of the overall strength of the move.
Keep in mind that instances of “Walking the Bands” will only occur in strong, defined uptrends or downtrends.
Inputs
TimeFrame
You can select any timeframe froom 1 minute to 12 months for the bar measured.
Length of the internal moving averages
You can select the period of time to be used in calculating the moving averages which create the base for the Upper and Lower Bands. 20 days is the default.
Basis MA Type
Determines the type of Moving Average that is applied to the basis plot line. Default is SMA and you can select EMA.
Source
Determines what data from each bar will be used in calculations. Close is the default.
StdDev/Multiplier
The number of Standard Deviations (for BB) or Multiplier (for KC) away from the moving averages that the Upper and Lower Bands should be. 2 is the default value for each indicator.
2Mars strategy [OKX]The strategy is based on the intersection of two moving averages, which requires adjusting the parameters (ratio and multiplier) for the moving average.
Basis MA length: multiplier * ratio
Signal MA length: multiplier
The SuperTrend indicator is used for additional confirmation of entry into a position.
Bollinger Bands and position reversal are used for take-profit.
About stop loss:
If activated, the stop loss price will be updated on every entry.
Basic setup:
Additional:
Alerts for OKX:
Bollinger RSI BandsIndicator Description:
The "Bollinger RSI Bands" is an advanced technical analysis tool designed to empower traders with comprehensive insights into market trends, reversals, and overbought/oversold conditions. This multifaceted indicator combines the unique features of candle coloration and Bollinger Bands with the Relative Strength Index (RSI), making it an indispensable tool for traders seeking to optimize their trading strategies.
Purpose:
The primary purpose of the "Bollinger RSI Bands" indicator is to provide traders with a holistic view of market dynamics by offering the following key functionalities:
Candle Coloration: The indicator's signature candle colors - green for bullish and red for bearish - serve as a visual representation of the prevailing market trend, enabling traders to quickly identify and confirm market direction.
RSI-Based Moving Average: A smoothed RSI-based moving average is plotted, facilitating the detection of trend changes and potential reversal points with greater clarity.
RSI Bands: Upper and lower RSI bands, set at 70 and 30, respectively, help traders pinpoint overbought and oversold conditions, aiding in timely entry and exit decisions.
Bollinger Bands: In addition to RSI bands, Bollinger Bands are overlaid on the RSI-based moving average, offering insights into price volatility and highlighting potential breakout opportunities.
How to Use:
To maximize the utility of the "Bollinger RSI Bands" indicator, traders can follow these essential steps:
Candle Color Confirmation: Assess the color of the candles. Green candles signify a bullish trend, while red candles indicate a bearish trend, providing a clear and intuitive visual confirmation of market direction.
Overbought and Oversold Identification: Monitor price levels relative to the upper RSI band (70) for potential overbought signals and below the lower RSI band (30) for potential oversold signals, allowing for timely adjustments to trading positions.
Trend Reversal Recognition: Observe changes in the direction of the RSI-based moving average. A transition from bearish to bullish, or vice versa, can serve as a valuable signal for potential trend reversals.
Volatility and Breakout Opportunities: Keep a watchful eye on the Bollinger Bands. Expanding bands signify increased price volatility, often signaling forthcoming breakout opportunities.
Why Use It:
The "Bollinger RSI Bands" indicator offers traders several compelling reasons to incorporate it into their trading strategies:
Clear Trend Confirmation: The indicator's distinct candle colors provide traders with immediate confirmation of the current trend direction, simplifying trend-following strategies.
Precise Entry and Exit Points: By identifying overbought and oversold conditions, traders can make more precise entries and exits, optimizing their risk-reward ratios.
Timely Trend Reversal Signals: Recognizing shifts in the RSI-based moving average direction allows traders to anticipate potential trend reversals and adapt their strategies accordingly.
Volatility Insights: Bollinger Bands offer valuable insights into price volatility, aiding in the identification of potential breakout opportunities.
User-Friendly and Versatile: Despite its advanced features, the indicator remains user-friendly and versatile, catering to traders of all experience levels.
In summary, the "Bollinger RSI Bands" indicator is an indispensable tool for traders seeking a comprehensive view of market dynamics. With its unique combination of candle coloration and Bollinger Bands, it empowers traders to make more informed and strategic trading decisions, ultimately enhancing their trading outcomes.
Note: Always utilize this indicator in conjunction with other technical and fundamental analysis tools and exercise prudence in your trading decisions. Past performance is not indicative of future results.
VolatilityIndicatorsLibrary "VolatilityIndicators"
This is a library of Volatility Indicators .
It aims to facilitate the grouping of this category of indicators, and also offer the customized supply of
the parameters and sources, not being restricted to just the closing price.
@Thanks and credits:
1. Dynamic Zones: Leo Zamansky, Ph.D., and David Stendahl
2. Deviation: Karl Pearson (code by TradingView)
3. Variance: Ronald Fisher (code by TradingView)
4. Z-score: Veronique Valcu (code by HPotter)
5. Standard deviation: Ronald Fisher (code by TradingView)
6. ATR (Average True Range): J. Welles Wilder (code by TradingView)
7. ATRP (Average True Range Percent): millerrh
8. Historical Volatility: HPotter
9. Min-Max Scale Normalization: gorx1
10. Mean Normalization: gorx1
11. Standardization: gorx1
12. Scaling to unit length: gorx1
13. LS Volatility Index: Alexandre Wolwacz (Stormer), Fabrício Lorenz, Fábio Figueiredo (Vlad) (code by me)
14. Bollinger Bands: John Bollinger (code by TradingView)
15. Bollinger Bands %: John Bollinger (code by TradingView)
16. Bollinger Bands Width: John Bollinger (code by TradingView)
dev(source, length, anotherSource)
Deviation. Measure the difference between a source in relation to another source
Parameters:
source (float)
length (simple int) : (int) Sequential period to calculate the deviation
anotherSource (float) : (float) Source to compare
Returns: (float) Bollinger Bands Width
variance(src, mean, length, biased, degreesOfFreedom)
Variance. A statistical measurement of the spread between numbers in a data set. More specifically,
variance measures how far each number in the set is from the mean (average), and thus from every other number in the set.
Variance is often depicted by this symbol: σ2. It is used by both analysts and traders to determine volatility and market security.
Parameters:
src (float) : (float) Source to calculate variance
mean (float) : (float) Mean (Moving average)
length (simple int) : (int) The sequential period to calcule the variance (number of values in data set)
biased (simple bool) : (bool) Defines the type of standard deviation. If true, uses biased sample variance (n),
degreesOfFreedom (simple int) : (int) Degrees of freedom. The number of values in the final calculation of a statistic that are free to vary.
Default value is n-1, where n here is length. Only applies when biased parameter is defined as true.
Returns: (float) Standard deviation
stDev(src, length, mean, biased, degreesOfFreedom)
Measure the Standard deviation from a source in relation to it's moving average.
In this implementation, you pass the average as a parameter, allowing a more personalized calculation.
Parameters:
src (float) : (float) Source to calculate standard deviation
length (simple int) : (int) The sequential period to calcule the standard deviation
mean (float) : (float) Moving average.
biased (simple bool) : (bool) Defines the type of standard deviation. If true, uses biased sample variance (n),
else uses unbiased sample variance (n-1 or another value, as long as it is in the range between 1 and n-1), where n=length.
degreesOfFreedom (simple int) : (int) Degrees of freedom. The number of values in the final calculation of a statistic that are free to vary.
Default value is n-1, where n here is length.
Returns: (float) Standard deviation
zscore(src, mean, length, biased, degreesOfFreedom)
Z-Score. A z-score is a statistical measurement that indicates how many standard deviations a data point is from
the mean of a data set. It is also known as a standard score. The formula for calculating a z-score is (x - μ) / σ,
where x is the individual data point, μ is the mean of the data set, and σ is the standard deviation of the data set.
Z-scores are useful in identifying outliers or extreme values in a data set. A positive z-score indicates that the
data point is above the mean, while a negative z-score indicates that the data point is below the mean. A z-score of
0 indicates that the data point is equal to the mean.
Z-scores are often used in hypothesis testing and determining confidence intervals. They can also be used to compare
data sets with different units or scales, as the z-score standardizes the data. Overall, z-scores provide a way to
measure the relative position of a data point in a data
Parameters:
src (float) : (float) Source to calculate z-score
mean (float) : (float) Moving average.
length (simple int) : (int) The sequential period to calcule the standard deviation
biased (simple bool) : (bool) Defines the type of standard deviation. If true, uses biased sample variance (n),
else uses unbiased sample variance (n-1 or another value, as long as it is in the range between 1 and n-1), where n=length.
degreesOfFreedom (simple int) : (int) Degrees of freedom. The number of values in the final calculation of a statistic that are free to vary.
Default value is n-1, where n here is length.
Returns: (float) Z-score
atr(source, length)
ATR: Average True Range. Customized version with source parameter.
Parameters:
source (float) : (float) Source
length (simple int) : (int) Length (number of bars back)
Returns: (float) ATR
atrp(length, sourceP)
ATRP (Average True Range Percent)
Parameters:
length (simple int) : (int) Length (number of bars back) for ATR
sourceP (float) : (float) Source for calculating percentage relativity
Returns: (float) ATRP
atrp(source, length, sourceP)
ATRP (Average True Range Percent). Customized version with source parameter.
Parameters:
source (float) : (float) Source for ATR
length (simple int) : (int) Length (number of bars back) for ATR
sourceP (float) : (float) Source for calculating percentage relativity
Returns: (float) ATRP
historicalVolatility(lengthATR, lengthHist)
Historical Volatility
Parameters:
lengthATR (simple int) : (int) Length (number of bars back) for ATR
lengthHist (simple int) : (int) Length (number of bars back) for Historical Volatility
Returns: (float) Historical Volatility
historicalVolatility(source, lengthATR, lengthHist)
Historical Volatility
Parameters:
source (float) : (float) Source for ATR
lengthATR (simple int) : (int) Length (number of bars back) for ATR
lengthHist (simple int) : (int) Length (number of bars back) for Historical Volatility
Returns: (float) Historical Volatility
minMaxNormalization(src, numbars)
Min-Max Scale Normalization. Maximum and minimum values are taken from the sequential range of
numbars bars back, where numbars is a number defined by the user.
Parameters:
src (float) : (float) Source to normalize
numbars (simple int) : (int) Numbers of sequential bars back to seek for lowest and hightest values.
Returns: (float) Normalized value
minMaxNormalization(src, numbars, minimumLimit, maximumLimit)
Min-Max Scale Normalization. Maximum and minimum values are taken from the sequential range of
numbars bars back, where numbars is a number defined by the user.
In this implementation, the user explicitly provides the desired minimum (min) and maximum (max) values for the scale,
rather than using the minimum and maximum values from the data.
Parameters:
src (float) : (float) Source to normalize
numbars (simple int) : (int) Numbers of sequential bars back to seek for lowest and hightest values.
minimumLimit (simple float) : (float) Minimum value to scale
maximumLimit (simple float) : (float) Maximum value to scale
Returns: (float) Normalized value
meanNormalization(src, numbars, mean)
Mean Normalization
Parameters:
src (float) : (float) Source to normalize
numbars (simple int) : (int) Numbers of sequential bars back to seek for lowest and hightest values.
mean (float) : (float) Mean of source
Returns: (float) Normalized value
standardization(src, mean, stDev)
Standardization (Z-score Normalization). How "outside the mean" values relate to the standard deviation (ratio between first and second)
Parameters:
src (float) : (float) Source to normalize
mean (float) : (float) Mean of source
stDev (float) : (float) Standard Deviation
Returns: (float) Normalized value
scalingToUnitLength(src, numbars)
Scaling to unit length
Parameters:
src (float) : (float) Source to normalize
numbars (simple int) : (int) Numbers of sequential bars back to seek for lowest and hightest values.
Returns: (float) Normalized value
lsVolatilityIndex(movingAverage, sourceHvol, lengthATR, lengthHist, lenNormal, lowerLimit, upperLimit)
LS Volatility Index. Measures the volatility of price in relation to an average.
Parameters:
movingAverage (float) : (float) A moving average
sourceHvol (float) : (float) Source for calculating the historical volatility
lengthATR (simple int) : (float) Length for calculating the ATR (Average True Range)
lengthHist (simple int) : (float) Length for calculating the historical volatility
lenNormal (simple int) : (float) Length for normalization
lowerLimit (simple int)
upperLimit (simple int)
Returns: (float) LS Volatility Index
lsVolatilityIndex(sourcePrice, movingAverage, sourceHvol, lengthATR, lengthHist, lenNormal, lowerLimit, upperLimit)
LS Volatility Index. Measures the volatility of price in relation to an average.
Parameters:
sourcePrice (float) : (float) Source for measure the distance
movingAverage (float) : (float) A moving average
sourceHvol (float) : (float) Source for calculating the historical volatility
lengthATR (simple int) : (float) Length for calculating the ATR (Average True Range)
lengthHist (simple int) : (float) Length for calculating the historical volatility
lenNormal (simple int)
lowerLimit (simple int)
upperLimit (simple int)
Returns: (float) LS Volatility Index
bollingerBands(src, length, mult, basis)
Bollinger Bands. A Bollinger Band is a technical analysis tool defined by a set of lines plotted
two standard deviations (positively and negatively) away from a simple moving average (SMA) of the security's price,
but can be adjusted to user preferences. In this version you can pass a customized basis (moving average), not only SMA.
Parameters:
src (float) : (float) Source to calculate standard deviation used in Bollinger Bands
length (simple int) : (int) The time period to be used in calculating the standard deviation
mult (simple float) : (float) Multiplier used in standard deviation. Basically, the upper/lower bands are standard deviation multiplied by this.
basis (float) : (float) Basis of Bollinger Bands (a moving average)
Returns: (float) A tuple of Bollinger Bands, where index 1=basis; 2=basis+dev; 3=basis-dev; and dev=multiplier*stdev
bollingerBands(src, length, aMult, basis)
Bollinger Bands. A Bollinger Band is a technical analysis tool defined by a set of lines plotted
two standard deviations (positively and negatively) away from a simple moving average (SMA) of the security's price,
but can be adjusted to user preferences. In this version you can pass a customized basis (moving average), not only SMA.
Also, various multipliers can be passed, thus getting more bands (instead of just 2).
Parameters:
src (float) : (float) Source to calculate standard deviation used in Bollinger Bands
length (simple int) : (int) The time period to be used in calculating the standard deviation
aMult (float ) : (float ) An array of multiplies used in standard deviation. Basically, the upper/lower bands are standard deviation multiplied by this.
This array of multipliers permit the use of various bands, not only 2.
basis (float) : (float) Basis of Bollinger Bands (a moving average)
Returns: (float ) An array of Bollinger Bands, where:
index 1=basis; 2=basis+dev1; 3=basis-dev1; 4=basis+dev2, 5=basis-dev2, 6=basis+dev2, 7=basis-dev2, Nup=basis+devN, Nlow=basis-devN
and dev1, dev2, devN are ```multiplier N * stdev```
bollingerBandsB(src, length, mult, basis)
Bollinger Bands %B - or Percent Bandwidth (%B).
Quantify or display where price (or another source) is in relation to the bands.
%B can be useful in identifying trends and trading signals.
Calculation:
%B = (Current Price - Lower Band) / (Upper Band - Lower Band)
Parameters:
src (float) : (float) Source to calculate standard deviation used in Bollinger Bands
length (simple int) : (int) The time period to be used in calculating the standard deviation
mult (simple float) : (float) Multiplier used in standard deviation
basis (float) : (float) Basis of Bollinger Bands (a moving average)
Returns: (float) Bollinger Bands %B
bollingerBandsB(src, length, aMult, basis)
Bollinger Bands %B - or Percent Bandwidth (%B).
Quantify or display where price (or another source) is in relation to the bands.
%B can be useful in identifying trends and trading signals.
Calculation
%B = (Current Price - Lower Band) / (Upper Band - Lower Band)
Parameters:
src (float) : (float) Source to calculate standard deviation used in Bollinger Bands
length (simple int) : (int) The time period to be used in calculating the standard deviation
aMult (float ) : (float ) Array of multiplier used in standard deviation. Basically, the upper/lower bands are standard deviation multiplied by this.
This array of multipliers permit the use of various bands, not only 2.
basis (float) : (float) Basis of Bollinger Bands (a moving average)
Returns: (float ) An array of Bollinger Bands %B. The number of results in this array is equal the numbers of multipliers passed via parameter.
bollingerBandsW(src, length, mult, basis)
Bollinger Bands Width. Serve as a way to quantitatively measure the width between the Upper and Lower Bands
Calculation:
Bollinger Bands Width = (Upper Band - Lower Band) / Middle Band
Parameters:
src (float) : (float) Source to calculate standard deviation used in Bollinger Bands
length (simple int) : (int) Sequential period to calculate the standard deviation
mult (simple float) : (float) Multiplier used in standard deviation
basis (float) : (float) Basis of Bollinger Bands (a moving average)
Returns: (float) Bollinger Bands Width
bollingerBandsW(src, length, aMult, basis)
Bollinger Bands Width. Serve as a way to quantitatively measure the width between the Upper and Lower Bands
Calculation
Bollinger Bands Width = (Upper Band - Lower Band) / Middle Band
Parameters:
src (float) : (float) Source to calculate standard deviation used in Bollinger Bands
length (simple int) : (int) Sequential period to calculate the standard deviation
aMult (float ) : (float ) Array of multiplier used in standard deviation. Basically, the upper/lower bands are standard deviation multiplied by this.
This array of multipliers permit the use of various bands, not only 2.
basis (float) : (float) Basis of Bollinger Bands (a moving average)
Returns: (float ) An array of Bollinger Bands Width. The number of results in this array is equal the numbers of multipliers passed via parameter.
dinamicZone(source, sampleLength, pcntAbove, pcntBelow)
Get Dynamic Zones
Parameters:
source (float) : (float) Source
sampleLength (simple int) : (int) Sample Length
pcntAbove (simple float) : (float) Calculates the top of the dynamic zone, considering that the maximum values are above x% of the sample
pcntBelow (simple float) : (float) Calculates the bottom of the dynamic zone, considering that the minimum values are below x% of the sample
Returns: A tuple with 3 series of values: (1) Upper Line of Dynamic Zone;
(2) Lower Line of Dynamic Zone; (3) Center of Dynamic Zone (x = 50%)
Examples:
Bollinger Bands Lab - by InFinitoVariation of the Moving Average Lab that includes Bollinger Bands functionality for any manually created Moving Average. It includes:
- Standard Deviations for any MA
- Fixed Symmetrical Deviations for any MA that remain at a constant % away from the MA
- The same Moving Average creation settings from the Moving Average Lab
"The Moving Average Lab allows to create any possible combination of up to 3 given MAs. It is meant to help you find the perfect MA that fits your style, strategy and market type.
This script allows to average, weight, double and triple multiple types and lengths of Moving Averages
Currently supported MA types are:
SMA
EMA
VWMA
WMA
SMMA (RMA)
HMA
LSMA
DEMA
TEMA
Features:
- Double or Triple any type of Moving Average using the same logic used for calculating DEMAs and TEMAs
- Average 2 or 3 different types and lengths of Moving Average
- Weight each MA manually
- Average up to 3 personalized MAs
- Average different Moving Averages with different length each "
The preview screenshot shows:
- The combination of:
- 200 LSMA - Weight: 1
- 200 HMA - Weight: 2
- 200 VWMA - Weight: 1 - Double
- The regular Bollinger Band setting, 2 standard deviations
- Two fixed symmetrical deviations at 15% and 20% away from the XMA
Moving Averages + BB & R.VWAP StDev (multi-tf)█ Moving Averages + Bollinger Bands and Rolling Volume Weighted Average Price with Standard Deviation Bands (Multi Timeframe)
Multiple moving averages can be independently applied.
The length , type and timeframe of each moving average are configurable .
The lines and colors are customizable too.
This script can display:
Moving Averages
Bollinger Bands
Rolling VWAP and Standard Deviation Bands
Types of Moving Averages:
Simple Moving Average (SMA)
Exponential Moving Average (EMA)
Smoothed Moving Average (SMMA)
Weighted Moving Average (WMA)
Volume Weighted Moving Average (VWMA)
Least Squares Moving Average (LSMA)
Hull Moving Average (HMA)
Arnaud Legoux Moving Average (ALMA)
█ Moving Average
Moving Averages are price based, lagging (or reactive) indicators that display the average price of a security over a set period of time.
A Moving Average is a good way to gauge momentum as well as to confirm trends, and define areas of support and resistance.
█ Bollinger Bands
Bollinger Bands consist of a band of three lines which are plotted in relation to security prices.
The line in the middle is usually a Simple Moving Average (SMA) set to a period of 20 days (the type of trend line and period can be changed by the trader, a 20 day moving average is by far the most popular).
The SMA then serves as a base for the Upper and Lower Bands which are used as a way to measure volatility by observing the relationship between the Bands and price.
█ Rolling VWAP
The typical VWAP is designed to be used on intraday charts, as it resets at the beginning of the day.
Such VWAPs cannot be used on daily, weekly or monthly charts. Instead, this rolling VWAP uses a time period that automatically adjusts to the chart's timeframe.
You can thus use the rolling VWAP on any chart that includes volume information in its data feed.
Because the rolling VWAP uses a moving window, it does not exhibit the jumpiness of VWAP plots that reset.
Based on the previous script :
Bollinger Bands %B (ValueRay)One of the key features of this BB%B is its ability to highlight overbought and oversold conditions. This allows you to make informed decisions on when to enter and exit a trade, helping you maximize your profits and minimize your losses.
- Bollinger Bands %B with the ability to change to a different Time Frame.(Defaults to current Chart Time Frame).
- Ability To Turn On/Off Background Highlighting if BB %B is Above/Below 0 / 1 thresholds.
- Ability To Turn On/Off Background Highlighting when BB %B Crosses back above/unser 0/1 thresholds.
---
My personal recommandation use: combine with CM_Ultimate RSI Multi Time Frame (ChrisMoody) and have solid oversold/overbought levels, when hes RSI and my BB %B are bot red/green
VWAP Bollinger Band Crossover Breakout with ResistanceCredit to © Jesus_Salvatierra for VWAP script
This script help you find a trend in momentum stock that is about to breakout and shows resistance point. This script utilizes Bollinger bands VWAP and is good for intra day charts.
VWAP, or Volume Weighted Average Price, is a technical analysis tool used to measure the average price a security trades at during a given time period, weighted by the trading volume for each price level. It is commonly used by traders and investors to identify the true average price of a security and to assess whether they are buying or selling at a fair price.
A Bollinger Band is a technical analysis tool that uses standard deviation to measure the volatility of a security. The Bollinger Band is typically composed of three lines: the upper band, the lower band, and the middle band. The middle band is a simple moving average of the security's price, while the upper and lower bands are calculated based on the standard deviation of the security's price.
A Bollinger Band crossover occurs when the price of a security crosses above or below one of the bands. When the price crosses above the upper band, it is considered overbought, while when it crosses below the lower band, it is considered oversold. Traders often use Bollinger Band crossovers as a signal to enter or exit a position, depending on their trading strategy.
The VWAP and Bollinger Band crossover are two separate technical analysis tools that can be used in conjunction with each other. When a security's price crosses above or below the Bollinger Band, traders may look to the VWAP to confirm whether the security is trading at a fair price. If the security is trading above the VWAP, it may be overvalued, while if it is trading below the VWAP, it may be undervalued. Similarly, traders may use the Bollinger Band crossover as a signal to enter or exit a position, while also taking into account the VWAP to assess whether the price is fair.
BB Mod + ForecastThis is a combination of two previous indicators; ALMA stdev band with fibs and Vector MACD.
Bollinger Band Mod fits the standard deviation on both sides of the center moving average ( ALMA +/- stdev / 2 ) and calculates Fibonacci ratios from stdev on both sides.
It is more averaging and more responsive at the same time compared to Bollinger Band.
Forecast is calculated from difference between origin ma ( ALMA from hl2 ) and six different period Hull moving averages averaged together and added to the center ma on both sides.
Fibonacci levels for 0.618 1.618 and 2.618 are added.
The dashed lines point towards the trend. Gives you a better idea of the current trend and momentum in the band.
Bollinger Band PW PackageThis script creates a Bollinger Band Package with Bollinger Band Percent and Width displayed on chart. The indicator also prints signals when price closes above or below the Bollinger Bands using shapes (circles by default). Bollinger Bands were created by John Bollinger, and consist of three lines plotted on a chart: the basis line (typically a moving average, 20 sma by default), an upper line (equal to the basis plus a certain number of standard deviations of the price, 2), and a lower line (equal to the basis minus the same number of standard deviations, 2 by default).
The script calculates the Bollinger Bands for a given input parameters by taking the length of the moving average and the number of standard deviations to use for the upper and lower bands. It then calculates the Bollinger Bands using these input parameters.
The script defines two functions: get_bb_percent() and get_bb_width(). The get_bb_percent() function calculates the percentage distance between the closing price and the lower band, as a percentage of the total distance between the upper and lower bands. This value is commonly referred to as the "Bollinger Band Percent". The get_bb_width() function calculates the percentage distance between the upper and lower bands, as a percentage of the basis line. This value is commonly referred to as the "Bollinger Band Width".
The script creates a table at the middle right of the chart, where the Bollinger Band Percent and Width values are displayed. The table is designed with two rows, one for the Bollinger Band Percent value and the other for the Bollinger Band Width value.
The script plots the three Bollinger Bands lines on the chart. The basis line is plotted in blue, the upper band line in red, and the lower band line in green.
The script then plots the shapes that signify closures above and below the bands using plotshape. The shapes and colors are customizable in the settings menu.
This indicator is designed to have all three components and a visual aid to assist Bollinger Band technical analysis in one script which can be helpful in determining potential trading opportunities. We thank John Bollinger for his contribution to technical analysis and trading.
Please give feedback and modify to your liking.
Modified Bollinger BandsThis script has been distributed for learning purposes.
A particular kind of price envelope is "Bollinger Bands" indicator. Upper and lower price range levels are determined by price envelopes. By default, Bollinger Bands are plotted in Tradingview as envelopes at a standard deviation level above and below the price's simple moving average (SMA). I attempted to modify the indicator in this version by adding several kinds of moving averages first. The key feature is that standard deviation should be modified. in Tradingview, SMA calculates the standard deviation. The allocated moving average should be used to calculate the std function when the base line is changed.
Fibonacci Bollinger Band ClusterThis indicator creates moving averages based on Fibonacci numbers (3-233, divided by 10 to average) sourced by high, low, and ohlc4 and plots lines based on these three. The Fib MA High line is either green or red (Fib High < Close), the Fib MA Low line is either lime or orange (Fib Low < Close), and the Fib MA OHLC4 line is constantly white. A cluster or series of Bollinger Bands is then created using the Fib MA OHLC4 line as the basis. Fibonacci-based deviations (1, 2, 3, 5, 8) are then used to create three upper and three lower Bollinger lines.
Generalized Bollinger Bands (Tartigradia)Bollinger Band is simply a representation of the rolling average of price and its standard deviation around the average (called the "basis").
This indicator generalizes the Bollinger Band by implementing many different equations to calculate the Bollinger Bands beyond the standard deviation and sma.
Whereas other Bollinger Bands indicators often just change the basis but not the stdev calculation, the correct way to change the basis is to also change it inside the stdev calculation.
Advanced features such as temporal discounting (ie, newer bars can have more weights), median absolute deviation and multiple sigma bands (eg, 3-sigma) are available.
Up to 3 different Bollinger Bands can be displayed, and the background can be highlighted when price is overbought/oversold (beyond the Bollinger Band of choice).
Tip: BB3, which is the bollinger band with standard deviation of 3, which represents 99% of observed values in the lookback period, is a good choice to highlight overbought/oversold conditions.
Usage:
Use it as usual Bollinger Bands, as a measure of volatility, and to setup stop losses.
Use the bandwidth as a measure of volatility: higher is more volatile, lower is less.
When overbought, it can be a good time to sell/short. Use a higher Bollinger Band Multiplier such as 3 or more to reduce false positives.
When oversold, it can be a good time to buy/long. Use a higher Bollinger Band Multiplier such as 3 or more to reduce false positives.
Consider setting a much tighter lookback period of 4 as recommended in backtested works (en.wikipedia.org), use zlma instead of sma, and finally set a higher timeframe for the Bollinger Bands than the one you are currently studying. Then, the Bollinger Bands can help in detecting overbought and oversold regions (price going "out of bands").
Note that I tried to automate the setting of a higher timeframe, but for some reason the output is different when I manually do it using request.security() than when it's in indicator(timeframe=""). If someone has any suggestion as to why it happens, please let me know! (You can try it for yourself by uncommenting the auto_timeframe parameter line).
If you want to plot the indicator in a separate pane, and to also plot %B and bandwidth, I made another indicator "Generalized Bollinger Bands %B and Bandwidth by Tartigradia" that does that.
Adaptive Rebound Line Bands (ARL Bands)These bands consist of 4 ARLs (See: Adaptive Rebound Line ('ARL'/AR Line)) that help accurately spot price rebounds.
It is excellent for 15 minute scalping and price-action trading.
See notes in the picture above for more details.
Note: "Top Deviation" is the deviation of the top 'ARL', "High Deviation" is for the high 'ARL', etc.
[Floride] 4 Layers of Bollinger Shadow
This is the indicator I named 4LBS. That means four layers of bollinger shadow.
This is an indicator that I made to see how far past prices could affect the future prices.
And I found some very interesting and beautiful things about it, and I wanted to share them with you, so I publish this indicator.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Hello, nice to meet you all. my name as a trader is Floride.
First of all, I am not good at English, so there may be many grammatically incorrect sentences below.
I ask for your understanding in advance. Thanks for your understanding.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
What is it?
bollinger Bands usually has one moving average line. And there's two bands that uses same period value of standard deviation as the former MA. And this indicator, by the way, has a 4 shadow bands
that uses twice,three,four,five time the value of the MA's period.
Appearance -
This indicator has four layers, and there are also other layers between them.
You can turn on or off all the shadow layers.
Uses of Indicator and Examples
examples of actual use
1. market strongness diagnosis
-It seems all layers of shadow has some degree resist/support forces.
This indicator has the 4th layer - "L4". (indicated by red lines).
I saw emergence of volatility quite frequently when this last layer breaks through.
When price breaks through this area or line, shade appear on the L4 layer in red. and red cross appear on the that point. This is I called Marlin signal.
If you saw red color shadow in this indicator, then the market may have quite high volatility.
(of course, there's not 100%. Please be careful about this.)
But I've also checked in quite several markets. when this volatility emerges, then also that market seems to started to building quite directional power afterwards.
I mean, after the marlin signal, market tends to have bigger volatility, and tends to go one direction.
again, it's not 100%. but probability is quite high.
But maybe depending on the type of market you need some adjustment.
Recommended values are M2-1.618, M3-2.618
Or M2-1, M3-2. default value is M2-1.618, M3-2.618
and also, if prices breakthrough the channels, or layers, It tends to break through the at once, in first bar. In other words, if price don't break through the first or second candle, it's very likely that the price won't break through channel for the time being.
2. market weakness diagnosis
Usually, without external momentum, the price converges to the average value and does not deviate from the band. And if price fails to break through the most inner first layer-"L1 - the green channel", In that case, the market is usually assumed to be weak, or has low volatility.
- you can set alarms on tuna, marlin signal. and you don't have to watch chart all the time.
3. Signals
I put two signals in this indicator.
One has the name "Tuna," and the second has the name "Marlin."
As you can already tell from the name's feeling, tuna is a weaker signal and marlin is a stronger signal.
Actual example of a signal
1. Tuna signal
- When the tuna signal appears, you can guess that the current market is generally not weak. or has quite good directional force. or medium volatility.
Below is important.
- If a tuna signal appears, there is a possibility that a marlin will appear later.
- In my opinion, it might be wise not to have a position without a tuna signal.
- Almost all of the marlin signal appeared shortly after the tuna signal appeared.
2. Marlin signal
- When marlin signal appears, with a high probability, volatility can increase large.
- In the backtesting of the stock, in some cases, the market moved quite frequently in the direction of the marlin signal.
- The emergence of marlin can be seen as a pretty strong indication of the emergences of direction.
Student's T-Distribution Bollinger BandsThis study shows the prediction interval as Bollinger Bands using Student's T-distribution. This means that the bands will be wider when the data features higher variation, as well as when the sample size (in the form of length) is smaller. The bands will also be wider when the confidence level is lower. The opposite is also true. Assuming we set a confidence level of 0.99 and a source set to the close price, we could reasonably expect that 99% of the time the close price would fall between the upper and lower bounds. Because this is a general statistical method which requires a lot of math, the script has a tendency to be relatively slow, but should be eligible to be used in a wide variety of situations.
Bollinger Bands Width and Bollinger Bands %BThis script shows both the Bollinger Band Width(BBW) and %B on the same indicator window.
Both the BBW and %B are introduced by John Bollinger(creator of Bollinger Bands) in 2010.
Default Parameter values: Length = 20, Source = Close, Mult = 2
Bollinger Bands Width (BBW): Color = (Default: Green )
- I consider stocks with "BBW >= 4" are at a volatile state and ready for price contraction, but this depends on the parameter values of your choice.
Bollinger Bands %B (%B): Color = (Default: Blue )
1. %B Above 10 = Price is Above the Upper Band
2. %B Equal to 10 = Price is at the Upper Band
3. %B Above 5 = Price is Above the Middle Line
4. %B Below 5 = Price is Below the Middle Line
5. %B Equal to 0 = Price is at the Lower Band
6. %B Below 0 = Price is Below the Lower Band
BBSS - Bollinger Bands Scalping SignalsModified Bollinger Bands Indicator
Added:
- color change divergence (green) and narrowing (red) of the upper and lower bands
- color change of the moving average - upward trend (green) and downward trend (red)
- the appearance of a potential signal for long and short positions when the candle closes behind the upper or lower bands.
How to use the indicator:
Long conditions:
- the price breaks through the upper band
- Bollinger bands are expanding and should be green
- the mid-line is green
- the trigger candle should be green
Short conditions:
- the price breaks through the lower band
- Bollinger bands are expanding and should be red
- the mid-line is red
- the trigger candle should be red
Rollin' pseudo-Bollinger Bands 5 linear regression curves and new highs/lows mixed together from the basis for this indicator. Using slightly different logic an upper boundary and lower boundary are formed. Then the boundary's are built upon to show price channels within the band using variations of fib levels and the distance between the initial boundary's. Dots plotted show the inverse of the close price relative to either the upper or lower boundary depending on where the close is relative to the center of the band. This shows the market's tendency for symmetry which is useful when looking for reversals etc. If it's too cluttered feel free to turn off some things in the options and keep what you feel is helpful.
Strategy: Combo Z ScoreStrategy version of Combo Z Score
Objective:
Can we use both VIX and MOVE relationships to indicate movement in the SPY? VIX (forward contract on SPY options) correlations are quite common as forward indicators however MOVE (forward contract on bonds) also provides a slightly different level of insight
Using the Z-Score of VIX vs VVIX and MOVE vs inverted VIX (there is no M of Move so we use inverted Vix as a proxy) we get some helpful indications of potential future moves. Added %B to give us some exposure to momentum. Toggle VIX or MOVE.
If anyone has a better idea of inverted Vix to proxy forward interest in MOVE let me know.
Noticeable delta is that Vix only approach over the back test period is slightly better. Questions would be, what is the structure and nature of the market over the test period and in a bear market would MOVE or combined perform better.