Rainbow Bands🌈 Rainbow Bands Indicator 🌈
The Rainbow Bands indicator is a dynamic tool designed to help traders identify potential trends with ease. It uses a series of 15 Exponential Moving Averages (EMAs) ranging from 9 to 51 periods to create a colorful representation of market momentum. When the EMAs align to form a rainbow 🌈, it signals a potential uptrend, while an upside-down rainbow 🌧️ suggests a possible downtrend. This intuitive visual layout helps traders quickly assess the market direction, reducing the need for multiple indicators.
📊 How It Works 📊
The Rainbow Bands indicator smooths out price fluctuations by blending shorter and longer-term EMAs. As the EMAs stack in order from short to long, they create a "rainbow" effect that is easy to spot on the chart. This method not only offers trend confirmation but also shows market strength and potential reversal points. Whether you're a scalper or swing trader, the Rainbow Bands add another layer of clarity to your trading decisions.
🚀 How To Use It 🚀
To step up your trading game, simply use the Rainbow Bands as a confirmation tool in your strategies. Look for the rainbow pattern to indicate a strong uptrend and the upside-down rainbow to highlight possible downtrends. By incorporating this indicator into your toolkit, you'll have a visual, reliable source of confirmation that can help improve your win rate.
Add it to your charts and see how it elevates your trading strategy today!
Bands
TrendWave Bands [BigBeluga]This is a trend-following indicator that dynamically adapts to market trends using upper and lower bands. It visually highlights trend strength and duration through color intensity while providing additional wave bands for deeper trend analysis.
🔵Key Features:
Adaptive Trend Bands:
➣ Displays a lower band in uptrends and an upper band in downtrends to indicate trend direction.
➣ The bands act as dynamic support and resistance levels, helping traders identify potential entry and exit points.
Wave Bands for Additional Analysis:
➣ A dashed wave band appears opposite the main trend band for deeper trend confirmation.
➣ In an uptrend, the upper dashed wave band helps analyze momentum, while in a downtrend, the lower dashed wave band serves the same purpose.
Gradient Color Intensity:
➣ The trend bands have a color gradient that fades as the trend continues, helping traders visualize trend duration.
➣ The wave bands have an inverse gradient effect—starting with low intensity at the trend's beginning and increasing in intensity as the trend progresses.
Trend Change Signals:
➣ Circular markers appear at trend reversals, providing clear entry and exit points.
➣ These signals mark transitions between bullish and bearish phases based on price action.
🔵Usage:
Trend Following: Use the lower band for confirmation in uptrends and the upper band in downtrends to stay on the right side of the market.
Trend Duration Analysis: Gradient wavebands give an idea of the duration of the current trend — new trends will have high-intensity colored wavebands and as time goes on, trends will fade.
Trend Reversal Detection: Circular markers highlight trend shifts, making it easier to spot entry and exit opportunities.
Volatility Awareness: Volatility-based bands help traders adjust their strategies based on market volatility, ensuring better risk management.
TrendWave Bands is a powerful tool for traders seeking to follow market trends with enhanced visual clarity. By combining trend bands, wave bands, and gradient-based color scaling, it provides a detailed view of market dynamics and trend evolution.
LinearRegressionLibrary "LinearRegression"
Calculates a variety of linear regression and deviation types, with optional emphasis weighting. Additionally, multiple of slope and Pearson’s R calculations.
calcSlope(_src, _len, _condition)
Calculates the slope of a linear regression over the specified length.
Parameters:
_src (float) : (float) The source data.
_len (int) : (int) The length of the lookback period for the linear regression.
_condition (bool) : (bool) Flag to enable calculation. Set to true to calculate on every bar; otherwise, set to barstate.islast for efficiency.
Returns: (float) The slope of the linear regression.
calcReg(_src, _len, _condition)
Calculates a basic linear regression, returning y1, y2, slope, and average.
Parameters:
_src (float) : (float) The source data series.
_len (int) : (int) The length of the lookback period.
_condition (bool) : (bool) Flag to enable calculation (true = calculate).
Returns: (float ) An array of 4 values: .
calcRegStandard(_src, _len, _emphasis, _condition)
Calculates an Standard linear regression with optional emphasis.
Parameters:
_src (float) : (series float) The source data series.
_len (int) : (int) The length of the lookback period.
_emphasis (float) : (float) The emphasis factor: 0 for equal weight; >0 emphasizes recent bars; <0 emphasizes older bars.
_condition (bool) : (bool) Flag to enable calculation (true = calculate).
Returns: (float ) .
calcRegRidge(_src, _len, lambda, _emphasis, _condition)
Calculates a ridge regression with optional emphasis.
Parameters:
_src (float) : (float) The source data series.
_len (int) : (int) The length of the lookback period.
lambda (float) : (float) The ridge regularization parameter.
_emphasis (float) : (float) The emphasis factor: 0 for equal weight; >0 emphasizes recent bars; <0 emphasizes older bars.
_condition (bool) : (bool) Flag to enable calculation (true = calculate).
Returns: (float ) .
calcRegLasso(_src, _len, lambda, _emphasis, _condition)
Calculates a Lasso regression with optional emphasis.
Parameters:
_src (float) : (float) The source data series.
_len (int) : (int) The length of the lookback period.
lambda (float) : (float) The Lasso regularization parameter.
_emphasis (float) : (float) The emphasis factor: 0 for equal weight; >0 emphasizes recent bars; <0 emphasizes older bars.
_condition (bool) : (bool) Flag to enable calculation (true = calculate).
Returns: (float ) .
calcElasticNetLinReg(_src, _len, lambda1, lambda2, _emphasis, _condition)
Calculates an Elastic Net regression with optional emphasis.
Parameters:
_src (float) : (float) The source data series.
_len (int) : (int) The length of the lookback period.
lambda1 (float) : (float) L1 regularization parameter (Lasso).
lambda2 (float) : (float) L2 regularization parameter (Ridge).
_emphasis (float) : (float) Emphasis factor: 0 for equal weight; >0 emphasizes recent bars; <0 emphasizes older bars.
_condition (bool) : (bool) Flag to enable calculation (true = calculate).
Returns: (float ) .
calcRegHuber(_src, _len, delta, iterations, _emphasis, _condition)
Calculates a Huber regression using Iteratively Reweighted Least Squares (IRLS).
Parameters:
_src (float) : (float) The source data series.
_len (int) : (int) The length of the lookback period.
delta (float) : (float) Huber threshold parameter.
iterations (int) : (int) Number of IRLS iterations.
_emphasis (float) : (float) Emphasis factor: 0 for equal weight; >0 emphasizes recent bars; <0 emphasizes older bars.
_condition (bool) : (bool) Flag to enable calculation (true = calculate).
Returns: (float ) .
calcRegLAD(_src, _len, iterations, _emphasis, _condition)
Calculates a Least Absolute Deviations (LAD) regression via IRLS.
Parameters:
_src (float) : (float) The source data series.
_len (int) : (int) The length of the lookback period.
iterations (int) : (int) Number of IRLS iterations for LAD.
_emphasis (float) : (float) Emphasis factor: 0 for equal weight; >0 emphasizes recent bars; <0 emphasizes older bars.
_condition (bool) : (bool) Flag to enable calculation (true = calculate).
Returns: (float ) .
calcRegBayesian(_src, _len, priorMean, priorSpan, sigma, _emphasis, _condition)
Calculates a Bayesian linear regression with optional emphasis.
Parameters:
_src (float) : (float) The source data series.
_len (int) : (int) The length of the lookback period.
priorMean (float) : (float) The prior mean for the slope.
priorSpan (float) : (float) The prior variance (or span) for the slope.
sigma (float) : (float) The assumed standard deviation of residuals.
_emphasis (float) : (float) Emphasis factor: 0 for equal weight; >0 emphasizes recent bars; <0 emphasizes older bars.
_condition (bool) : (bool) Flag to enable calculation (true = calculate).
Returns: (float ) .
calcRFromLinReg(_src, _len, _slope, _average, _y1, _condition)
Calculates the Pearson correlation coefficient (R) based on linear regression parameters.
Parameters:
_src (float) : (float) The source data.
_len (int) : (int) The length of the lookback period.
_slope (float) : (float) The slope of the linear regression.
_average (float) : (float) The average value of the source data series.
_y1 (float) : (float) The starting point (y-intercept of the oldest bar) for the linear regression.
_condition (bool) : (bool) Flag to enable calculation. Set to true to calculate on every bar; otherwise, set to barstate.islast for efficiency.
Returns: (float) The Pearson correlation coefficient (R) adjusted for the direction of the slope.
calcRFromSource(_src, _len, _condition)
Calculates the correlation coefficient (R) using a specified length and source data.
Parameters:
_src (float) : (float) The source data.
_len (int) : (int) The length of the lookback period.
_condition (bool) : (bool) Flag to enable calculation. Set to true to calculate on every bar; otherwise, set to barstate.islast for efficiency.
Returns: (float) The correlation coefficient (R).
calcSlopeLengthZero(_src, _len, _minLen, _step, _condition)
Identifies the length at which the slope is flattest (closest to zero).
Parameters:
_src (float) : (float) The source data.
_len (int) : (int) The maximum lookback length to consider (minimum of 2).
_minLen (int) : (int) The minimum length to start from (cannot exceed the max length).
_step (int) : (int) The increment step for lengths.
_condition (bool) : (bool) Flag to enable calculation. Set to true to calculate on every bar; otherwise, set to barstate.islast.
Returns: (int) The length at which the slope is flattest.
calcSlopeLengthHighest(_src, _len, _minLen, _step, _condition)
Identifies the length at which the slope is highest.
Parameters:
_src (float) : (float) The source data.
_len (int) : (int) The maximum lookback length (minimum of 2).
_minLen (int) : (int) The minimum length to start from.
_step (int) : (int) The step for incrementing lengths.
_condition (bool) : (bool) Flag to enable calculation. Set to true to calculate on every bar; otherwise, set to barstate.islast.
Returns: (int) The length at which the slope is highest.
calcSlopeLengthLowest(_src, _len, _minLen, _step, _condition)
Identifies the length at which the slope is lowest.
Parameters:
_src (float) : (float) The source data.
_len (int) : (int) The maximum lookback length (minimum of 2).
_minLen (int) : (int) The minimum length to start from.
_step (int) : (int) The step for incrementing lengths.
_condition (bool) : (bool) Flag to enable calculation. Set to true to calculate on every bar; otherwise, set to barstate.islast.
Returns: (int) The length at which the slope is lowest.
calcSlopeLengthAbsolute(_src, _len, _minLen, _step, _condition)
Identifies the length at which the absolute slope value is highest.
Parameters:
_src (float) : (float) The source data.
_len (int) : (int) The maximum lookback length (minimum of 2).
_minLen (int) : (int) The minimum length to start from.
_step (int) : (int) The step for incrementing lengths.
_condition (bool) : (bool) Flag to enable calculation. Set to true to calculate on every bar; otherwise, set to barstate.islast.
Returns: (int) The length at which the absolute slope value is highest.
calcRLengthZero(_src, _len, _minLen, _step, _condition)
Identifies the length with the lowest absolute R value.
Parameters:
_src (float) : (float) The source data.
_len (int) : (int) The maximum lookback length (minimum of 2).
_minLen (int) : (int) The minimum length to start from.
_step (int) : (int) The step for incrementing lengths.
_condition (bool) : (bool) Flag to enable calculation. Set to true to calculate on every bar; otherwise, set to barstate.islast.
Returns: (int) The length with the lowest absolute R value.
calcRLengthHighest(_src, _len, _minLen, _step, _condition)
Identifies the length with the highest R value.
Parameters:
_src (float) : (float) The source data.
_len (int) : (int) The maximum lookback length (minimum of 2).
_minLen (int) : (int) The minimum length to start from.
_step (int) : (int) The step for incrementing lengths.
_condition (bool) : (bool) Flag to enable calculation. Set to true to calculate on every bar; otherwise, set to barstate.islast.
Returns: (int) The length with the highest R value.
calcRLengthLowest(_src, _len, _minLen, _step, _condition)
Identifies the length with the lowest R value.
Parameters:
_src (float) : (float) The source data.
_len (int) : (int) The maximum lookback length (minimum of 2).
_minLen (int) : (int) The minimum length to start from.
_step (int) : (int) The step for incrementing lengths.
_condition (bool) : (bool) Flag to enable calculation. Set to true to calculate on every bar; otherwise, set to barstate.islast.
Returns: (int) The length with the lowest R value.
calcRLengthAbsolute(_src, _len, _minLen, _step, _condition)
Identifies the length with the highest absolute R value.
Parameters:
_src (float) : (float) The source data.
_len (int) : (int) The maximum lookback length (minimum of 2).
_minLen (int) : (int) The minimum length to start from.
_step (int) : (int) The step for incrementing lengths.
_condition (bool) : (bool) Flag to enable calculation. Set to true to calculate on every bar; otherwise, set to barstate.islast.
Returns: (int) The length with the highest absolute R value.
calcDevReverse(_src, _len, _slope, _y1, _inputDev, _emphasis, _condition)
Calculates the regressive linear deviation in reverse order, with optional emphasis on recent data.
Parameters:
_src (float) : (float) The source data.
_len (int) : (int) The length of the lookback period.
_slope (float) : (float) The slope of the linear regression.
_y1 (float) : (float) The y-intercept (oldest bar) of the linear regression.
_inputDev (float) : (float) The input deviation multiplier.
_emphasis (float) : (float) Emphasis factor: 0 for equal weight; >0 emphasizes recent bars; <0 emphasizes older bars.
_condition (bool) : (bool) Flag to enable calculation (true = calculate).
Returns: A 2-element tuple: .
calcDevForward(_src, _len, _slope, _y1, _inputDev, _emphasis, _condition)
Calculates the progressive linear deviation in forward order (oldest to most recent bar), with optional emphasis.
Parameters:
_src (float) : (float) The source data array, where _src is oldest and _src is most recent.
_len (int) : (int) The length of the lookback period.
_slope (float) : (float) The slope of the linear regression.
_y1 (float) : (float) The y-intercept of the linear regression (value at the most recent bar, adjusted by slope).
_inputDev (float) : (float) The input deviation multiplier.
_emphasis (float) : (float) Emphasis factor: 0 for equal weight; >0 emphasizes recent bars; <0 emphasizes older bars.
_condition (bool) : (bool) Flag to enable calculation (true = calculate).
Returns: A 2-element tuple: .
calcDevBalanced(_src, _len, _slope, _y1, _inputDev, _emphasis, _condition)
Calculates the balanced linear deviation with optional emphasis on recent or older data.
Parameters:
_src (float) : (float) Source data array, where _src is the most recent and _src is the oldest.
_len (int) : (int) The length of the lookback period.
_slope (float) : (float) The slope of the linear regression.
_y1 (float) : (float) The y-intercept of the linear regression (value at the oldest bar).
_inputDev (float) : (float) The input deviation multiplier.
_emphasis (float) : (float) Emphasis factor: 0 for equal weight; >0 emphasizes recent bars; <0 emphasizes older bars.
_condition (bool) : (bool) Flag to enable calculation (true = calculate).
Returns: A 2-element tuple: .
calcDevMean(_src, _len, _slope, _y1, _inputDev, _emphasis, _condition)
Calculates the mean absolute deviation from a forward-applied linear trend (oldest to most recent), with optional emphasis.
Parameters:
_src (float) : (float) The source data array, where _src is the most recent and _src is the oldest.
_len (int) : (int) The length of the lookback period.
_slope (float) : (float) The slope of the linear regression.
_y1 (float) : (float) The y-intercept (oldest bar) of the linear regression.
_inputDev (float) : (float) The input deviation multiplier.
_emphasis (float) : (float) Emphasis factor: 0 for equal weight; >0 emphasizes recent bars; <0 emphasizes older bars.
_condition (bool) : (bool) Flag to enable calculation (true = calculate).
Returns: A 2-element tuple: .
calcDevMedian(_src, _len, _slope, _y1, _inputDev, _emphasis, _condition)
Calculates the median absolute deviation with optional emphasis on recent data.
Parameters:
_src (float) : (float) The source data array (index 0 = oldest, index _len - 1 = most recent).
_len (int) : (int) The length of the lookback period.
_slope (float) : (float) The slope of the linear regression.
_y1 (float) : (float) The y-intercept (oldest bar) of the linear regression.
_inputDev (float) : (float) The deviation multiplier.
_emphasis (float) : (float) Emphasis factor: 0 for equal weight; >0 emphasizes recent bars; <0 emphasizes older bars.
_condition (bool) : (bool) Flag to enable calculation (true = calculate).
Returns:
calcDevPercent(_y1, _inputDev, _condition)
Calculates the percent deviation from a given value and a specified percentage.
Parameters:
_y1 (float) : (float) The base value from which to calculate deviation.
_inputDev (float) : (float) The deviation percentage.
_condition (bool) : (bool) Flag to enable calculation (true = calculate).
Returns: A 2-element tuple: .
calcDevFitted(_len, _slope, _y1, _emphasis, _condition)
Calculates the weighted fitted deviation based on high and low series data, showing max deviation, with optional emphasis.
Parameters:
_len (int) : (int) The length of the lookback period.
_slope (float) : (float) The slope of the linear regression.
_y1 (float) : (float) The Y-intercept (oldest bar) of the linear regression.
_emphasis (float) : (float) Emphasis factor: 0 for equal weight; >0 emphasizes recent bars; <0 emphasizes older bars.
_condition (bool) : (bool) Flag to enable calculation (true = calculate).
Returns: A 2-element tuple: .
calcDevATR(_src, _len, _slope, _y1, _inputDev, _emphasis, _condition)
Calculates an ATR-style deviation with optional emphasis on recent data.
Parameters:
_src (float) : (float) The source data (typically close).
_len (int) : (int) The length of the lookback period.
_slope (float) : (float) The slope of the linear regression.
_y1 (float) : (float) The Y-intercept (oldest bar) of the linear regression.
_inputDev (float) : (float) The input deviation multiplier.
_emphasis (float) : (float) Emphasis factor: 0 for equal weight; >0 emphasizes recent bars; <0 emphasizes older bars.
_condition (bool) : (bool) Flag to enable calculation (true = calculate).
Returns: A 2-element tuple: .
calcPricePositionPercent(_top, _bot, _src)
Calculates the percent position of a price within a linear regression channel. Top=100%, Bottom=0%.
Parameters:
_top (float) : (float) The top (positive) deviation, corresponding to 100%.
_bot (float) : (float) The bottom (negative) deviation, corresponding to 0%.
_src (float) : (float) The source price.
Returns: (float) The percent position within the channel.
plotLinReg(_len, _y1, _y2, _slope, _devTop, _devBot, _scaleTypeLog, _lineWidth, _extendLines, _channelStyle, _colorFill, _colUpLine, _colDnLine, _colUpFill, _colDnFill)
Plots the linear regression line and its deviations, with configurable styles and fill.
Parameters:
_len (int) : (int) The lookback period for the linear regression.
_y1 (float) : (float) The starting y-value of the regression line.
_y2 (float) : (float) The ending y-value of the regression line.
_slope (float) : (float) The slope of the regression line (used to determine line color).
_devTop (float) : (float) The top deviation to add to the line.
_devBot (float) : (float) The bottom deviation to subtract from the line.
_scaleTypeLog (bool) : (bool) Use a log scale if true; otherwise, linear scale.
_lineWidth (int) : (int) The width of the plotted lines.
_extendLines (string) : (string) How lines should extend (none, left, right, both).
_channelStyle (string) : (string) The style of the channel lines (solid, dashed, dotted).
_colorFill (bool) : (bool) Whether to fill the space between the top and bottom deviation lines.
_colUpLine (color) : (color) Line color when slope is positive.
_colDnLine (color) : (color) Line color when slope is negative.
_colUpFill (color) : (color) Fill color when slope is positive.
_colDnFill (color) : (color) Fill color when slope is negative.
Dynamic Heat Levels [BigBeluga]This indicator visualizes dynamic support and resistance levels with an adaptive heatmap effect. It helps traders identify key price interaction zones and potential mean reversion opportunities by displaying multiple levels that react to price movement.
🔵Key Features:
Multi-Level Heatmap Channel:
- The indicator plots multiple dynamic levels forming a structured channel.
- Each level represents a historical price interaction zone, helping traders identify critical areas.
- The channel expands or contracts based on market conditions, adapting dynamically to price movements.
Heatmap-Based Strength Indication:
- Levels change in transparency and color intensity based on price interactions for the length period .
- The more frequently price interacts with a level, the more visible and intense the color becomes.
- When a level reaches a threshold (count > 10), it starts to turn red, signaling a high-heat zone with significant price activity.
🔵Usage:
Support & Resistance Analysis: Identify price levels where the market frequently interacts, making them strong areas for trade decisions.
Heatmap Strength Assessment: More intense red levels indicate areas with heavy price activity, useful for detecting key liquidity zones.
Dynamic Heat Levels is a powerful tool for traders looking to analyze price interaction zones with a heatmap effect. It offers a structured visualization of market dynamics, allowing traders to gauge the significance of key levels and detect mean reversion setups effectively.
Lowess Channel + (RSI) [ChartPrime]The Lowess Channel + (RSI) indicator applies the LOWESS (Locally Weighted Scatterplot Smoothing) algorithm to filter price fluctuations and construct a dynamic channel. LOWESS is a non-parametric regression method that smooths noisy data by fitting weighted linear regressions at localized segments. This technique is widely used in statistical analysis to reveal trends while preserving data structure.
In this indicator, the LOWESS algorithm is used to create a central trend line and deviation-based bands. The midline changes color based on trend direction, and diamonds are plotted when a trend shift occurs. Additionally, an RSI gauge is positioned at the end of the channel to display the current RSI level in relation to the price bands.
lowess_smooth(src, length, bandwidth) =>
sum_weights = 0.0
sum_weighted_y = 0.0
sum_weighted_xy = 0.0
sum_weighted_x2 = 0.0
sum_weighted_x = 0.0
for i = 0 to length - 1
x = float(i)
weight = math.exp(-0.5 * (x / bandwidth) * (x / bandwidth))
y = nz(src , 0)
sum_weights := sum_weights + weight
sum_weighted_x := sum_weighted_x + weight * x
sum_weighted_y := sum_weighted_y + weight * y
sum_weighted_xy := sum_weighted_xy + weight * x * y
sum_weighted_x2 := sum_weighted_x2 + weight * x * x
mean_x = sum_weighted_x / sum_weights
mean_y = sum_weighted_y / sum_weights
beta = (sum_weighted_xy - mean_x * mean_y * sum_weights) / (sum_weighted_x2 - mean_x * mean_x * sum_weights)
alpha = mean_y - beta * mean_x
alpha + beta * float(length / 2) // Centered smoothing
⯁ KEY FEATURES
LOWESS Price Filtering – Smooths price fluctuations to reveal the underlying trend with minimal lag.
Dynamic Trend Coloring – The midline changes color based on trend direction (e.g., bullish or bearish).
Trend Shift Diamonds – Marks points where the midline color changes, indicating a possible trend shift.
Deviation-Based Bands – Expands above and below the midline using ATR-based multipliers for volatility tracking.
RSI Gauge Display – A vertical gauge at the right side of the chart shows the current RSI level relative to the price channel.
Fully Customizable – Users can adjust LOWESS length, band width, colors, and enable or disable the RSI gauge and adjust RSIlength.
⯁ HOW TO USE
Use the LOWESS midline as a trend filter —bullish when green, bearish when purple.
Watch for trend shift diamonds as potential entry or exit signals.
Utilize the price bands to gauge overbought and oversold zones based on volatility.
Monitor the RSI gauge to confirm trend strength—high RSI near upper bands suggests overbought conditions, while low RSI near lower bands indicates oversold conditions.
⯁ CONCLUSION
The Lowess Channel + (RSI) indicator offers a powerful way to analyze market trends by applying a statistically robust smoothing algorithm. Unlike traditional moving averages, LOWESS filtering provides a flexible, responsive trendline that adapts to price movements. The integrated RSI gauge enhances decision-making by displaying momentum conditions alongside trend dynamics. Whether used for trend-following or mean reversion strategies, this indicator provides traders with a well-rounded perspective on market behavior.
Adaptive Fibonacci Volatility Bands (AFVB)
**Adaptive Fibonacci Volatility Bands (AFVB)**
### **Overview**
The **Adaptive Fibonacci Volatility Bands (AFVB)** indicator enhances standard **Fibonacci retracement levels** by dynamically adjusting them based on market **volatility**. By incorporating **ATR (Average True Range) adjustments**, this indicator refines key **support and resistance zones**, helping traders identify **more reliable entry and exit points**.
**Key Features:**
- **ATR-based adaptive Fibonacci levels** that adjust to changing market volatility.
- **Buy and Sell signals** based on price interactions with dynamic support/resistance.
- **Toggleable confirmation filter** for refining trade signals.
- **Customizable color schemes** and alerts.
---
## **How This Indicator Works**
The **AFVB** operates in three main steps:
### **1️⃣ Detecting Key Fibonacci Levels**
The script calculates **swing highs and swing lows** using a user-defined lookback period. From this, it derives **Fibonacci retracement levels**:
- **0% (High)**
- **23.6%**
- **38.2%**
- **50% (Mid-Level)**
- **61.8%**
- **78.6%**
- **100% (Low)**
### **2️⃣ Adjusting for Market Volatility**
Instead of using **fixed retracement levels**, this indicator incorporates an **ATR-based adjustment**:
- **Resistance levels** shift **upward** based on ATR.
- **Support levels** shift **downward** based on ATR.
- This makes levels more **responsive** to price action.
### **3️⃣ Generating Buy & Sell Signals**
AFVB provides **two types of signals** based on price interactions with key levels:
✔ **Buy Signal**:
Occurs when price **dips below** a support level (78.6% or 100%) and **then closes back above it**.
- **Optionally**, a confirmation buffer can be enabled to require price to close **above an additional threshold** (based on ATR).
✔ **Sell Signal**:
Triggered when price **breaks above a resistance level** (0% or 23.6%) and **then closes below it**.
📌 **Important:**
- The **buy threshold setting** allows traders to **fine-tune** entry conditions.
- Turning this setting **off** generates **more frequent** buy signals.
- Keeping it **on** reduces false signals but may result in **fewer trade opportunities**.
---
## **How to Use This Indicator in Trading**
### 🔹 **Entry Strategy (Buying)**
1️⃣ Look for **buy signals** at the **78.6% or 100% Fibonacci levels**.
2️⃣ Ensure price **closes above** the support level before entering a long trade.
3️⃣ **Enable or disable** the buy threshold filter depending on desired trade strictness.
### 🔹 **Exit Strategy (Selling)**
1️⃣ Watch for **sell signals** at the **0% or 23.6% Fibonacci levels**.
2️⃣ If price **breaks above resistance and then closes below**, consider exiting long positions.
3️⃣ Can be used **alone** or **combined with trend confirmation tools** (e.g., moving averages, RSI).
### 🔹 **Using the Toggleable Buy Threshold**
- **ON**: Buy signal requires **extra confirmation** (reduces false signals but fewer trades).
- **OFF**: Buy triggers as soon as price **closes back above support** (more signals, but may include weaker setups).
---
## **User Inputs**
### **🔧 Customization Options**
- **ATR Length**: Defines the period for **ATR calculation**.
- **Swing Lookback**: Determines how far back to find **swing highs and lows**.
- **ATR Multiplier**: Adjusts the size of **volatility-based modifications**.
- **Buy/Sell Threshold Factor**: Fine-tunes the **entry signal strictness**.
- **Show Level Labels**: Enables/disables **Fibonacci level annotations**.
- **Color Settings**: Customize **support/resistance colors**.
### **📢 Alerts**
AFVB includes built-in **alert conditions** for:
- **Buy Signals** ("AFVB BUY SIGNAL - Possible reversal at support")
- **Sell Signals** ("AFVB SELL SIGNAL - Possible reversal at resistance")
- **Any Signal Triggered** (Useful for automated alerts)
---
## **Who Is This Indicator For?**
✅ **Scalpers & Day Traders** – Helps identify **short-term reversals**.
✅ **Swing Traders** – Useful for **buying dips** and **selling rallies**.
✅ **Trend Traders** – Can be combined with **momentum indicators** for confirmation.
**Best Timeframes:**
⏳ **15-minute, 1-hour, 4-hour, Daily charts** (works across multiple assets).
---
## **Limitations & Considerations**
🚨 **Important Notes**:
- **No indicator guarantees profits**. Always **combine** it with **risk management strategies**.
- Works best **in trending & mean-reverting markets**—may generate false signals in **choppy conditions**.
- Performance may vary across **different assets & timeframes**.
📢 **Backtesting is recommended** before using it for live trading.
Anchored Powered KAMA [LuxAlgo]The Anchored Powered KAMA tool is a new flavor of the famous Kaufman's Adaptive Moving Average (KAMA).
It adds 5 different anchoring periods, a power exponent to the original KAMA calculation to increase the degree of filtering during ranging trends, and standard deviation bands calculated against the KAMA itself.
🔶 USAGE
In the image above we can see the different parts of the tool, it displays the Anchored Powered KAMA surrounded by standard deviation bands at 2x (solid) and 1x (dashed) by default.
This tool provides a simple and easy way to determine if the current market is ranging or trending and where the market extremes are in the current period.
As a rule of thumb, traders may want to trade extremes in ranges and pullbacks in trends.
When the KAMA is flat, a range is in place, so traders may want to wait for the price to reach an extreme before opening a trade in the other direction.
Conversely, if the KAMA is moving up or down, a trend is in place and traders may want to wait for the price to pull back to the KAMA before opening a trade in the direction of the trend.
🔹 Anchor Period
On the above chart, we can see different anchor periods on different chart timeframes.
This option is very useful for those traders who use multi-timeframe analysis, allowing them to see how the market behaves over different timeframes.
The valid values for this parameter are:
Hourly
Daily
Weekly
Monthly
Yearly
The tool has a built-in Auto feature for traders convenience, it automatically selects the optimal Anchor Period in function of the chart timeframe.
timeframes up to 2m: Hourly
timeframes up to 15m: Daily
timeframes up to 1H: Weekly
timeframes up to 4H: Monthly
larger timeframes: Yearly
🔹 Choosing the Right Anchor Period
In the chart above we can see the custom error message that the tool displays when the Auto feature is disabled and the Anchor Period is too large for the current chart timeframe.
Traders can select a smaller Anchor Period or a larger chart timeframe for the tool to display correctly.
🔶 DETAILS
The tool uses Welford's algorithm to calculate the KAMA's standard deviation, then plots the outer bands at the multiplier specified in the settings panel, and the inner bands at the multiplier specified minus 1.
🔹 Power Exponent
The graph above shows how different values of this parameter can affect the output.
To display the original KAMA a value of 1 must be set, by default this parameter is set to 2.
The higher the value, the better the tool's ability to detect ranges.
🔶 SETTINGS
Anchor Period: Select up to 5 different time periods from Hourly, Daily, Weekly, Monthly, and Yearly.
Source: Choose the source for all calculations.
Power Exponent: Fine-tune the KAMA calculation, a value of 1 will output the original KAMA, and is set to 2 by default.
Band Multiplier: Select the multiplier for the standard deviation bands.
Bitcoin Log Growth Curve OscillatorThis script presents the oscillator version of the Bitcoin Logarithmic Growth Curve 2024 indicator, offering a new perspective on Bitcoin’s long-term price trajectory.
By transforming the original logarithmic growth curve into an oscillator, this version provides a normalized view of price movements within a fixed range, making it easier to identify overbought and oversold conditions.
For a comprehensive explanation of the mathematical derivation, underlying concepts, and overall development of the Bitcoin Logarithmic Growth Curve, we encourage you to explore our primary script, Bitcoin Logarithmic Growth Curve 2024, available here . This foundational script details the regression-based approach used to model Bitcoin’s long-term price evolution.
Normalization Process
The core principle behind this oscillator lies in the normalization of Bitcoin’s price relative to the upper and lower regression boundaries. By applying Min-Max Normalization, we effectively scale the price into a bounded range, facilitating clearer trend analysis. The normalization follows the formula:
normalized price = (upper regresionline − lower regressionline) / (price − lower regressionline)
This transformation ensures that price movements are always mapped within a fixed range, preventing distortions caused by Bitcoin’s exponential long-term growth. Furthermore, this normalization technique has been applied to each of the confidence interval lines, allowing for a structured and systematic approach to analyzing Bitcoin’s historical and projected price behavior.
By representing the logarithmic growth curve in oscillator form, this indicator helps traders and analysts more effectively gauge Bitcoin’s position within its long-term growth trajectory while identifying potential opportunities based on historical price tendencies.
[COG]StochRSI Zenith📊 StochRSI Zenith
This indicator combines the traditional Stochastic RSI with enhanced visualization features and multi-timeframe analysis capabilities. It's designed to provide traders with a comprehensive view of market conditions through various technical components.
🔑 Key Features:
• Advanced StochRSI Implementation
- Customizable RSI and Stochastic calculation periods
- Multiple moving average type options (SMA, EMA, SMMA, LWMA)
- Adjustable signal line parameters
• Visual Enhancement System
- Dynamic wave effect visualization
- Energy field display for momentum visualization
- Customizable color schemes for bullish and bearish signals
- Adaptive transparency settings
• Multi-Timeframe Analysis
- Higher timeframe confirmation
- Synchronized market structure analysis
- Cross-timeframe signal validation
• Divergence Detection
- Automated bullish and bearish divergence identification
- Customizable lookback period
- Clear visual signals for confirmed divergences
• Signal Generation Framework
- Price action confirmation
- SMA-based trend filtering
- Multiple confirmation levels for reduced noise
- Clear entry signals with customizable display options
📈 Technical Components:
1. Core Oscillator
- Base calculation: 13-period RSI (adjustable)
- Stochastic calculation: 8-period (adjustable)
- Signal lines: 5,3 smoothing (adjustable)
2. Visual Systems
- Wave effect with three layers of visualization
- Energy field display with dynamic intensity
- Reference bands at 20/30/50/70/80 levels
3. Confirmation Mechanisms
- SMA trend filter
- Higher timeframe alignment
- Price action validation
- Divergence confirmation
⚙️ Customization Options:
• Visual Parameters
- Wave effect intensity and speed
- Energy field sensitivity
- Color schemes for bullish/bearish signals
- Signal display preferences
• Technical Parameters
- All core calculation periods
- Moving average types
- Divergence detection settings
- Signal confirmation criteria
• Display Settings
- Chart and indicator signal placement
- SMA line visualization
- Background highlighting options
- Label positioning and size
🔍 Technical Implementation:
The indicator combines several advanced techniques to generate signals. Here are key components with code examples:
1. Core StochRSI Calculation:
// Base RSI calculation
rsi = ta.rsi(close, rsi_length)
// StochRSI transformation
stochRSI = ((ta.highest(rsi, stoch_length) - ta.lowest(rsi, stoch_length)) != 0) ?
(100 * (rsi - ta.lowest(rsi, stoch_length))) /
(ta.highest(rsi, stoch_length) - ta.lowest(rsi, stoch_length)) : 0
2. Signal Generation System:
// Core signal conditions
crossover_buy = crossOver(sk, sd, cross_threshold)
valid_buy_zone = sk < 30 and sd < 30
price_within_sma_bands = close <= sma_high and close >= sma_low
// Enhanced signal generation
if crossover_buy and valid_buy_zone and price_within_sma_bands and htf_allows_long
if is_bullish_candle
long_signal := true
else
awaiting_bull_confirmation := true
3. Multi-Timeframe Analysis:
= request.security(syminfo.tickerid, mtf_period,
)
The HTF filter looks at a higher timeframe (default: 4H) to confirm the trend
It only allows:
Long trades when the higher timeframe is bullish
Short trades when the higher timeframe is bearish
📈 Trading Application Guide:
1. Signal Identification
• Oversold Opportunities (< 30 level)
- Look for bullish crosses of K-line above D-line
- Confirm with higher timeframe alignment
- Wait for price action confirmation (bullish candle)
• Overbought Conditions (> 70 level)
- Watch for bearish crosses of K-line below D-line
- Verify higher timeframe condition
- Confirm with bearish price action
2. Divergence Trading
• Bullish Divergence
- Price makes lower lows while indicator makes higher lows
- Most effective when occurring in oversold territory
- Use with support levels for entry timing
• Bearish Divergence
- Price makes higher highs while indicator shows lower highs
- Most reliable in overbought conditions
- Combine with resistance levels
3. Wave Effect Analysis
• Strong Waves
- Multiple wave lines moving in same direction indicate momentum
- Wider wave spread suggests increased volatility
- Use for trend strength confirmation
• Energy Field
- Higher intensity in trading zones suggests stronger moves
- Use for momentum confirmation
- Watch for energy field convergence with price action
The energy field is like a heat map that shows momentum strength
It gets stronger (more visible) when:
Price is in oversold (<30) or overbought (>70) zones
The indicator lines are moving apart quickly
A strong signal is forming
Think of it as a "strength meter" - the more visible the energy field, the stronger the potential move
4. Risk Management Integration
• Entry Confirmation
- Wait for all signal components to align
- Use higher timeframe for trend direction
- Confirm with price action and SMA positions
• Stop Loss Placement
- Consider placing stops beyond recent swing points
- Use ATR for dynamic stop calculation
- Account for market volatility
5. Position Management
• Partial Profit Taking
- Consider scaling out at overbought/oversold levels
- Use wave effect intensity for exit timing
- Monitor energy field for momentum shifts
• Trade Duration
- Short-term: Use primary signals in trading zones
- Swing trades: Focus on divergence signals
- Position trades: Utilize higher timeframe signals
⚠️ Important Usage Notes:
• Avoid:
- Trading against strong trends
- Relying solely on single signals
- Ignoring higher timeframe context
- Over-leveraging based on signals
Remember: This tool is designed to assist in analysis but should never be used as the sole decision-maker for trades. Always maintain proper risk management and combine with other forms of analysis.
MTF Signal XpertMTF Signal Xpert – Detailed Description
Overview:
MTF Signal Xpert is a proprietary, open‑source trading signal indicator that fuses multiple technical analysis methods into one cohesive strategy. Developed after rigorous backtesting and extensive research, this advanced tool is designed to deliver clear BUY and SELL signals by analyzing trend, momentum, and volatility across various timeframes. Its integrated approach not only enhances signal reliability but also incorporates dynamic risk management, helping traders protect their capital while navigating complex market conditions.
Detailed Explanation of How It Works:
Trend Detection via Moving Averages
Dual Moving Averages:
MTF Signal Xpert computes two moving averages—a fast MA and a slow MA—with the flexibility to choose from Simple (SMA), Exponential (EMA), or Hull (HMA) methods. This dual-MA system helps identify the prevailing market trend by contrasting short-term momentum with longer-term trends.
Crossover Logic:
A BUY signal is initiated when the fast MA crosses above the slow MA, coupled with the condition that the current price is above the lower Bollinger Band. This suggests that the market may be emerging from a lower price region. Conversely, a SELL signal is generated when the fast MA crosses below the slow MA and the price is below the upper Bollinger Band, indicating potential bearish pressure.
Recent Crossover Confirmation:
To ensure that signals reflect current market dynamics, the script tracks the number of bars since the moving average crossover event. Only crossovers that occur within a user-defined “candle confirmation” period are considered, which helps filter out outdated signals and improves overall signal accuracy.
Volatility and Price Extremes with Bollinger Bands
Calculation of Bands:
Bollinger Bands are calculated using a 20‑period simple moving average as the central basis, with the upper and lower bands derived from a standard deviation multiplier. This creates dynamic boundaries that adjust according to recent market volatility.
Signal Reinforcement:
For BUY signals, the condition that the price is above the lower Bollinger Band suggests an undervalued market condition, while for SELL signals, the price falling below the upper Bollinger Band reinforces the bearish bias. This volatility context adds depth to the moving average crossover signals.
Momentum Confirmation Using Multiple Oscillators
RSI (Relative Strength Index):
The RSI is computed over 14 periods to determine if the market is in an overbought or oversold state. Only readings within an optimal range (defined by user inputs) validate the signal, ensuring that entries are made during balanced conditions.
MACD (Moving Average Convergence Divergence):
The MACD line is compared with its signal line to assess momentum. A bullish scenario is confirmed when the MACD line is above the signal line, while a bearish scenario is indicated when it is below, thus adding another layer of confirmation.
Awesome Oscillator (AO):
The AO measures the difference between short-term and long-term simple moving averages of the median price. Positive AO values support BUY signals, while negative values back SELL signals, offering additional momentum insight.
ADX (Average Directional Index):
The ADX quantifies trend strength. MTF Signal Xpert only considers signals when the ADX value exceeds a specified threshold, ensuring that trades are taken in strongly trending markets.
Optional Stochastic Oscillator:
An optional stochastic oscillator filter can be enabled to further refine signals. It checks for overbought conditions (supporting SELL signals) or oversold conditions (supporting BUY signals), thus reducing ambiguity.
Multi-Timeframe Verification
Higher Timeframe Filter:
To align short-term signals with broader market trends, the script calculates an EMA on a higher timeframe as specified by the user. This multi-timeframe approach helps ensure that signals on the primary chart are consistent with the overall trend, thereby reducing false signals.
Dynamic Risk Management with ATR
ATR-Based Calculations:
The Average True Range (ATR) is used to measure current market volatility. This value is multiplied by a user-defined factor to dynamically determine stop loss (SL) and take profit (TP) levels, adapting to changing market conditions.
Visual SL/TP Markers:
The calculated SL and TP levels are plotted on the chart as distinct colored dots, enabling traders to quickly identify recommended exit points.
Optional Trailing Stop:
An optional trailing stop feature is available, which adjusts the stop loss as the trade moves favorably, helping to lock in profits while protecting against sudden reversals.
Risk/Reward Ratio Calculation:
MTF Signal Xpert computes a risk/reward ratio based on the dynamic SL and TP levels. This quantitative measure allows traders to assess whether the potential reward justifies the risk associated with a trade.
Condition Weighting and Signal Scoring
Binary Condition Checks:
Each technical condition—ranging from moving average crossovers, Bollinger Band positioning, and RSI range to MACD, AO, ADX, and volume filters—is assigned a binary score (1 if met, 0 if not).
Cumulative Scoring:
These individual scores are summed to generate cumulative bullish and bearish scores, quantifying the overall strength of the signal and providing traders with an objective measure of its viability.
Detailed Signal Explanation:
A comprehensive explanation string is generated, outlining which conditions contributed to the current BUY or SELL signal. This explanation is displayed on an on‑chart dashboard, offering transparency and clarity into the signal generation process.
On-Chart Visualizations and Debug Information
Chart Elements:
The indicator plots all key components—moving averages, Bollinger Bands, SL and TP markers—directly on the chart, providing a clear visual framework for understanding market conditions.
Combined Dashboard:
A dedicated dashboard displays key metrics such as RSI, ADX, and the bullish/bearish scores, alongside a detailed explanation of the current signal. This consolidated view allows traders to quickly grasp the underlying logic.
Debug Table (Optional):
For advanced users, an optional debug table is available. This table breaks down each individual condition, indicating which criteria were met or not met, thus aiding in further analysis and strategy refinement.
Mashup Justification and Originality
MTF Signal Xpert is more than just an aggregation of existing indicators—it is an original synthesis designed to address real-world trading complexities. Here’s how its components work together:
Integrated Trend, Volatility, and Momentum Analysis:
By combining moving averages, Bollinger Bands, and multiple oscillators (RSI, MACD, AO, ADX, and an optional stochastic), the indicator captures diverse market dynamics. Each component reinforces the others, reducing noise and filtering out false signals.
Multi-Timeframe Analysis:
The inclusion of a higher timeframe filter aligns short-term signals with longer-term trends, enhancing overall reliability and reducing the potential for contradictory signals.
Adaptive Risk Management:
Dynamic stop loss and take profit levels, determined using ATR, ensure that the risk management strategy adapts to current market conditions. The optional trailing stop further refines this approach, protecting profits as the market evolves.
Quantitative Signal Scoring:
The condition weighting system provides an objective measure of signal strength, giving traders clear insight into how each technical component contributes to the final decision.
How to Use MTF Signal Xpert:
Input Customization:
Adjust the moving average type and period settings, ATR multipliers, and oscillator thresholds to align with your trading style and the specific market conditions.
Enable or disable the optional stochastic oscillator and trailing stop based on your preference.
Interpreting the Signals:
When a BUY or SELL signal appears, refer to the on‑chart dashboard, which displays key metrics (e.g., RSI, ADX, bullish/bearish scores) along with a detailed breakdown of the conditions that triggered the signal.
Review the SL and TP markers on the chart to understand the associated risk/reward setup.
Risk Management:
Use the dynamically calculated stop loss and take profit levels as guidelines for setting your exit points.
Evaluate the provided risk/reward ratio to ensure that the potential reward justifies the risk before entering a trade.
Debugging and Verification:
Advanced users can enable the debug table to see a condition-by-condition breakdown of the signal generation process, helping refine the strategy and deepen understanding of market dynamics.
Disclaimer:
MTF Signal Xpert is intended for educational and analytical purposes only. Although it is based on robust technical analysis methods and has undergone extensive backtesting, past performance is not indicative of future results. Traders should employ proper risk management and adjust the settings to suit their financial circumstances and risk tolerance.
MTF Signal Xpert represents a comprehensive, original approach to trading signal generation. By blending trend detection, volatility assessment, momentum analysis, multi-timeframe alignment, and adaptive risk management into one integrated system, it provides traders with actionable signals and the transparency needed to understand the logic behind them.
VWAP Bands with ML [CryptoSea]VWAP Machine Learning Bands is an advanced indicator designed to enhance trading analysis by integrating VWAP with a machine learning-inspired adaptive smoothing approach. This tool helps traders identify trend-based support and resistance zones, predict potential price movements, and generate dynamic trade signals.
Key Features
Adaptive ML VWAP Calculation: Uses a dynamically adjusted SMA-based VWAP model with volatility sensitivity for improved trend analysis.
Forecasting Mechanism: The 'Forecast' parameter shifts the ML output forward, providing predictive insights into potential price movements.
Volatility-Based Band Adjustments: The 'Sigma' parameter fine-tunes the impact of volatility on ML smoothing, adapting to market conditions.
Multi-Tier Standard Deviation Bands: Includes two levels of bands to define potential breakout or mean-reversion zones.
Dynamic Trend-Based Colouring: The VWAP and ML lines change colour based on their relative positions, visually indicating bullish and bearish conditions.
Custom Signal Detection Modes: Allows traders to choose between signals from Band 1, Band 2, or both, for more tailored trade setups.
In the image below, you can see an example of the bands on higher timeframe showing good mean reversion signal opportunities, these tend to work better in ranging markets rather than strong trending ones.
How It Works
VWAP & ML Integration: The script computes VWAP and applies a machine learning-inspired adjustment using SMA smoothing and volatility-based adaptation.
Forecasting Impact: The 'Forecast' setting shifts the ML output forward in time, allowing for anticipatory trend analysis.
Volatility Scaling (Sigma): Adjusts the ML smoothing sensitivity based on market volatility, providing more responsive or stable trend lines.
Trend Confirmation via Colouring: The VWAP line dynamically switches colour depending on whether it is above or below the ML output.
Multi-Level Band Analysis: Two standard deviation-based bands provide a framework for identifying breakouts, trend reversals, or continuation patterns.
In the example below, we can see some of the most reliable signals where we have mean reversion signals from the band whilst the price is also pulling back into the VWAP, these signals have the additional confluence which can give you a higher probabilty move.
Alerts
Bullish Signal Band 1: Alerts when the price crosses above the lower ML Band 1.
Bearish Signal Band 1: Alerts when the price crosses below the upper ML Band 1.
Bullish Signal Band 2: Alerts when the price crosses above the lower ML Band 2.
Bearish Signal Band 2: Alerts when the price crosses below the upper ML Band 2.
Filtered Bullish Signal: Alerts when a bullish signal is triggered based on the selected signal detection mode.
Filtered Bearish Signal: Alerts when a bearish signal is triggered based on the selected signal detection mode.
Application
Trend & Momentum Analysis: Helps traders identify key market trends and potential momentum shifts.
Dynamic Support & Resistance: Standard deviation bands serve as adaptive price zones for potential breakouts or reversals.
Enhanced Trade Signal Confirmation: The integration of ML smoothing with VWAP provides clearer entry and exit signals.
Customizable Risk Management: Allows users to adjust parameters for fine-tuned signal detection, aligning with their trading strategy.
The VWAP Machine Learning Bands indicator offers traders an innovative tool to improve market entries, recognize potential reversals, and enhance trend analysis with intelligent data-driven signals.
Machine Learning Moving Average [LuxAlgo]The Machine Learning Moving Average (MLMA) is a responsive moving average making use of the weighting function obtained Gaussian Process Regression method. Characteristic such as responsiveness and smoothness can be adjusted by the user from the settings.
The moving average also includes bands, used to highlight possible reversals.
🔶 USAGE
The Machine Learning Moving Average smooths out noisy variations from the price, directly estimating the underlying trend in the price.
A higher "Window" setting will return a longer-term moving average while increasing the "Forecast" setting will affect the responsiveness and smoothness of the moving average, with higher positive values returning a more responsive moving average and negative values returning a smoother but less responsive moving average.
Do note that an excessively high "Forecast" setting will result in overshoots, with the moving average having a poor fit with the price.
The moving average color is determined according to the estimated trend direction based on the bands described below, shifting to blue (default) in an uptrend and fushia (default) in downtrends.
The upper and lower extremities represent the range within which price movements likely fluctuate.
Signals are generated when the price crosses above or below the band extremities, with turning points being highlighted by colored circles on the chart.
🔶 SETTINGS
Window: Calculation period of the moving average. Higher values yield a smoother average, emphasizing long-term trends and filtering out short-term fluctuations.
Forecast: Sets the projection horizon for Gaussian Process Regression. Higher values create a more responsive moving average but will result in more overshoots, potentially worsening the fit with the price. Negative values will result in a smoother moving average.
Sigma: Controls the standard deviation of the Gaussian kernel, influencing weight distribution. Higher Sigma values return a longer-term moving average.
Multiplicative Factor: Adjusts the upper and lower extremity bounds, with higher values widening the bands and lowering the amount of returned turning points.
🔶 RELATED SCRIPTS
Machine-Learning-Gaussian-Process-Regression
SuperTrend-AI-Clustering
Trendilo ARTrendilo AR is a custom trading indicator designed to identify market trends using advanced techniques such as the Arnaud Legoux Moving Average (ALMA), volume confirmations, and dynamic volatility bands. This indicator provides a clear visualization of trends, including significant changes and custom alerts.
Review of Indicators Used
1. ALMA
Description:
ALMA is a moving average that applies an advanced filter to smooth price data, reducing noise and focusing on actual trends.
Usage in the Indicator:
Used to calculate the smoothed percentage price change and determine trend direction. Customizable parameters include:
- Length: Defines the number of bars to consider.
- Offset: Adjusts sensitivity toward recent prices.
- Sigma: Controls the degree of smoothing.
Advantages:
- Reduced lag in trend detection.
- Resistance to market noise.
2. ATR
Description:
ATR measures the market’s average volatility by considering the range between high and low prices over a given period.
Usage in the Indicator:
ATR is used to calculate "dynamic smoothing", adjusting the indicator’s sensitivity based on current market volatility.
Advantages:
- Adapts to high or low volatility conditions.
- Helps define dynamic support and resistance levels.
3. SMA
Description:
SMA calculates the average of prices or volume over a specific time period.
Usage in the Indicator:
Used to calculate the volume moving average (Volume SMA) to confirm whether the current volume supports the detected trend.
Advantages:
- Easy to understand and calculate.
- Provides volume-based trend confirmation.
4. RMS Bands
Description:
RMS Bands calculate the standard deviation of percentage price changes, creating upper and lower levels that act as overbought and oversold indicators.
Usage in the Indicator:
- Define the range within which the market is considered neutral.
- Crosses above or below the bands indicate trend changes.
Advantages:
- Visual identification of strong trends.
- Helps filter false signals.
Colors and Visuals Used in the Indicator
1. ALMA Line
Colors:
- Green: Indicates a confirmed uptrend (with sufficient volume).
- Red: Indicates a confirmed downtrend (with sufficient volume).
- Gray: Indicates a neutral phase or insufficient volume to confirm a trend.
2. RMS Bands
- Upper and Lower Lines:
- Purple (with transparency): These lines represent the RMS bands (upper and lower) and
adjust opacity based on trend strength.
- Stronger trends result in less transparency (more solid colors).
3. Highlighted Background (Strong Trends)
- Color:
- Light Green (transparent): Highlights a strong trend when the smoothed percentage change (ALMA) exceeds 1.5 times the RMS.
4. Horizontal Lines
- Baseline (0):
- Dark Gray: Serves as a central reference to identify the directionality of percentage changes.
- Additional Line (0.1):
- Blue: A customizable line to mark user-defined key levels.
5. Bar Colors
- Bar Colors:
- Green: When the price is in a confirmed uptrend.
- Red: When the price is in a confirmed downtrend.
- No color: When there is insufficient volume or no clear trend.
How to Use the Indicator
1. Initial Setup
1. Add the Indicator to Your Chart: Copy the code into the Pine Editor on TradingView and apply it to your chart.
2. Customize Parameters: Adjust values based on your trading strategy:
- Smoothing: Controls the level of smoothing for percentage changes.
- Lookback Length: Defines the observation period for calculations.
- Band Multiplier: Adjusts the width of RMS bands.
2. Signal Interpretation
1. Indicator Colors:
- Green: Confirmed uptrend.
- Red: Confirmed downtrend.
- Gray: No clear trend or insufficient volume.
2. RMS Bands:
- If the ALMA line (smoothed percentage change) crosses above the upper RMS band, it signals a potential uptrend.
- If it crosses below the lower RMS band, it signals a potential downtrend.
3. Volume Confirmation:
- The indicator's color activates only if the current volume exceeds the Volume SMA.
3. Alerts and Decisions
1. Trend Change Alerts:
- The indicator automatically triggers alerts when an uptrend or downtrend is detected.
- Configure these alerts to receive real-time notifications.
2. Strong Trend Signals:
- When the magnitude of the percentage change exceeds 1.5 times the RMS, the chart background highlights the strong trend.
4. Trading Strategies
1. Buy:
- Enter long positions when:
- The indicator turns green.
- Volume confirms the trend.
- Consider placing a stop-loss just below the lower RMS band.
2. Sell:
- Enter short positions when:
- The indicator turns red.
- Volume confirms the trend.
- Consider placing a stop-loss just above the upper RMS band.
3. Neutral:
- Avoid trading when the indicator is gray, as no clear trend or insufficient volume is present.
Disclaimer: As this is my first published indicator, please use it with caution. Feedback is highly appreciated to improve its performance.
Happy Trading!
Accurate Bollinger Bands mcbw_ [True Volatility Distribution]The Bollinger Bands have become a very important technical tool for discretionary and algorithmic traders alike over the last decades. It was designed to give traders an edge on the markets by setting probabilistic values to different levels of volatility. However, some of the assumptions that go into its calculations make it unusable for traders who want to get a correct understanding of the volatility that the bands are trying to be used for. Let's go through what the Bollinger Bands are said to show, how their calculations work, the problems in the calculations, and how the current indicator I am presenting today fixes these.
--> If you just want to know how the settings work then skip straight to the end or click on the little (i) symbol next to the values in the indicator settings window when its on your chart <--
--------------------------- What Are Bollinger Bands ---------------------------
The Bollinger Bands were formed in the 1980's, a time when many retail traders interacted with their symbols via physically printed charts and computer memory for personal computer memory was measured in Kb (about a factor of 1 million smaller than today). Bollinger Bands are designed to help a trader or algorithm see the likelihood of price expanding outside of its typical range, the further the lines are from the current price implies the less often they will get hit. With a hands on understanding many strategies use these levels for designated levels of breakout trades or to assist in defining price ranges.
--------------------------- How Bollinger Bands Work ---------------------------
The calculations that go into Bollinger Bands are rather simple. There is a moving average that centers the indicator and an equidistant top band and bottom band are drawn at a fixed width away. The moving average is just a typical moving average (or common variant) that tracks the price action, while the distance to the top and bottom bands is a direct function of recent price volatility. The way that the distance to the bands is calculated is inspired by formulas from statistics. The standard deviation is taken from the candles that go into the moving average and then this is multiplied by a user defined value to set the bands position, I will call this value 'the multiple'. When discussing Bollinger Bands, that trading community at large normally discusses 'the multiple' as a multiplier of the standard deviation as it applies to a normal distribution (gaußian probability). On a normal distribution the number of standard deviations away (which trades directly use as 'the multiple') you are directly corresponds to how likely/unlikely something is to happen:
1 standard deviation equals 68.3%, meaning that the price should stay inside the 1 standard deviation 68.3% of the time and be outside of it 31.7% of the time;
2 standard deviation equals 95.5%, meaning that the price should stay inside the 2 standard deviation 95.5% of the time and be outside of it 4.5% of the time;
3 standard deviation equals 99.7%, meaning that the price should stay inside the 3 standard deviation 99.7% of the time and be outside of it 0.3% of the time.
Therefore when traders set 'the multiple' to 2, they interpret this as meaning that price will not reach there 95.5% of the time.
---------------- The Problem With The Math of Bollinger Bands ----------------
In and of themselves the Bollinger Bands are a great tool, but they have become misconstrued with some incorrect sense of statistical meaning, when they should really just be taken at face value without any further interpretation or implication.
In order to explain this it is going to get a bit technical so I will give a little math background and try to simplify things. First let's review some statistics topics (distributions, percentiles, standard deviations) and then with that understanding explore the incorrect logic of how Bollinger Bands have been interpreted/employed.
---------------- Quick Stats Review ----------------
.
(If you are comfortable with statistics feel free to skip ahead to the next section)
.
-------- I: Probability distributions --------
When you have a lot of data it is helpful to see how many times different results appear in your dataset. To visualize this people use "histograms", which just shows how many times each element appears in the dataset by stacking each of the same elements on top of each other to form a graph. You may be familiar with the bell curve (also called the "normal distribution", which we will be calling it by). The normal distribution histogram looks like a big hump around zero and then drops off super quickly the further you get from it. This shape (the bell curve) is very nice because it has a lot of very nifty mathematical properties and seems to show up in nature all the time. Since it pops up in so many places, society has developed many different shortcuts related to it that speed up all kinds of calculations, including the shortcut that 1 standard deviation = 68.3%, 2 standard deviations = 95.5%, and 3 standard deviations = 99.7% (these only apply to the normal distribution). Despite how handy the normal distribution is and all the shortcuts we have for it are, and how much it shows up in the natural world, there is nothing that forces your specific dataset to look like it. In fact, your data can actually have any possible shape. As we will explore later, economic and financial datasets *rarely* follow the normal distribution.
-------- II: Percentiles --------
After you have made the histogram of your dataset you have built the "probability distribution" of your own dataset that is specific to all the data you have collected. There is a whole complicated framework for how to accurately calculate percentiles but we will dramatically simplify it for our use. The 'percentile' in our case is just the number of data points we are away from the "middle" of the data set (normally just 0). Lets say I took the difference of the daily close of a symbol for the last two weeks, green candles would be positive and red would be negative. In this example my dataset of day by day closing price difference is:
week 1:
week 2:
sorting all of these value into a single dataset I have:
I can separate the positive and negative returns and explore their distributions separately:
negative return distribution =
positive return distribution =
Taking the 25th% percentile of these would just be taking the value that is 25% towards the end of the end of these returns. Or akin the 100%th percentile would just be taking the vale that is 100% at the end of those:
negative return distribution (50%) = -5
positive return distribution (50%) = +4
negative return distribution (100%) = -10
positive return distribution (100%) = +20
Or instead of separating the positive and negative returns we can also look at all of the differences in the daily close as just pure price movement and not account for the direction, in this case we would pool all of the data together by ignoring the negative signs of the negative reruns
combined return distribution =
In this case the 50%th and 100%th percentile of the combined return distribution would be:
combined return distribution (50%) = 4
combined return distribution (100%) = 10
Sometimes taking the positive and negative distributions separately is better than pooling them into a combined distribution for some purposes. Other times the combined distribution is better.
Most financial data has very different distributions for negative returns and positive returns. This is encapsulated in sayings like "Price takes the stairs up and the elevator down".
-------- III: Standard Deviation --------
The formula for the standard deviation (refereed to here by its shorthand 'STDEV') can be intimidating, but going through each of its elements will illuminate what it does. The formula for STDEV is equal to:
square root ( (sum ) / N )
Going back the the dataset that you might have, the variables in the formula above are:
'mean' is the average of your entire dataset
'x' is just representative of a single point in your dataset (one point at a time)
'N' is the total number of things in your dataset.
Going back to the STDEV formula above we can see how each part of it works. Starting with the '(x - mean)' part. What this does is it takes every single point of the dataset and measure how far away it is from the mean of the entire dataset. Taking this value to the power of two: '(x - mean) ^ 2', means that points that are very far away from the dataset mean get 'penalized' twice as much. Points that are very close to the dataset mean are not impacted as much. In practice, this would mean that if your dataset had a bunch of values that were in a wide range but always stayed in that range, this value ('(x - mean) ^ 2') would end up being small. On the other hand, if your dataset was full of the exact same number, but had a couple outliers very far away, this would have a much larger value since the square par of '(x - mean) ^ 2' make them grow massive. Now including the sum part of 'sum ', this just adds up all the of the squared distanced from the dataset mean. Then this is divided by the number of values in the dataset ('N'), and then the square root of that value is taken.
There is nothing inherently special or definitive about the STDEV formula, it is just a tool with extremely widespread use and adoption. As we saw here, all the STDEV formula is really doing is measuring the intensity of the outliers.
--------------------------- Flaws of Bollinger Bands ---------------------------
The largest problem with Bollinger Bands is the assumption that price has a normal distribution. This is assumption is massively incorrect for many reasons that I will try to encapsulate into two points:
Price return do not follow a normal distribution, every single symbol on every single timeframe has is own unique distribution that is specific to only itself. Therefore all the tools, shortcuts, and ideas that we use for normal distributions do not apply to price returns, and since they do not apply here they should not be used. A more general approach is needed that allows each specific symbol on every specific timeframe to be treated uniquely.
The distributions of price returns on the positive and negative side are almost never the same. A more general approach is needed that allows positive and negative returns to be calculated separately.
In addition to the issues of the normal distribution assumption, the standard deviation formula (as shown above in the quick stats review) is essentially just a tame measurement of outliers (a more aggressive form of outlier measurement might be taking the differences to the power of 3 rather than 2). Despite this being a bit of a philosophical question, does the measurement of outlier intensity as defined by the STDEV formula really measure what we want to know as traders when we're experiencing volatility? Or would adjustments to that formula better reflect what we *experience* as volatility when we are actively trading? This is an open ended question that I will leave here, but I wanted to pose this question because it is a key part of what how the Bollinger Bands work that we all assume as a given.
Circling back on the normal distribution assumption, the standard deviation formula used in the calculation of the bands only encompasses the deviation of the candles that go into the moving average and have no knowledge of the historical price action. Therefore the level of the bands may not really reflect how the price action behaves over a longer period of time.
------------ Delivering Factually Accurate Data That Traders Need------------
In light of the problems identified above, this indicator fixes all of these issue and delivers statistically correct information that discretionary and algorithmic traders can use, with truly accurate probabilities. It takes the price action of the last 2,000 candles and builds a huge dataset of distributions that you can directly select your percentiles from. It also allows you to have the positive and negative distributions calculated separately, or if you would like, you can pool all of them together in a combined distribution. In addition to this, there is a wide selection of moving averages directly available in the indicator to choose from.
Hedge funds, quant shops, algo prop firms, and advanced mechanical groups all employ the true return distributions in their work. Now you have access to the same type of data with this indicator, wherein it's doing all the lifting for you.
------------------------------ Indicator Settings ------------------------------
.
---- Moving average ----
Select the type of moving average you would like and its length
---- Bands ----
The percentiles that you enter here will be pulled directly from the return distribution of the last 2,000 candles. With the typical Bollinger Bands, traders would select 2 standard deviations and incorrectly think that the levels it highlights are the 95.5% levels. Now, if you want the true 95.5% level, you can just enter 95.5 into the percentile value here. Each of the three available bands takes the true percentile you enter here.
---- Separate Positive & Negative Distributions----
If this box is checked the positive and negative distributions are treated indecently, completely separate from each other. You will see that the width of the top and bottom bands will be different for each of the percentiles you enter.
If this box is unchecked then all the negative and positive distributions are pooled together. You will notice that the width of the top and bottom bands will be the exact same.
---- Distribution Size ----
This is the number of candles that the price return is calculated over. EG: to collect the price return over the last 33 candles, the difference of price from now to 33 candles ago is calculated for the last 2,000 candles, to build a return distribution of 2000 points of price differences over 33 candles.
NEGATIVE NUMBERS(<0) == exact number of candles to include;
EG: setting this value to -20 will always collect volatility distributions of 20 candles
POSITIVE NUMBERS(>0) == number of candles to include as a multiple of the Moving Average Length value set above;
EG: if the Moving Average Length value is set to 22, setting this value to 2 will use the last 22*2 = 44 candles for the collection of volatility distributions
MORE candles being include will generally make the bands WIDER and their size will change SLOWER over time.
I wish you focus, dedication, and earnest success on your journey.
Happy trading :)
Prime Bands [ChartPrime]The Prime Standard Deviation Bands indicator uses custom-calculated bands based on highest and lowest price values over specific period to analyze price volatility and trend direction. Traders can set the bands to 1, 2, or 3 standard deviations from a central base, providing a dynamic view of price behavior in relation to volatility. The indicator also includes color-coded trend signals, standard deviation labels, and mean reversion signals, offering insights into trend strength and potential reversal points.
⯁ KEY FEATURES AND HOW TO USE
⯌ Standard Deviation Bands :
The indicator plots upper and lower bands based on standard deviation settings (1, 2, or 3 SDs) from a central base, allowing traders to visualize volatility and price extremes. These bands can be used to identify overbought and oversold conditions, as well as potential trend reversals.
Example of 3-standard-deviation bands around price:
⯌ Dynamic Trend Indicator :
The midline of the bands changes color based on trend direction. If the midline is rising, it turns green, indicating an uptrend. When the midline is falling, it turns orange, suggesting a downtrend. This color coding provides a quick visual reference to the current trend.
Trend color examples for rising and falling midlines:
⯌ Standard Deviation Labels :
At the end of the bands, the indicator displays labels with price levels for each standard deviation level (+3, 0, -3, etc.), helping traders quickly reference where price is relative to its statistical boundaries.
Price labels at each standard deviation level on the chart:
⯌ Mean Reversion Signals :
When price moves beyond the upper or lower bands and then reverts back inside, the indicator plots mean reversion signals with diamond icons. These signals indicate potential reversal points where the price may return to the mean after extreme moves.
Example of mean reversion signals near bands:
⯌ Standard Deviation Scale on Chart :
A visual scale on the right side of the chart shows the current price position in relation to the bands, expressed in standard deviations. This scale provides an at-a-glance view of how far price has deviated from the mean, helping traders assess risk and volatility.
⯁ USER INPUTS
Length : Sets the number of bars used in the calculation of the bands.
Standard Deviation Level : Allows selection of 1, 2, or 3 standard deviations for upper and lower bands.
Colors : Customize colors for the uptrend and downtrend midline indicators.
⯁ CONCLUSION
The Prime Standard Deviation Bands indicator provides a comprehensive view of price volatility and trend direction. Its customizable bands, trend coloring, and mean reversion signals allow traders to effectively gauge price behavior, identify extreme conditions, and make informed trading decisions based on statistical boundaries.
True Amplitude Envelopes (TAE)The True Envelopes indicator is an adaptation of the True Amplitude Envelope (TAE) method, based on the research paper " Improved Estimation of the Amplitude Envelope of Time Domain Signals Using True Envelope Cepstral Smoothing " by Caetano and Rodet. This indicator aims to create an asymmetric price envelope with strong predictive power, closely following the methodology outlined in the paper.
Due to the inherent limitations of Pine Script, the indicator utilizes a Kernel Density Estimator (KDE) in place of the original Cepstral Smoothing technique described in the paper. While this approach was chosen out of necessity rather than superiority, the resulting method is designed to be as effective as possible within the constraints of the Pine environment.
This indicator is ideal for traders seeking an advanced tool to analyze price dynamics, offering insights into potential price movements while working within the practical constraints of Pine Script. Whether used in dynamic mode or with a static setting, the True Envelopes indicator helps in identifying key support and resistance levels, making it a valuable asset in any trading strategy.
Key Features:
Dynamic Mode: The indicator dynamically estimates the fundamental frequency of the price, optimizing the envelope generation process in real-time to capture critical price movements.
High-Pass Filtering: Uses a high-pass filtered signal to identify and smoothly interpolate price peaks, ensuring that the envelope accurately reflects significant price changes.
Kernel Density Estimation: Although implemented as a workaround, the KDE technique allows for flexible and adaptive smoothing of the envelope, aimed at achieving results comparable to the more sophisticated methods described in the original research.
Symmetric and Asymmetric Envelopes: Provides options to select between symmetric and asymmetric envelopes, accommodating various trading strategies and market conditions.
Smoothness Control: Features adjustable smoothness settings, enabling users to balance between responsiveness and the overall smoothness of the envelopes.
The True Envelopes indicator comes with a variety of input settings that allow traders to customize the behavior of the envelopes to match their specific trading needs and market conditions. Understanding each of these settings is crucial for optimizing the indicator's performance.
Main Settings
Source: This is the data series on which the indicator is applied, typically the closing price (close). You can select other price data like open, high, low, or a custom series to base the envelope calculations.
History: This setting determines how much historical data the indicator should consider when calculating the envelopes. A value of 0 will make the indicator process all available data, while a higher value restricts it to the most recent n bars. This can be useful for reducing the computational load or focusing the analysis on recent market behavior.
Iterations: This parameter controls the number of iterations used in the envelope generation algorithm. More iterations will typically result in a smoother envelope, but can also increase computation time. The optimal number of iterations depends on the desired balance between smoothness and responsiveness.
Kernel Style: The smoothing kernel used in the Kernel Density Estimator (KDE). Available options include Sinc, Gaussian, Epanechnikov, Logistic, and Triangular. Each kernel has different properties, affecting how the smoothing is applied. For example, Gaussian provides a smooth, bell-shaped curve, while Epanechnikov is more efficient computationally with a parabolic shape.
Envelope Style: This setting determines whether the envelope should be Static or Dynamic. The Static mode applies a fixed period for the envelope, while the Dynamic mode automatically adjusts the period based on the fundamental frequency of the price data. Dynamic mode is typically more responsive to changing market conditions.
High Q: This option controls the quality factor (Q) of the high-pass filter. Enabling this will increase the Q factor, leading to a sharper cutoff and more precise isolation of high-frequency components, which can help in better identifying significant price peaks.
Symmetric: This setting allows you to choose between symmetric and asymmetric envelopes. Symmetric envelopes maintain an equal distance from the central price line on both sides, while asymmetric envelopes can adjust differently above and below the price line, which might better capture market conditions where upside and downside volatility are not equal.
Smooth Envelopes: When enabled, this setting applies additional smoothing to the envelopes. While this can reduce noise and make the envelopes more visually appealing, it may also decrease their responsiveness to sudden market changes.
Dynamic Settings
Extra Detrend: This setting toggles an additional high-pass filter that can be applied when using a long filter period. The purpose is to further detrend the data, ensuring that the envelope focuses solely on the most recent price oscillations.
Filter Period Multiplier: This multiplier adjusts the period of the high-pass filter dynamically based on the detected fundamental frequency. Increasing this multiplier will lengthen the period, making the filter less sensitive to short-term price fluctuations.
Filter Period (Min) and Filter Period (Max): These settings define the minimum and maximum bounds for the high-pass filter period. They ensure that the filter period stays within a reasonable range, preventing it from becoming too short (and overly sensitive) or too long (and too sluggish).
Envelope Period Multiplier: Similar to the filter period multiplier, this adjusts the period for the envelope generation. It scales the period dynamically to match the detected price cycles, allowing for more precise envelope adjustments.
Envelope Period (Min) and Envelope Period (Max): These settings establish the minimum and maximum bounds for the envelope period, ensuring the envelopes remain adaptive without becoming too reactive or too slow.
Static Settings
Filter Period: In static mode, this setting determines the fixed period for the high-pass filter. A shorter period will make the filter more responsive to price changes, while a longer period will smooth out more of the price data.
Envelope Period: This setting specifies the fixed period used for generating the envelopes in static mode. It directly influences how tightly or loosely the envelopes follow the price action.
TAE Smoothing: This controls the degree of smoothing applied during the TAE process in static mode. Higher smoothing values result in more gradual envelope curves, which can be useful in reducing noise but may also delay the envelope’s response to rapid price movements.
Visual Settings
Top Band Color: This setting allows you to choose the color for the upper band of the envelope. This band represents the resistance level in the price action.
Bottom Band Color: Similar to the top band color, this setting controls the color of the lower band, which represents the support level.
Center Line Color: This is the color of the central price line, often referred to as the carrier. It represents the detrended price around which the envelopes are constructed.
Line Width: This determines the thickness of the plotted lines for the top band, bottom band, and center line. Thicker lines can make the envelopes more visible, especially when overlaid on price data.
Fill Alpha: This controls the transparency level of the shaded area between the top and bottom bands. A lower alpha value will make the fill more transparent, while a higher value will make it more opaque, helping to highlight the envelope more clearly.
The envelopes generated by the True Envelopes indicator are designed to provide a more precise and responsive representation of price action compared to traditional methods like Bollinger Bands or Keltner Channels. The core idea behind this indicator is to create a price envelope that smoothly interpolates the significant peaks in price action, offering a more accurate depiction of support and resistance levels.
One of the critical aspects of this approach is the use of a high-pass filtered signal to identify these peaks. The high-pass filter serves as an effective method of detrending the price data, isolating the rapid fluctuations in price that are often lost in standard trend-following indicators. By filtering out the lower frequency components (i.e., the trend), the high-pass filter reveals the underlying oscillations in the price, which correspond to significant peaks and troughs. These oscillations are crucial for accurately constructing the envelope, as they represent the most responsive elements of the price movement.
The algorithm works by first applying the high-pass filter to the source price data, effectively detrending the series and isolating the high-frequency price changes. This filtered signal is then used to estimate the fundamental frequency of the price movement, which is essential for dynamically adjusting the envelope to current market conditions. By focusing on the peaks identified in the high-pass filtered signal, the algorithm generates an envelope that is both smooth and adaptive, closely following the most significant price changes without overfitting to transient noise.
Compared to traditional envelopes and bands, such as Bollinger Bands and Keltner Channels, the True Envelopes indicator offers several advantages. Bollinger Bands, which are based on standard deviations, and Keltner Channels, which use the average true range (ATR), both tend to react to price volatility but do not necessarily follow the peaks and troughs of the price with precision. As a result, these traditional methods can sometimes lag behind or fail to capture sudden shifts in price momentum, leading to either false signals or missed opportunities.
In contrast, the True Envelopes indicator, by using a high-pass filtered signal and a dynamic period estimation, adapts more quickly to changes in price behavior. The envelopes generated by this method are less prone to the lag that often affects standard deviation or ATR-based bands, and they provide a more accurate representation of the price's immediate oscillations. This can result in better predictive power and more reliable identification of support and resistance levels, making the True Envelopes indicator a valuable tool for traders looking for a more responsive and precise approach to market analysis.
In conclusion, the True Envelopes indicator is a powerful tool that blends advanced theoretical concepts with practical implementation, offering traders a precise and responsive way to analyze price dynamics. By adapting the True Amplitude Envelope (TAE) method through the use of a Kernel Density Estimator (KDE) and high-pass filtering, this indicator effectively captures the most significant price movements, providing a more accurate depiction of support and resistance levels compared to traditional methods like Bollinger Bands and Keltner Channels. The flexible settings allow for extensive customization, ensuring the indicator can be tailored to suit various trading strategies and market conditions.
Kalman PredictorThe **Kalman Predictor** indicator is a powerful tool designed for traders looking to enhance their market analysis by smoothing price data and projecting future price movements. This script implements a Kalman filter, a statistical method for noise reduction, to dynamically estimate price trends and velocity. Combined with ATR-based confidence bands, it provides actionable insights into potential price movement, while offering clear trend and momentum visualization.
---
#### **Key Features**:
1. **Kalman Filter Smoothing**:
- Dynamically estimates the current price state and velocity to filter out market noise.
- Projects three future price levels (`Next Bar`, `Next +2`, `Next +3`) based on velocity.
2. **Dynamic Confidence Bands**:
- Confidence bands are calculated using ATR (Average True Range) to reflect market volatility.
- Visualizes potential price deviation from projected levels.
3. **Trend Visualization**:
- Color-coded prediction dots:
- **Green**: Indicates an upward trend (positive velocity).
- **Red**: Indicates a downward trend (negative velocity).
- Dynamically updated label displaying the current trend and velocity value.
4. **User Customization**:
- Inputs to adjust the process and measurement noise for the Kalman filter (`q` and `r`).
- Configurable ATR multiplier for confidence bands.
- Toggleable trend label with adjustable positioning.
---
#### **How It Works**:
1. **Kalman Filter Core**:
- The Kalman filter continuously updates the estimated price state and velocity based on real-time price changes.
- Projections are based on the current price trend (velocity) and extend into the future (Next Bar, +2, +3).
2. **Confidence Bands**:
- Calculated using ATR to provide a dynamic range around the projected future prices.
- Indicates potential volatility and helps traders assess risk-reward scenarios.
3. **Trend Label**:
- Updates dynamically on the last bar to show:
- Current trend direction (Up/Down).
- Velocity value, providing insight into the expected magnitude of the price movement.
---
#### **How to Use**:
- **Trend Analysis**:
- Observe the direction and spacing of the prediction dots relative to current candles.
- Larger spacing indicates a potential strong move, while clustering suggests consolidation.
- **Risk Management**:
- Use the confidence bands to gauge potential price volatility and set stop-loss or take-profit levels accordingly.
- **Pullback Detection**:
- Look for flattening or clustering of dots during trends as a signal of potential pullbacks or reversals.
---
#### **Customizable Inputs**:
- **Kalman Filter Parameters**:
- `lookback`: Adjusts the smoothing window.
- `q`: Process noise (higher values make the filter more reactive to changes).
- `r`: Measurement noise (controls sensitivity to price deviations).
- **Confidence Bands**:
- `band_multiplier`: Multiplies ATR to define the range of confidence bands.
- **Visualization**:
- `show_label`: Option to toggle the trend label.
- `label_offset`: Adjusts the label’s distance from the price for better visibility.
---
#### **Examples of Use**:
- **Scalping**: Use on lower timeframes (e.g., 1-minute, 5-minute) to detect short-term price trends and reversals.
- **Swing Trading**: Identify pullbacks or continuations on higher timeframes (e.g., 4-hour, daily) by observing the prediction dots and confidence bands.
- **Risk Assessment**: Confidence bands help visualize potential price volatility, aiding in the placement of stops and targets.
---
#### **Notes for Traders**:
- The **Kalman Predictor** does not predict the future with certainty but provides a statistically informed estimate of price movement.
- Confidence bands are based on historical volatility and should be used as guidelines, not guarantees.
- Always combine this tool with other analysis techniques for optimal results.
---
This script is open-source, and the Kalman filter logic has been implemented uniquely to integrate noise reduction with dynamic confidence band visualization. If you find this indicator useful, feel free to share your feedback and experiences!
---
#### **Credits**:
This script was developed leveraging the statistical principles of Kalman filtering and is entirely original. It incorporates ATR for dynamic confidence band calculations to enhance trader usability and market adaptability.
Fibonacci Bands [BigBeluga]The Fibonacci Band indicator is a powerful tool for identifying potential support, resistance, and mean reversion zones based on Fibonacci ratios. It overlays three sets of Fibonacci ratio bands (38.2%, 61.8%, and 100%) around a central trend line, dynamically adapting to price movements. This structure enables traders to track trends, visualize potential liquidity sweep areas, and spot reversal points for strategic entries and exits.
🔵 KEY FEATURES & USAGE
Fibonacci Bands for Support & Resistance:
The Fibonacci Band indicator applies three key Fibonacci ratios (38.2%, 61.8%, and 100%) to construct dynamic bands around a smoothed price. These levels often act as critical support and resistance areas, marked with labels displaying the percentage and corresponding price. The 100% band level is especially crucial, signaling potential liquidity sweep zones and reversal points.
Mean Reversion Signals at 100% Bands:
When price moves above or below the 100% band, the indicator generates mean reversion signals.
Trend Detection with Midline:
The central line acts as a trend-following tool: when solid, it indicates an uptrend, while a dashed line signals a downtrend. This adaptive midline helps traders assess the prevailing market direction while keeping the chart clean and intuitive.
Extended Price Projections:
All Fibonacci bands extend to future bars (default 30) to project potential price levels, providing a forward-looking perspective on where price may encounter support or resistance. This feature helps traders anticipate market structure in advance and set targets accordingly.
Liquidity Sweep:
--
-Liquidity Sweep at Previous Lows:
The price action moves below a previous low, capturing sell-side liquidity (stop-losses from long positions or entries for breakout traders).
The wick suggests that the price quickly reversed, leaving a failed breakout below support.
This is a classic liquidity grab, often indicating a bullish reversal .
-Liquidity Sweep at Previous Highs:
The price spikes above a prior high, sweeping buy-side liquidity (stop-losses from short positions or breakout entries).
The wick signifies rejection, suggesting a failed breakout above resistance.
This is a bearish liquidity sweep , often followed by a mean reversion or a downward move.
Display Customization:
To declutter the chart, traders can choose to hide Fibonacci levels and only display overbought/oversold zones along with the trend-following midline and mean reversion signals. This option enables a clearer focus on key reversal areas without additional distractions.
🔵 CUSTOMIZATION
Period Length: Adjust the length of the smoothed moving average for more reactive or smoother bands.
Channel Width: Customize the width of the Fibonacci channel.
Fibonacci Ratios: Customize the Fibonacci ratios to reflect personal preference or unique market behaviors.
Future Projection Extension: Set the number of bars to extend Fibonacci bands, allowing flexibility in projecting price levels.
Hide Fibonacci Levels: Toggle the visibility of Fibonacci levels for a cleaner chart focused on overbought/oversold regions and midline trend signals.
Liquidity Sweep: Toggle the visibility of Liquidity Sweep points
The Fibonacci Band indicator provides traders with an advanced framework for analyzing market structure, liquidity sweeps, and trend reversals. By integrating Fibonacci-based levels with trend detection and mean reversion signals, this tool offers a robust approach to navigating dynamic price action and finding high-probability trading opportunities.
Holt-Winters Forecast BandsDescription:
The Holt-Winters Adaptive Bands indicator combines seasonal trend forecasting with adaptive volatility bands. It uses the Holt-Winters triple exponential smoothing model to project future price trends, while Nadaraya-Watson smoothed bands highlight dynamic support and resistance zones.
This indicator is ideal for traders seeking to predict future price movements and visualize potential market turning points. By focusing on broader seasonal and trend data, it provides insight into both short- and long-term market directions. It’s particularly effective for swing trading and medium-to-long-term trend analysis on timeframes like daily and 4-hour charts, although it can be adjusted for other timeframes.
Key Features:
Holt-Winters Forecast Line: The core of this indicator is the Holt-Winters model, which uses three components — level, trend, and seasonality — to project future prices. This model is widely used for time-series forecasting, and in this script, it provides a dynamic forecast line that predicts where price might move based on historical patterns.
Adaptive Volatility Bands: The shaded areas around the forecast line are based on Nadaraya-Watson smoothing of historical price data. These bands provide a visual representation of potential support and resistance levels, adapting to recent volatility in the market. The bands' fill colors (red for upper and green for lower) allow traders to identify potential reversal zones without cluttering the chart.
Dynamic Confidence Levels: The indicator adapts its forecast based on market volatility, using inputs such as average true range (ATR) and price deviations. This means that in high-volatility conditions, the bands may widen to account for increased price movements, helping traders gauge the current market environment.
How to Use:
Forecasting: Use the forecast line to gain insight into potential future price direction. This line provides a directional bias, helping traders anticipate whether the price may continue along a trend or reverse.
Support and Resistance Zones: The shaded bands act as dynamic support and resistance zones. When price enters the upper (red) band, it may be in an overbought area, while the lower (green) band may indicate oversold conditions. These bands adjust with volatility, so they reflect the current market conditions rather than fixed levels.
Timeframe Recommendations:
This indicator performs best on daily and 4-hour charts due to its reliance on trend and seasonality. It can be used on lower timeframes, but accuracy may vary due to increased price noise.
For traders looking to capture swing trades, the daily and 4-hour timeframes provide a balance of trend stability and signal reliability.
Adjustable Settings:
Alpha, Beta, and Gamma: These settings control the level, trend, and seasonality components of the forecast. Alpha is generally the most sensitive setting for adjusting responsiveness to recent price movements, while Beta and Gamma help fine-tune the trend and seasonal adjustments.
Band Smoothing and Deviation: These settings control the lookback period and width of the volatility bands, allowing users to customize how closely the bands follow price action.
Parameters:
Prediction Length: Sets the length of the forecast, determining how far into the future the prediction line extends.
Season Length: Defines the seasonality cycle. A setting of 14 is typical for bi-weekly cycles, but this can be adjusted based on observed market cycles.
Alpha, Beta, Gamma: These parameters adjust the Holt-Winters model's sensitivity to recent prices, trends, and seasonal patterns.
Band Smoothing: Determines the smoothing applied to the bands, making them either more reactive or smoother.
Ideal Use Cases:
Swing Trading and Trend Following: The Holt-Winters model is particularly suited for capturing larger market trends. Use the forecast line to determine trend direction and the bands to gauge support/resistance levels for potential entries or exits.
Identifying Reversal Zones: The adaptive bands act as dynamic overbought and oversold zones, giving traders potential reversal areas when price reaches these levels.
Important Notes:
No Buy/Sell Signals: This indicator does not produce direct buy or sell signals. It’s intended for visual trend analysis and support/resistance identification, leaving trade decisions to the user.
Not for High-Frequency Trading: Due to the nature of the Holt-Winters model, this indicator is optimized for higher timeframes like the daily and 4-hour charts. It may not be suitable for high-frequency or scalping strategies on very short timeframes.
Adjust for Volatility: If using the indicator on lower timeframes or more volatile assets, consider adjusting the band smoothing and prediction length settings for better responsiveness.
Nami Bands with Future Projection [FXSMARTLAB]The Nami Bands ( Inspired by "Nami", meaning "wave" in Japanese) are two dynamic bands around price data: an upper band and a lower band. These bands are calculated based on an Asymmetric Linear Weighted Moving Average of price and a similarly asymmetric weighted standard deviation. This weighting method emphasizes recent data without overreacting to short-term price changes, thus smoothing the bands in line with prevailing market conditions.
Advantages and Benefits of Using the Indicator
* Volatility Analysis: The bands expand and contract with market volatility, helping traders assess periods of high and low volatility. Narrow bands indicate low volatility and potential consolidation, while wide bands suggest increased volatility and potential price movement.
* Dynamic Support and Resistance Levels: By adapting to recent trends, the bands serve as dynamic support (lower band) and resistance (upper band) levels, which traders can use for entry and exit signals.
* Overbought and Oversold Conditions: When prices reach or cross the bands’ outer limits, it may signal overbought (upper band) or oversold (lower band) conditions, suggesting possible reversals or trend slowdowns.
* Trend Confirmation and Continuation: The slope of the central moving average confirms trend direction. An upward slope generally indicates a bullish trend, while a downward slope suggests a bearish trend.
* Anticipating Breakouts and Reversals: The projected bands help identify where price movements may head, allowing traders to anticipate potential breakouts or reversals based on projected support and resistance.
Indicator Parameters
Source (src): The price data used for calculations, by default set to the average of high, low, and close (hlc3).
Length: The period over which calculations are made, defaulted to 50 periods.
Projection Length: The length for future band projection, defaulted to 20 periods.
StdDev Multiplier (mult): A multiplier for the standard deviation, defaulted to 2.0.
Internal Calculations
1. Asymmetric Linear Weighted Moving Average of Price
The indicator uses an Asymmetric Linear Weighted Moving Average (ALWMA) to calculate a central value for the price.
Asymmetric Weighting: This weighting technique assigns the highest weight to the most recent value, with weights decreasing linearly as the data points become older. This structure provides a nuanced focus on recent price trends, while still reflecting historical price levels.
2. Asymmetric Weighted Standard Deviation
The standard deviation in this indicator is also calculated using asymmetric weighting:
Purpose of Asymmetric Weighted Standard Deviation: Rather than aiming for high sensitivity to recent data, this standard deviation measure smooths out volatility by integrating weighted values across the length period, stabilizing the overall measurement of price variability.
This approach yields a balanced view of volatility, capturing broader market trends without being overly reactive to short-lived changes.
3. Upper and Lower Bands
The upper and lower bands are created by adding and subtracting the asymmetric weighted standard deviation from the asymmetric weighted average of price. This creates a dynamic envelope that adjusts to both recent price trends and the smoothed volatility measure:
These bands represent adaptable support and resistance levels that shift with recent market volatility.
Future Band Projection
The indicator provides a projection of the bands based on their current slope.
1. Calculating the Slope of the Bands
The slope for each band is derived from the difference between the current and previous values of each band.
2. Projecting the Bands into the Future
For each period into the future, up to the defined Projection Length, the bands are projected using the current slope.
This feature offers an anticipated view of where support and resistance levels may move, providing insight for future market behavior based on current trends.
Fibonacci BandsDescription
This indicator dynamically calculates Fibonacci retracement levels based on the highest high and lowest low over a specified lookback period. The key Fibonacci levels (0.236, 0.382, 0.5, 0.618, and 0.786) are plotted on the chart, with shaded areas between these levels for visual guidance.
How it works
The script computes the highest high (hh) and the lowest low (ll) over the defined length.
It calculates the price range (delta) as the difference between the highest high and the lowest low.
Fibonacci levels are then determined using the formula: ℎℎ − (delta × Fibonacci ratio)
Each Fibonacci level is then plotted as a line with a specific color.
Key Features
Customizable Length: Users can adjust the lookback period to suit their trading strategy.
Multiple Fibonacci Levels: Includes common Fibonacci retracement levels, providing traders with a comprehensive view of potential support and resistance areas.
Visual Fillings: The script includes customizable shading between levels, which helps traders quickly identify key zones (like the "Golden Zone" between 0.5 and 0.618).
Unique Points
Fibonacci Focus: This script is specifically designed around Fibonacci retracement levels, which are popular among technical traders for identifying potential reversal points.
Dynamic Range Calculation: The use of the highest high and lowest low within a user-defined period offers a dynamic approach to adapting to changing market conditions.
How to use it
Adjust the length parameter (default is 60) to determine how many bars back the indicator will calculate the highest high and lowest low. A longer length may provide a broader perspective of price action, while a shorter length may react more quickly to recent price changes.
Observe the plotted Fibonacci levels: 0.236, 0.382, 0.5, 0.618, and 0.786. These levels often act as potential support and resistance points. Pay attention to how price interacts with these levels.
When the price approaches a Fibonacci level, consider it a potential reversal point. The filled areas between the Fibonacci levels indicate zones where price might consolidate or reverse. The "Golden Zone" (between 0.5 and 0.618) is particularly significant; many traders watch this area closely for potential entry points in an uptrend or exit points in a downtrend.
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.
Linear Regression ChannelLinear Regression Channel Indicator
Overview:
The Linear Regression Channel Indicator is a versatile tool designed for TradingView to help traders visualize price trends and potential reversal points. By calculating and plotting linear regression channels, bands, and future projections, this indicator provides comprehensive insights into market dynamics. It can highlight overbought and oversold conditions, identify trend direction, and offer visual cues for future price movements.
Key Features:
Linear Regression Bands:
Input: Plot Linear Regression Bands
Description: Draws bands based on linear regression calculations, representing overbought and oversold levels.
Customizable Parameters:
Length: Defines the look-back period for the regression calculation.
Deviation: Determines the width of the bands based on standard deviations.
Linear Regression Channel:
Input: Plot Linear Regression Channel
Description: Plots a channel using linear regression to visualize the main trend.
Customizable Parameters:
Channel Length: Defines the look-back period for the channel calculation.
Deviation: Determines the channel's width.
Future Projection Channel:
Input: Plot Future Projection of Linear Regression
Description: Projects a linear regression channel into the future, aiding in forecasting potential price movements.
Customizable Parameters:
Length: Defines the look-back period for the projection calculation.
Deviation: Determines the width of the projected channel.
Arrow Direction Indicator:
Input: Plot Arrow Direction
Description: Displays directional arrows based on future projection, indicating expected price movement direction.
Color-Coded Price Bars:
Description: Colors the price bars based on their position within the regression bands or channel, providing a heatmap-like visualization.
Dynamic Visualization:
Colors: Uses a gradient color scheme to highlight different conditions, such as uptrend, downtrend, and mid-levels.
Labels and Markers: Plots visual markers for significant price levels and conditions, enhancing interpretability.
Usage Notes
Setting the Length:
Adjust the look-back period (Length) to suit the timeframe you are analyzing. Shorter lengths are responsive to recent price changes, while longer lengths provide a broader view of the trend.
Interpreting Bands and Channels:
The bands and channels help identify overbought and oversold conditions. Price moving above the upper band or channel suggests overbought conditions, while moving below the lower band or channel indicates oversold conditions.
Using the Future Projection:
Enable the future projection channel to anticipate potential price movements. This can be particularly useful for setting target prices or stop-loss levels based on expected trends.
Arrow Direction Indicator:
Use the arrow direction indicator to quickly grasp the expected price movement direction. An upward arrow indicates a potential uptrend, while a downward arrow suggests a potential downtrend.
Color-Coded Price Bars:
The color of the price bars changes based on their relative position within the regression bands or channel. This heatmap visualization helps quickly identify bullish, bearish, and neutral conditions.
Dynamic Adjustments:
The indicator dynamically adjusts its visual elements based on user settings and market conditions, ensuring that the most relevant information is always displayed.
Visual Alerts:
Pay attention to the labels and markers on the chart indicating significant events, such as crossovers and breakouts. These visual alerts help in making informed trading decisions.
The Linear Regression Channel Indicator is a powerful tool for traders looking to enhance their technical analysis. By offering multiple regression-based visualizations and customizable parameters, it helps identify key market conditions, trends, and potential reversal points. Whether you are a day trader or a long-term investor, this indicator can provide valuable insights to improve your trading strategy.