Forex Master v4.0 (EUR/USD Mean-Reversion Algorithm)DESCRIPTION
Forex Master v4.0 is a mean-reversion algorithm currently optimized for trading the EUR/USD pair on the 5M chart interval. All indicator inputs use the period's closing price and all trades are executed at the open of the period following the period where the trade signal was generated.
There are 3 main components that make up Forex Master v4.0:
I. Trend Filter
The algorithm uses a version of the ADX indicator as a trend filter to trade only in certain time periods where price is more likely to be range-bound (i.e., mean-reverting). This indicator is composed of a Fast ADX and a Slow ADX, both using the same look-back period of 50. However, the Fast ADX is smoothed with a 6-period EMA and the Slow ADX is smoothed with a 12-period EMA. When the Fast ADX is above the Slow ADX, the algorithm does not trade because this indicates that price is likelier to trend, which is bad for a mean-reversion system. Conversely, when the Fast ADX is below the Slow ADX, price is likelier to be ranging so this is the only time when the algorithm is allowed to trade.
II. Bollinger Bands
When allowed to trade by the Trend Filter, the algorithm uses the Bollinger Bands indicator to enter long and short positions. The Bolliger Bands indicator has a look-back period of 20 and a standard deviation of 1.5 for both upper and lower bands. When price crosses over the lower band, a Long Signal is generated and a long position is entered. When price crosses under the upper band, a Short Signal is generated and a short position is entered.
III. Money Management
Rule 1 - Each trade will use a limit order for a fixed quantity of 50,000 contracts (0.50 lot). The only exception is Rule
Rule 2 - Order pyramiding is enabled and up to 10 consecutive orders of the same signal can be executed (for example: 14 consecutive Long Signals are generated over 8 hours and the algorithm sends in 10 different buy orders at various prices for a total of 350,000 contracts).
Rule 3 - Every order will include a bracket with both TP and SL set at 50 pips (note: the algorithm only closes the current open position and does not enter the opposite trade once a TP or SL has been hit).
Rule 4 - When a new opposite trade signal is generated, the algorithm sends in a larger order to close the current open position as well as open a new one (for example: 14 consecutive Long Signals are generated over 8 hours and the algorithm sends in 10 different buy orders at various prices for a total of 350,000 contracts. A Short Signal is generated shortly after the 14th Long Signal. The algorithm then sends in a sell order for 400,000 contracts to close the 350,000 contracts long position and open a new short position of 50,000 contracts).
스크립트에서 "黄金近50年的走势"에 대해 찾기
RSI-EMA IndicatorThis indicator calculates and plots 2 separate EMAs of the RSI. The default settings below work great on SPX/SPY daily chart. General rule is if an EMA is above 50, the stock's near term outlook is bullish. If an EMA is below 50, the near term outlook is bearish. Personally, I like to use a fast EMA as a buy signal and a slow EMA as a sell signal.
Default settings:
RSI = 50
EMA1 = 100
EMA2 = 200
High-Low Index [LazyBear]-- Fixed ---
Source: pastebin.com
Fixes an issue with "Combined" mode, using wrong symbols.
--- Original ---
The High-Low Index is a breadth indicator based on Record High Percent, which is based on new 52-week highs and new 52-week lows.
Readings below 50 indicate that there were more new lows than new highs. Readings above 50 indicate that there were more new highs than new lows. 0 indicates there were zero new highs (0% new highs). 100 indicates there was at least 1 new high and no new lows (100% new highs). 50 indicates that new highs and new lows were equal (50% new highs).
Readings consistently above 70 usually coincide with a strong uptrend. Readings consistently below 30 usually coincide with a strong downtrend.
More info:
stockcharts.com
List of my public indicators: bit.ly
List of my app-store indicators: blog.tradingview.com
Just noticed @Greeny has already published this -> Linking it here.
TimWest Long Short FiltersTimWest Long Short Filters
Indicator Has 3 Separate Filters that Create Green(Bullish) or Red(Bearish) BackGround Highlights
If Price is Above or Below a certain LookBack Period - Tim Defaults to 63 on Daily Chart to Quickly View if Price is Above or Below it’s Price 1 Quarter Ago.
A Simple Moving Average Filter - Tim Defaults to 50 SMA and 200 SMA also known as the “Golden Cross”.
A Exponential Moving Average Filter - For Those Who Want To View Shorter Term Market Swings. Defaults to 50 EMA and 100 EMA used By Chuck Hughes, 7 Time World Trading Champion. Chuck Claims the 50/100 EMA's Show the Earliest Change in Market Direction the Equal - Sustainable Moves
Inputs Tab has Checkboxes to Turn On/Off any of the 3 Filters Above.
Reference Chart Post www.tradingview.com
3 projection Indicators - PBands, PO & PBAll these indicators are by Mel Widner.
Projection Bands :
-------------------------------------------------------
These project market data along the trend with the maxima and minima of the projections defining the band. The method provides a way to signal potential direction changes relative to the trend. Usage is like any other trading band.
Projection Oscillator :
-------------------------------------------------------
This indicates the relative position of price with in the bands. It fluctuates between the values 0 to 100. You can configure the "basis" to make it oscillate around a specific value (for ex., basis=50 will make it oscillate between +50 and -50). EMA of PO (length configurable, default is 5) is plotted as a signal line. There is also an option to plot the difference (oscillator - signal), just like MACD histogram. When you see a divergence in this oscillator, remember that it just indicates a potential movement with in the band (for ex., a bullish divergence shown may cause the price to cross the median and move up to the top band).
Projection Bandwidth :
-------------------------------------------------------
This shows the % width of the projection bands. A trend reversal is signaled by a high value. Low value may indicate the start of a new trend. This is also a trend strength indicator.
More info: drive.google.com
Borrowed the color theme for this chart from @liw0. Thanks :)
SuperScript Filtered (Stable)🔎 What This Indicator Does
The indicator is a trend and momentum filter.
It looks at multiple well-known technical tools (T3 moving averages, RSI, TSI, and EMA trend) and assigns a score to the current market condition.
• If most tools are bullish → score goes up.
• If most tools are bearish → score goes down.
• Only when the score is very strong (above +75 or below -75), it prints a Buy or Sell signal.
This helps traders focus only on high-probability setups instead of reacting to every small wiggle in price.
________________________________________
⚙️ How It Works
1. T3 Trend Check
o Compares a fast and slow T3 moving average.
o If the fast T3 is above the slow T3 → bullish signal.
o If it’s below → bearish signal.
2. RSI Check
o Uses the Relative Strength Index.
o If RSI is above 50 → bullish momentum.
o If RSI is below 50 → bearish momentum.
3. TSI Check
o Uses the True Strength Index.
o If TSI is above its signal line → bullish momentum.
o If TSI is below → bearish momentum.
4. EMA Trend Check
o Looks at two exponential moving averages (fast and slow).
o If price is above both → bullish.
o If price is below both → bearish.
5. Score System
o Each condition contributes +25 (bullish) or -25 (bearish).
o The total score can range from -100 to +100.
o Score ≥ +75 → Strong Buy
o Score ≤ -75 → Strong Sell
6. Signal Filtering
o Only one buy is allowed until a sell appears (and vice versa).
o A minimum bar gap is enforced between signals to avoid clutter.
________________________________________
📊 How It Appears on the Chart
• Green “BUY” label below candles → when multiple signals agree and the market is strongly bullish.
• Red “SELL” label above candles → when multiple signals agree and the market is strongly bearish.
• Background softly shaded green or red → highlights bullish or bearish conditions.
No messy tables, no clutter — just clear trend-based entries.
________________________________________
🎯 How Traders Can Use It
This indicator is designed to help traders by:
1. Filtering Noise
o Instead of reacting to every small crossover or RSI blip, it waits until at least 3–4 conditions agree.
o This avoids entering weak trades.
2. Identifying Strong Trend Shifts
o When a Buy or Sell arrow appears, it usually signals a shift in momentum that can lead to a larger move.
3. Reducing Overtrading
o By limiting signals, traders won’t be tempted to jump in and out unnecessarily.
4. Trade Confirmation
o Traders can use the signals as confirmation for their own setups.
o Example: If your strategy says “go long” and the indicator also shows a strong Buy, that trade has more conviction.
5. Alert Automation
o Built-in alerts mean you don’t have to watch the chart all day.
o You’ll be notified only when a strong signal appears.
________________________________________
⚡ When It Helps the Most
• Works best in trending markets (bullish or bearish).
• Very useful on higher timeframes (1h, 4h, daily) for swing trading.
• Can also work on lower timeframes (5m, 15m) if combined with higher timeframe trend filtering.
________________________________________
👉 In short
This indicator is a signal filter + trend detector. It combines four powerful tools into one scoring system, and only tells you to act when the odds are stacked in your favor.
________________________________________
EMAs Personalizáveis (até 5)📘 Indicator Explanation – Customizable EMAs (up to 5)
This indicator was developed in Pine Script v6 to make it easier to visualize multiple Exponential Moving Averages (EMAs) on a single chart.
🔑 Main features:
Supports up to 5 different EMAs.
Ability to enable or disable each EMA individually.
Fully customizable period for each EMA.
Flexible color selection for better visual organization.
Adjustable line thickness to highlight the most relevant levels.
📌 How to use:
Open the indicator settings.
Select which EMAs you want to display (from 1 to 5).
Define the period (e.g., 20, 50, 100, 200, etc.).
Choose a color for each EMA.
Observe price behavior relative to the EMAs to identify:
Trends → price above long EMAs indicates bullish strength.
Reversals → EMA crossovers may signal a change in direction.
Dynamic support and resistance → EMAs often act as reaction zones for price.
💡 Practical example:
Short EMA (20) → shows short-term movement.
Mid-term EMA (50 or 100) → confirms trend direction.
Long EMA (200 or 500) → indicates the overall market trend.
👉 This indicator is flexible and can be used for scalping, swing trading, or position trading, depending on the chosen periods.
Trend Fib Zone Bounce (TFZB) [KedArc Quant]Description:
Trend Fib Zone Bounce (TFZB) trades with the latest confirmed Supply/Demand zone using a single, configurable Fib pullback (0.3/0.5/0.6). Trade only in the direction of the most recent zone and use a single, configurable fib level for pullback entries.
• Detects market structure via confirmed swing highs/lows using a rolling window.
• Draws Supply/Demand zones (bearish/bullish rectangles) from the latest MSS (CHOCH or BOS) event.
• Computes intra zone Fib guide rails and keeps them extended in real time.
• Triggers BUY only inside bullish zones and SELL only inside bearish zones when price touches the selected fib and closes back beyond it (bounce confirmation).
• Optional labels print BULL/BEAR + fib next to the triangle markers.
What it does
Finds structure using confirmed swing highs/lows (you choose the confirmation length).
Builds the latest zone (bullish = demand, bearish = supply) after a CHOCH/BOS event.
Draws intra-zone “guide rails” (Fib lines) and extends them live.
Signals only with the trend of that zone:
BUY inside a bullish zone when price tags the selected Fib and closes back above it.
SELL inside a bearish zone when price tags the selected Fib and closes back below it.
Optional labels print BULL/BEAR + Fib next to triangles for quick context
Why this is different
Most “zone + fib + signal” tools bolt together several indicators, or fire counter-trend signals because they don’t fully respect structure. TFZB is intentionally minimal:
Single bias source: the latest confirmed zone defines direction; nothing else overrides it.
Single entry rule: one Fib bounce (0.3/0.5/0.6 selectable) inside that zone—no counter-trend trades by design.
Clean visuals: you can show only the most recent zone, clamp overlap, and keep just the rails that matter.
Deterministic & transparent: every plot/label comes from the code you see—no external series or hidden smoothing
How it helps traders
Cuts decision noise: you always know the bias and the only entry that matters right now.
Forces discipline: if price isn’t inside the active zone, you don’t trade.
Adapts to volatility: pick 0.3 in strong trends, 0.5 as the default, 0.6 in chop.
Non-repainting zones: swings are confirmed after Structure Length bars, then used to build zones that extend forward (they don’t “teleport” later)
How it works (details)
*Structure confirmation
A swing high/low is only confirmed after Structure Length bars have elapsed; the dot is plotted back on the original bar using offset. Expect a confirmation delay of about Structure Length × timeframe.
*Zone creation
After a CHOCH/BOS (momentum shift / break of prior swing), TFZB draws the new Supply/Demand zone from the swing anchors and sets it active.
*Fib guide rails
Inside the active zone TFZB projects up to five Fib lines (defaults: 0.3 / 0.5 / 0.7) and extends them as time passes.
*Entry logic (with-trend only)
BUY: bar’s low ≤ fib and close > fib inside a bullish zone.
SELL: bar’s high ≥ fib and close < fib inside a bearish zone.
*Optionally restrict to one signal per zone to avoid over-trading.
(Optional) Aggressive confirm-bar entry
When do the swing dots print?
* The code confirms a swing only after `structureLen` bars have elapsed since that candidate high/low.
* On a 5-min chart with `structureLen = 10`, that’s about 50 minutes later.
* When the swing confirms, the script plots the dot back on the original bar (via `offset = -structureLen`). So you *see* the dot on the old bar, but it only appears on the chart once the confirming bar arrives.
> Practical takeaway: expect swing markers to appear roughly `structureLen × timeframe` later. Zones and signals are built from those confirmed swings.
Best timeframe for this Indicator
Use the timeframe that matches your holding period and the noise level of the instrument:
* Intraday :
* 5m or 15m are the sweet spots.
* Suggested `structureLen`:
* 5m: 10–14 (confirmation delay \~50–70 min)
* 15m: 8–10 (confirmation delay \~2–2.5 hours)
* Keep Entry Fib at 0.5 to start; try 0.3 in strong trends, 0.6 in chop.
* Tip: avoid the first 10–15 minutes after the open; let the initial volatility set the early structure.
* Swing/overnight:
* 1h or 4h.
* `structureLen`:
* 1h: 6–10 (6–10 hours confirmation)
* 4h: 5–8 (20–32 hours confirmation)
* 1m scalping: not recommended here—the confirmation lag relative to the noise makes zones less reliable.
Inputs (all groups)
Structure
• Show Swing Points (structureTog)
o Plots small dots on the bar where a swing point is confirmed (offset back by Structure Length).
• Structure Length (structureLen)
o Lookback used to confirm swing highs/lows and determine local structure. Higher = fewer, stronger swings; lower = more reactive.
Zones
• Show Last (zoneDispNum)
o Maximum number of zones kept on the chart when Display All Zones is off.
• Display All Zones (dispAll)
o If on, ignores Show Last and keeps all zones/levels.
• Zone Display (zoneFilter): Bullish Only / Bearish Only / Both
o Filters which zone types are drawn and eligible for signals.
• Clean Up Level Overlap (noOverlap)
o Prevents fib lines from overlapping when a new zone starts near the previous one (clamps line start/end times for readability).
Fib Levels
Each row controls whether a fib is drawn and how it looks:
• Toggle (f1Tog…f5Tog): Show/hide a given fib line.
• Level (f1Lvl…f5Lvl): Numeric ratio in . Defaults active: 0.3, 0.5, 0.7 (0 and 1 off by default).
• Line Style (f1Style…f5Style): Solid / Dashed / Dotted.
• Bull/Bear Colors (f#BullColor, f#BearColor): Per-fib color in bullish vs bearish zones.
Style
• Structure Color: Dot color for confirmed swing points.
• Bullish Zone Color / Bearish Zone Color: Rectangle fills (transparent by default).
Signals
• Entry Fib for Signals (entryFibSel): Choose 0.3, 0.5 (default), or 0.6 as the trigger line.
• Show Buy/Sell Signals (showSignals): Toggles triangle markers on/off.
• One Signal Per Zone (oneSignalPerZone): If on, suppresses additional entries within the same zone after the first trigger.
• Show Signal Text Labels (Bull/Bear + Fib) (showSignalLabels): Adds a small label next to each triangle showing zone bias and the fib used (e.g., BULL 0.5 or BEAR 0.3).
How TFZB decides signals
With trend only:
• BUY
1. Latest active zone is bullish.
2. Current bar’s close is inside the zone (between top and bottom).
3. The bar’s low ≤ selected fib and it closes > selected fib (bounce).
• SELL
1. Latest active zone is bearish.
2. Current bar’s close is inside the zone.
3. The bar’s high ≥ selected fib and it closes < selected fib.
Markers & labels
• BUY: triangle up below the bar; optional label “BULL 0.x” above it.
• SELL: triangle down above the bar; optional label “BEAR 0.x” below it.
Right-Panel Swing Log (Table)
What it is
A compact, auto-updating log of the most recent Swing High/Low events, printed in the top-right of the chart.
It helps you see when a pivot formed, when it was confirmed, and at what price—so you know the earliest bar a zone-based signal could have appeared.
Columns
Type – Swing High or Swing Low.
Date – Calendar date of the swing bar (follows the chart’s timezone).
Swing @ – Time of the original swing bar (where the dot is drawn).
Confirm @ – Time of the bar that confirmed that swing (≈ Structure Length × timeframe after the swing). This is also the earliest moment a new zone/entry can be considered.
Price – The swing price (high for SH, low for SL).
Why it’s useful
Clarity on repaint/confirmation: shows the natural delay between a swing forming and being usable—no guessing.
Planning & journaling: quick reference of today’s pivots and prices for notes/backtesting.
Scanning intraday: glance to see if you already have a confirmed zone (and therefore valid fib-bounce entries), or if you’re still waiting.
Context for signals: if a fib-bounce triangle appears before the time listed in Confirm @, it’s not a valid trade (you were too early).
Settings (Inputs → Logging)
Log swing times / Show table – turn the table on/off.
Rows to keep – how many recent entries to display.
Show labels on swing bar – optional tags on the chart (“Swing High 11:45”, “Confirm SH 14:15”) that match the table.
Recommended defaults
• Structure Length: 10–20 for intraday; 20–40 for swing.
• Entry Fib for Signals: 0.5 to start; try 0.3 in stronger trends and 0.6 in choppier markets.
• One Signal Per Zone: ON (prevents over trading).
• Zone Display: Both.
• Fib Lines: Keep 0.3/0.5/0.7 on; turn on 0 and 1 only if you need anchors.
Alerts
Two alert conditions are available:
• BUY signal – fires when a with trend bullish bounce at the selected fib occurs inside a bullish zone.
• SELL signal – fires when a with trend bearish bounce at the selected fib occurs inside a bearish zone.
Create alerts from the chart’s Alerts panel and select the desired condition. Use Once Per Bar Close to avoid intrabar flicker.
Notes & tips
• Swing dots are confirmed only after Structure Length bars, so they plot back in time; zones built from these confirmed swings do not repaint (though they extend as new bars form).
• If you don’t see a BUY where you expect one, check: (1) Is the active zone bullish? (2) Did the candle’s low actually pierce the selected fib and close above it? (3) Is One Signal Per Zone suppressing a second entry?
• You can hide visual clutter by reducing Show Last to 1–3 while keeping Display All Zones off.
Glossary
• CHOCH (Change of Character): A shift where price breaks beyond the last opposite swing while local momentum flips.
• BOS (Break of Structure): A cleaner break beyond the prior swing level in the current momentum direction.
• MSS: Either CHOCH or BOS – any event that spawns a new zone.
Extension ideas (optional)
• Add fib extensions (1.272 / 1.618) for target lines.
• Zone quality score using ATR normalization to filter weak impulses.
• HTF filter to only accept zones aligned with a higher timeframe trend.
⚠️ Disclaimer This script is provided for educational purposes only.
Past performance does not guarantee future results.
Trading involves risk, and users should exercise caution and use proper risk management when applying this strategy.
Trend Speed Analyzer + alerts//@version=6
indicator('Trend Speed Analyzer + alerts', overlay = false)
//~~}
// ~~ Tooltips {
string t1 = 'Maximum Length: This parameter sets the upper limit for the number of bars considered in the dynamic moving average. A higher value smooths out the trend line, making it less reactive to minor fluctuations but slower to adapt to sudden price movements. Use higher values for long-term trend analysis and lower values for faster-moving markets.'
string t2 = 'Accelerator Multiplier: Adjusts the responsiveness of the dynamic moving average to price changes. A larger value makes the trend more reactive but can introduce noise in choppy markets. Lower values create a smoother trend but may lag behind rapid price movements. This is particularly useful in volatile markets where precise sensitivity is needed.'
string t5 = 'Enable Candles: When enabled, the candlesticks on the chart will be color-coded based on the calculated trend speed. This provides a visual representation of momentum, making it easier to spot shifts in market dynamics. Disable this if you prefer the standard candlestick colors.'
string t6 = 'Collection Period: Defines the number of bars used to normalize trend speed values. A higher value includes a broader historical range, smoothing out the speed calculation. Lower values make the speed analysis more sensitive to recent price changes, ideal for short-term trading.'
string t7 = 'Enable Table: Activates a statistical table that provides an overview of key metrics, such as average wave height, maximum wave height, dominance, and wave ratios. Useful for traders who want numerical insights to complement visual trend analysis.'
string t8 = 'Lookback Period: Determines how many historical bars are used for calculating bullish and bearish wave data. A longer lookback period provides a more comprehensive view of market trends but may dilute sensitivity to recent market conditions. Shorter periods focus on recent data.'
string t9 = 'Start Date: Sets the starting point for all calculations. This allows you to analyze data only from a specific date onward, which is useful for isolating trends within a certain period or avoiding historical noise.'
string t10 = 'Timer Option: Select between using a custom start date or starting from the first available bar on the chart. The \'Custom\' option works with the Start Date setting, while \'From start\' includes all available data.'
// Tooltips for Table Cells
string tt1 = 'Average Wave: Shows the average size of bullish or bearish waves during the lookback period. Use this to assess overall market strength. Larger values indicate stronger trends, and comparing bullish vs bearish averages can reveal market bias. For instance, a higher bullish average suggests a stronger uptrend.'
string tt2 = 'Max Wave: Displays the largest bullish or bearish wave during the lookback period. Use this to identify peak market momentum. A significantly higher bullish or bearish max wave indicates where the market may have shown extreme trend strength in that direction.'
string tt3 = 'Current Wave Ratio (Average): Compares the current wave\'s size to the average wave size for both bullish and bearish trends. A value above 1 indicates the current wave is stronger than the historical average, which may signal increased market momentum. Use this to evaluate if the current move is significant compared to past trends.'
string tt4 = 'Current Wave Ratio (Max): Compares the current wave\'s size to the maximum wave size for both bullish and bearish trends. A value above 1 suggests the current wave is setting new highs in strength, which could indicate a breakout or strong momentum in the trend direction.'
string tt5 = 'Dominance (Average): The net difference between the average bullish and bearish wave sizes. Positive values suggest bullish dominance over time, while negative values indicate bearish dominance. Use this to determine which side (bulls or bears) has had consistent control of the market over the lookback period.'
string tt6 = 'Dominance (Max): The net difference between the largest bullish and bearish wave sizes. Positive values suggest bulls have dominated with stronger individual waves, while negative values indicate bears have produced stronger waves. Use this to gauge the most significant power shifts in the market.'
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
max_length = input.int(50, minval = 1, title = 'Maximum Length', group = 'Dynamic Moving Average', tooltip = t1)
accel_multiplier = input.float(5.0, minval = 0.0, step = 1.1, title = 'Accelerator Multiplier', group = 'Dynamic Moving Average', tooltip = t2)
tbl_ = input.bool(true, title = 'Enable Table', group = 'Wave Analysis', tooltip = t7)
lookback_period = input.int(100, minval = 1, step = 1, title = 'Lookback Period', group = 'Wave Analysis', tooltip = t8)
candle = input.bool(true, title = 'Enable Candles', group = 'Trend Visualization', tooltip = t5)
collen = input.int(100, step = 10, minval = 5, title = 'Collection Period', group = 'Trend Visualization', tooltip = t6)
up_col = input.color(color.lime, title = 'Dynamic Trend', group = 'Trend Visualization', inline = 'Trend')
dn_col = input.color(color.red, title = '', group = 'Trend Visualization', inline = 'Trend')
up_hist_col = input.color(#82ffc3, title = 'Trend Speed Up', group = 'Trend Visualization', inline = 'up')
up_hist_col_ = input.color(color.lime, title = '', group = 'Trend Visualization', inline = 'up')
dn_hist_col = input.color(color.red, title = 'Trend Speed Dn', group = 'Trend Visualization', inline = 'dn')
dn_hist_col_ = input.color(#f78c8c, title = '', group = 'Trend Visualization', inline = 'dn')
start = input.time(timestamp('1 Jan 2020 00:00 +0000'), title = 'Start Date', group = 'Time Settings', tooltip = t9, inline = 'startdate')
timer = input.string('From start', title = 'Timer Option', options = , group = 'Time Settings', tooltip = t10, inline = 'startdate')
// ~~ Dynamic Average {
counts_diff = close
max_abs_counts_diff = ta.highest(math.abs(counts_diff), 200)
counts_diff_norm = (counts_diff + max_abs_counts_diff) / (2 * max_abs_counts_diff)
dyn_length = 5 + counts_diff_norm * (max_length - 5)
// ~~ Function to compute the accelerator factor with normalization of delta_counts_diff {
calc_accel_factor(float counts_diff, float prev_counts_diff) =>
delta_counts_diff = math.abs(counts_diff - prev_counts_diff)
float max_delta_counts_diff = ta.highest(delta_counts_diff, 200)
max_delta_counts_diff := max_delta_counts_diff == 0 ? 1 : max_delta_counts_diff
float accel_factor = delta_counts_diff / max_delta_counts_diff
accel_factor
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
// ~~ Function to adjust alpha using the accelerator factor {
adjust_alpha(float dyn_length, float accel_factor, float accel_multiplier) =>
alpha_base = 2 / (dyn_length + 1)
alpha = alpha_base * (1 + accel_factor * accel_multiplier)
alpha := math.min(1, alpha)
alpha
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
// ~~ Accelerator Factor
accel_factor = calc_accel_factor(counts_diff, nz(counts_diff ))
alpha = adjust_alpha(dyn_length, accel_factor, accel_multiplier)
// ~~ Compute dynamic Ema
var float dyn_ema = na
dyn_ema := na(dyn_ema ) ? close : alpha * close + (1 - alpha) * dyn_ema
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
// ~~ Trend Speed {
trend = dyn_ema
bullsrc = close
bearsrc = close
type TrendData
array change
array t
StartTime() =>
time > start
var bullish = TrendData.new(array.new(), array.new())
var bearish = TrendData.new(array.new(), array.new())
var x1 = int(na)
var y1 = float(na)
var pos = 0
var speed = 0.0
c = ta.rma(close, 10)
o = ta.rma(open, 10)
// ~~ First value {
if na(x1) and StartTime() or na(x1) and timer == 'From start'
x1 := bar_index
y1 := o
y1
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
// ~~ Trend direction {
if StartTime() or timer == 'From start'
if bullsrc > trend and bullsrc <= trend
bearish.change.unshift(ta.lowest(speed, bar_index - x1))
bearish.t.unshift(bar_index - x1)
x1 := bar_index
y1 := bullsrc
pos := 1
speed := c - o
speed
if bearsrc < trend and bearsrc >= trend
bullish.change.unshift(ta.highest(speed, bar_index - x1))
bullish.t.unshift(bar_index - x1)
x1 := bar_index
y1 := bearsrc
pos := -1
speed := c - o
speed
speed := speed + c - o
speedGradient = color.from_gradient(speed, ta.min(-speed / 3), ta.max(speed / 3), color.red, color.lime)
trendspeed = ta.hma(speed, 5)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
// ~~ Plots {
rma_dyn_ema(x, p) =>
average = ta.rma(dyn_ema , p)
average
colour = ta.wma(close, 2) > dyn_ema ? up_col : dn_col
fillColor = rma_dyn_ema(0, 5) > rma_dyn_ema(1, 5) ? color.new(up_col, 70) : color.new(dn_col, 70)
p1 = plot(dyn_ema, color = colour, linewidth = 2, title = 'Dynamic Trend', force_overlay = true)
p2 = plot(ta.rma(hl2, 50), display = display.none, editable = false, force_overlay = true)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
min_speed = ta.lowest(speed, collen)
max_speed = ta.highest(speed, collen)
normalized_speed = (speed - min_speed) / (max_speed - min_speed)
speedGradient1 = speed < 0 ? color.from_gradient(normalized_speed, 0.0, 0.5, dn_hist_col, dn_hist_col_) : color.from_gradient(normalized_speed, 0.5, 1.0, up_hist_col, up_hist_col_)
plot(StartTime() or timer == 'From start' ? trendspeed : na, title = 'Trend Speed', color = speedGradient1, style = plot.style_columns)
plotcandle(open, high, low, close, color = candle ? speedGradient1 : na, wickcolor = candle ? speedGradient1 : na, bordercolor = candle ? speedGradient1 : na, force_overlay = true)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
// ~~ Table {
if barstate.islast and tbl_
bullish_recent = bullish.change.slice(0, math.min(lookback_period, bullish.change.size()))
bearish_recent = bearish.change.slice(0, math.min(lookback_period, bearish.change.size()))
bull_max = bullish_recent.max()
bear_max = bearish_recent.min()
bull_avg = bullish_recent.avg()
bear_avg = bearish_recent.avg()
wave_size_ratio_avg = bull_avg / math.abs(bear_avg)
wave_size_text_avg = str.tostring(math.round(wave_size_ratio_avg, 2)) + 'x'
wave_size_color_avg = wave_size_ratio_avg > 0 ? color.lime : color.red
wave_size_ratio_max = bull_max / math.abs(bear_max)
wave_size_text_max = str.tostring(math.round(wave_size_ratio_max, 2)) + 'x'
wave_size_color_max = wave_size_ratio_max > 0 ? color.lime : color.red
dominance_avg_value = bull_avg - math.abs(bear_avg)
dominance_avg_text = dominance_avg_value > 0 ? 'Bullish +' + str.tostring(math.round(wave_size_ratio_avg, 2)) + 'x' : 'Bearish -' + str.tostring(math.round(1 / wave_size_ratio_avg, 2)) + 'x'
dominance_avg_color = dominance_avg_value > 0 ? color.lime : color.red
dominance_max_value = bull_max - math.abs(bear_max)
dominance_max_text = dominance_max_value > 0 ? 'Bullish +' + str.tostring(math.round(wave_size_ratio_max, 2)) + 'x' : 'Bearish -' + str.tostring(math.round(1 / wave_size_ratio_max, 2)) + 'x'
dominance_max_color = dominance_max_value > 0 ? color.lime : color.red
current_wave = speed
current_wave_color = current_wave > 0 ? color.lime : color.red
current_ratio_avg = current_wave > 0 ? current_wave / bull_avg : current_wave / math.abs(bear_avg)
current_ratio_max = current_wave > 0 ? current_wave / bull_max : current_wave / math.abs(bear_max)
current_text_avg = str.tostring(math.round(current_ratio_avg, 2)) + 'x'
current_text_max = str.tostring(math.round(current_ratio_max, 2)) + 'x'
current_color_avg = current_ratio_avg > 0 ? color.lime : color.red
current_color_max = current_ratio_max > 0 ? color.lime : color.red
var tbl = table.new(position.top_right, 3, 3, force_overlay = true)
table.cell(tbl, 0, 0, '', text_color = chart.fg_color, tooltip = '')
table.cell(tbl, 0, 1, 'Average Wave', text_color = chart.fg_color, tooltip = tt1)
table.cell(tbl, 0, 2, 'Max Wave', text_color = chart.fg_color, tooltip = tt2)
table.cell(tbl, 1, 0, 'Current Wave Ratio', text_color = chart.fg_color, tooltip = '')
table.cell(tbl, 1, 1, current_text_avg, text_color = current_color_avg, tooltip = tt3)
table.cell(tbl, 1, 2, current_text_max, text_color = current_color_max, tooltip = tt4)
table.cell(tbl, 2, 0, 'Dominance', text_color = chart.fg_color, tooltip = '')
table.cell(tbl, 2, 1, dominance_avg_text, text_color = dominance_avg_color, tooltip = tt5)
table.cell(tbl, 2, 2, dominance_max_text, text_color = dominance_max_color, tooltip = tt6)
// ─────────────────────────────────────────────────────────────
// MTF BUY/SELL alerts: 10m & 1H agreement (no logic changes)
isGreen = ta.wma(close, 2) > dyn_ema
tf_fast = input.timeframe("10", "Fast TF (Buy/Sell check)", group = "MTF Alerts")
tf_slow = input.timeframe("60", "Slow TF (Buy/Sell check)", group = "MTF Alerts")
confirm_on_close = input.bool(true, "Confirm on bar close", group = "MTF Alerts")
green_fast = request.security(syminfo.tickerid, tf_fast, isGreen, lookahead = barmerge.lookahead_off)
green_slow = request.security(syminfo.tickerid, tf_slow, isGreen, lookahead = barmerge.lookahead_off)
buyCond = green_fast and green_slow
sellCond = not green_fast and not green_slow
triggerOK = confirm_on_close ? barstate.isconfirmed : true
// Single BUY / SELL alerts (messages unchanged)
alertcondition(buyCond and triggerOK, title = "MTF BUY (10m & 1H GREEN)", message = "{{ticker}} | TF={{interval}} | Dynamic line")
alertcondition(sellCond and triggerOK, title = "MTF SELL (10m & 1H RED)", message = "{{ticker}} | TF={{interval}} | Dynamic line")
// ─────────────────────────────────────────────────────────────
// NEW: 10m status repeated EVERY MINUTE (no logic changes)
// ─────────────────────────────────────────────────────────────
// 1-minute pulse: true once per closed 1m bar
m1_pulse = request.security(syminfo.tickerid, "1", barstate.isconfirmed, lookahead = barmerge.lookahead_off)
// Repeat ONLY the 10-minute status every minute
status10_green = green_fast
status10_red = not green_fast
alertcondition(status10_green and m1_pulse, title = "10m Status GREEN — repeat each minute", message = "{{ticker}} | TF=10 | Dynamic line — GREEN")
alertcondition(status10_red and m1_pulse, title = "10m Status RED — repeat each minute", message = "{{ticker}} | TF=10 | Dynamic line — RED")
how do the trend speed anlaysis work
VCP + TTM Squeeze Breakout Detection ToolThis open-source script combines two powerful concepts into a single breakout detection tool:
1. **VCP (Volatility Contraction Pattern)**
Based on Mark Minervini’s principle of structured volatility contraction.
The script identifies low ATR environments combined with a strong trend filter using EMA 50, EMA 100, and EMA 200.
A pivot high is fixed using a rolling high from the last X candles.
2. **TTM Squeeze (inspired by Beardy_Fred's Pro version)**
This module compares Bollinger Bands to Keltner Channels.
When the Bollinger Bands fit inside the Keltner Channels, it signals volatility compression.
The script classifies the squeeze intensity into four stages using colored dots:
- **Green:** No squeeze
- **Black:** Light compression
- **Red:** Medium compression
- **Orange:** Strong compression
A linear momentum oscillator adds directional confirmation by plotting aqua bars above price if momentum is positive.
---
### **Signal Logic**
- **Yellow Dots (Setup Potential)**
Appear when VCP criteria are met **and** either momentum is bearish or the squeeze is still active (non-green).
- **Green Dots (Breakout Active)**
Appear only when:
- Price breaks above pivot high
- EMA filter is valid
- Squeeze has resolved (green)
- Volume is higher than the previous bar
- Momentum is positive
Breakout status is removed once volume AND true range drop below their respective short-term averages.
---
### **Visual Elements**
- 3 EMA Lines: EMA 50 (blue), EMA 100 (orange), EMA 200 (red)
- Pivot line (red), based on recent high
- Colored squeeze state (dots at zero line)
- Yellow dots (pre-breakout tension)
- Green dots (confirmed breakout)
- Aqua bars above price (momentum strength)
---
**Note:**
This script is for educational purposes only and does not constitute financial advice.
No alerts included yet. No external dependencies. No embedded advertising.
---
**License**
Portions of the TTM Squeeze code are derived from “Beardy Squeeze Pro” and are used under the terms of the Mozilla Public License 2.0.
www.mozilla.org
Order Block Volumatic FVG StrategyInspired by: Volumatic Fair Value Gaps —
License: CC BY-NC-SA 4.0 (Creative Commons Attribution–NonCommercial–ShareAlike).
This script is a non-commercial derivative work that credits the original author and keeps the same license.
What this strategy does
This turns BigBeluga’s visual FVG concept into an entry/exit strategy. It scans bullish and bearish FVG boxes, measures how deep price has mitigated into a box (as a percentage), and opens a long/short when your mitigation threshold and filters are satisfied. Risk is managed with a fixed Stop Loss % and a Trailing Stop that activates only after a user-defined profit trigger.
Additions vs. the original indicator
✅ Strategy entries based on % mitigation into FVGs (long/short).
✅ Lower-TF volume split using upticks/downticks; fallback if LTF data is missing (distributes prior bar volume by close’s position in its H–L range) to avoid NaN/0.
✅ Per-FVG total volume filter (min/max) so you can skip weak boxes.
✅ Age filter (min bars since the FVG was created) to avoid fresh/immature boxes.
✅ Bull% / Bear% share filter (the 46%/53% numbers you see inside each FVG).
✅ Optional candle confirmation and cooldown between trades.
✅ Risk management: fixed SL % + Trailing Stop with a profit trigger (doesn’t trail until your trigger is reached).
✅ Pine v6 safety: no unsupported args, no indexof/clamp/when, reverse-index deletes, guards against zero/NaN.
How a trade is decided (logic overview)
Detect FVGs (same rules as the original visual logic).
For each FVG currently intersected by the bar, compute:
Mitigation % (how deep price has entered the box).
Bull%/Bear% split (internal volume share).
Total volume (printed on the box) from LTF aggregation or fallback.
Age (bars) since the box was created.
Apply your filters:
Mitigation ≥ Long/Short threshold.
Volume between your min and max (if enabled).
Age ≥ min bars (if enabled).
Bull% / Bear% within your limits (if enabled).
(Optional) the current candle must be in trade direction (confirm).
If multiple FVGs qualify on the same bar, the strategy uses the most recent one.
Enter long/short (no pyramiding).
Exit with:
Fixed Stop Loss %, and
Trailing Stop that only starts after price reaches your profit trigger %.
Input settings (quick guide)
Mitigation source: close or high/low. Use high/low for intrabar touches; close is stricter.
Mitigation % thresholds: minimal mitigation for Long and Short.
TOTAL Volume filter: skip FVGs with too little/too much total volume (per box).
Bull/Bear share filter: require, e.g., Long only if Bull% ≥ 50; avoid Short when Bull% is high (Short Bull% max).
Age filter (bars): e.g., ≥ 20–30 bars to avoid fresh boxes.
Confirm candle: require candle direction to match the trade.
Cooldown (bars): minimum bars between entries.
Risk:
Stop Loss % (fixed from entry price).
Activate trailing at +% profit (the trigger).
Trailing distance % (the trailing gap once active).
Lower-TF aggregation:
Auto: TF/Divisor → picks 1/3/5m automatically.
Fixed: choose 1/3/5/15m explicitly.
If LTF can’t be fetched, fallback allocates prior bar’s volume by its close position in the bar’s H–L.
Suggested starting presets (you should optimize per market)
Mitigation: 60–80% for both Long/Short.
Bull/Bear share:
Long: Bull% ≥ 50–70, Bear% ≤ 100.
Short: Bull% ≤ 60 (avoid shorting into strong support), Bear% ≥ 0–70 as you prefer.
Age: ≥ 20–30 bars.
Volume: pick a min that filters noise for your symbol/timeframe.
Risk: SL 4–6%, trailing trigger 1–2%, distance 1–2% (crypto example).
Set slippage/fees in Strategy Properties.
Notes, limitations & best practices
Data differences: The LTF split uses request.security_lower_tf. If the exchange/data feed has sparse LTF data, the fallback kicks in (it’s deliberate to avoid NaNs but is a heuristic).
Real-time vs backtest: The current bar can update until close; results on historical bars use closed data. Use “Bar Replay” to understand intrabar effects.
No pyramiding: Only one position at a time. Modify pyramiding in the header if you need scaling.
Assets: For spot/crypto, TradingView “volume” is exchange volume; in some markets it may be tick volume—interpret filters accordingly.
Risk disclosure: Past performance ≠ future results. Use appropriate position sizing and risk controls; this is not financial advice.
Credits
Visual FVG concept and original implementation: BigBeluga.
This derivative strategy adds entry/exit logic, volume/age/share filters, robust LTF handling, and risk management while preserving the original spirit.
License remains CC BY-NC-SA 4.0 (non-commercial, attribution required, share-alike).
Multi Indicator Screener# 📊 Multi-Indicator Screener | BB + KC Squeeze + RSI + MACD + ADX
### 🔹 Institutional-Grade Multi-Symbol Scanner with Breakout Alerts
---
## 📌 Overview
The **Multi-Indicator Screener** is an advanced dashboard that monitors **10 symbols simultaneously** with **multi-indicator confluence**:
- 🔹 **Bollinger Bands + Keltner Channel (Squeeze Logic)**
- 🔹 **RSI + MACD Confirmation**
- 🔹 **ADX Trend Strength**
- 🔹 **ATR-based Trailing Stops**
- 🔹 **Volume-Confirmed Breakouts**
Designed for **professional traders**, this screener highlights **high-probability setups** across multiple assets in real time.
---
## ✨ Key Features
### 🔹 Bollinger Band Suite
- ✅ Detects **directional bias** (Bullish / Bearish / Neutral).
- ✅ Marks **Breakouts (Up/Down)** with optional **volume confirmation**.
- ✅ LazyBear-style **Squeeze Detection**:
- 🔒 Squeeze ON → Low volatility, contraction phase.
- 🚀 Squeeze OFF → Breakout potential.
- Neutral → No clear squeeze.
### 🔹 RSI + MACD Confluence
- ✅ RSI confirmation above user-defined threshold (default 55).
- ✅ MACD crossover confirmation.
- ✅ RSI value color-coded in table:
- 🔴 Oversold (<30)
- 🟢 Strong bullish (>60)
- 🟢 Lime (>75 = very strong)
- 🟠 Neutral zone
### 🔹 ADX Trend Strength
- ✅ Displays **ADX value**, plus **+DI / -DI**.
- ✅ ADX > 25 → Highlighted as strong trend.
### 🔹 ATR Trailing Stop Loss
- ✅ Auto-calculated **buy-side trailing stop** & **sell-side trailing stop**.
- ✅ Adjustable via multiplier input.
### 🔹 Multi-Symbol Screener Table
- ✅ Preloaded with **Top 10 Nifty 50 symbols** (customizable).
- ✅ Dashboard columns include:
- Symbol
- BB Direction
- Breakout
- Squeeze Status
- Higher-TF BB Confirmation
- RSI + MACD Signals
- RSI Value
- ADX, +DI, -DI
- Trailing SL (Buy/Sell)
- Volume Confirmation
---
## 🔔 Alerts
Each symbol has **independent breakout alerts**:
- 📢 `Volume-Confirmed BB Breakout Detected`
Alerts fire when a **breakout above/below Bollinger Bands** is confirmed with **above-average volume**.
---
## 📖 How to Use
1. **Select Symbols**
- By default, loads top Nifty 50 stocks.
- Replace with your preferred tickers (`NSE:RELIANCE`, `NASDAQ:AAPL`, `BINANCE:BTCUSDT`, etc.).
2. **Enable Presets**
- **Scalping Mode** → BB Length = 10, Multiplier = 1.5 (more sensitive).
- **Swing Mode** → BB Length = 30, Multiplier = 2.5 (smoother).
3. **Monitor Table**
- Look for **✔️ confirmations** across BB, RSI, MACD, ADX, and Volume.
- Strong setups = multiple confirmations aligning.
4. **Set Alerts**
- Add alerts for your desired symbols to never miss a breakout.
---
## 🎯 Best For
- ✅ Scalpers & Swing Traders
- ✅ Multi-asset monitoring (stocks, forex, crypto)
- ✅ Traders using **volatility breakout + momentum confirmation**
- ✅ Institutional-style dashboard users
---
## ⚠️ Disclaimer
This script is for **educational purposes only**.
It is **not financial advice**. Please backtest before trading.
---
❄️ Lin Kuei Ice Storm Oscillator ❄️❄️ Lin Kuei Ice Storm Oscillator (LKISO) ❄️
What It Does
The Lin Kuei Ice Storm Oscillator combines RSI and Stochastic indicators to create a powerful momentum oscillator that shows market "temperature" - helping you identify optimal entry and exit points with crystal clarity.
🌡️ Thermal Zones
🔥 Melting Point (80-100) - SELL ZONE
Market is overheated and overbought
Look for short opportunities or exit long positions
⚖️ Balance Zone (40-60) - NEUTRAL
Market is in equilibrium
Wait for clear directional signals
🧊 Freezing Point (0-20) - BUY ZONE
Market is overcooled and oversold
Look for long opportunities or exit short positions
📈 Trading Positions
🗡️ Long Position (BUY)
You buy an asset expecting price to rise
Profit when price goes up, lose when price goes down
Example: Buy Bitcoin at $45,000, sell at $50,000 = $5,000 profit
🛡️ Short Position (SELL)
You sell an asset expecting price to fall
Profit when price goes down, lose when price goes up
Example: Short Bitcoin at $50,000, buy back at $45,000 = $5,000 profit
🥷 Trading Modes
Ninja Mode (Conservative)
Fewer signals, higher accuracy
Best for beginners
Warrior Mode (Balanced)
Moderate signals with momentum confirmation
Best for experienced traders
Grandmaster Mode (Aggressive)
Maximum signals, fastest entries
Best for professionals
🎯 Key Signals
BUY Signals
Ice Storm line crosses above 50 (center line)
Bounce from Freezing Point (20 level)
Ice Storm crosses above Frost Signal line
SELL Signals
Ice Storm line crosses below 50 (center line)
Reversal from Melting Point (80 level)
Ice Storm crosses below Frost Signal line
🎨 Visual Features
Dynamic Colors: Lines change color based on momentum intensity
Thermal Zones: Background colors show market temperature
Signal Ribbon: Green = bullish, Red = bearish
Real-time Dashboard: Shows current market condition and position
⚡ Best Practices
Use multiple confirmations - Don't trade on single signals
Respect thermal zones - Extreme readings often reverse
Choose your battle style based on experience level
Combine with proper risk management - Set stop losses
Works best on 1H-1D timeframes for swing trading
🚨 Quick Setup
Add indicator to chart
Choose your battle style (Ninja/Warrior/Grandmaster)
Enable thermal zones and signals
Wait for clear buy/sell signals
Trade with proper position sizing
The LKISO transforms market chaos into crystal-clear trading opportunities through the power of thermal analysis and momentum fusion.
RSI: alternative derivationMost traders accept the Relative Strength Index (RSI) as a standard tool for measuring momentum. But what if RSI is actually a position indicator?
This script introduces an alternative derivation of RSI, offering a fresh perspective on its true nature. Instead of relying on the traditional calculation of average gains and losses, this approach directly considers the price's position relative to its equilibrium (moving average), adjusted for volatility.
While the final value remains identical to the standard RSI, this alternative derivation offers a completely new understanding of the indicator.
Key components:
Price (Close)
Utilizes the closing price, consistent with the original RSI formula.
normalization factor
Transforms raw calculations into a fixed range between -1 and +1.
normalization_factor = 1 / (Length - 1)
EMA of Price
Applies Wilder’s Exponential Moving Average (EMA) to the price, serving as the anchor point for measuring price position, similar to the traditional RSI formula.
myEMA = ta.rma(close,Length)
EMA of close-to-close absolute changes (unit of volatility)
Adjusts for market differences by applying a Wilder’s EMA to absolute price changes (volatility), ensuring consistency across various assets.
CC_vol = ta.rma(math.abs(close - close ),Length)
Calculation Breakdown
DISTANCE:
Calculate the difference between the closing price and its Wilder's EMA. A positive value indicates the price is above the EMA; a negative value indicates it is below.
distance = close - myEMA
STANDARDIZED DISTANCE
Divide the distance by the unit of volatility to standardize the measurement across different markets.
S_distance = distance / CC_vol
NORMALIZED DISTANCE
Normalize the standardized distance using the normalization factor (n-1) to adjust for the lookback period.
N_distance = S_distance * normalization_factor
RSI
Finally, scale the normalized distance to fit within the standard RSI range of 0 to 100.
myRSI = 50 * (1 + N_distance)
The final equation:
RSI = 50 ×
What This Means for RSI
Same RSI Values, Different Interpretation
The standard RSI formula may obscure its true measurement, whereas this approach offers clarity.
RSI primarily indicates the price's position relative to its equilibrium, rather than directly measuring momentum.
RSI can still be used to analyze momentum, but in a more intuitive and well-informed way.
Adaptive Heikin Ashi [CHE]Adaptive Heikin Ashi — volatility-aware HA with fewer fake flips
Summary
Adaptive Heikin Ashi is a volatility-aware reinterpretation of classic Heikin Ashi that continuously adjusts its internal smoothing based on the current ATR regime, which means that in quiet markets the indicator reacts more quickly to genuine directional changes, while in turbulent phases it deliberately increases its smoothing to suppress jitter and color whipsaws, thereby reducing “noise” and cutting down on fake flips without resorting to heavy fixed smoothing that would lag everywhere.
Motivation: why adapt at all?
Classic Heikin Ashi replaces raw OHLC candles with a smoothed construction that averages price and blends each new candle with the previous HA state, which typically cleans up trends and improves visual coherence, yet its fixed smoothing amount treats calm and violent markets the same, leading to the usual dilemma where a setting that looks crisp in a narrow range becomes too nervous in a spike, and a setting that tames high volatility feels unnecessarily sluggish as soon as conditions normalize; by allowing the smoothing weight to expand and contract with volatility, Adaptive HA aims to keep candles readable across shifting regimes without constant manual retuning.
What is different from normal Heikin Ashi?
Fixed vs. adaptive blend:
Classic HA implicitly uses a fixed 50/50 blend for the open update (`HA_open_t = 0.5 HA_open_{t-1} + 0.5 HA_close_{t-1}`), while this script replaces the constant 0.5 with a dynamic weight `w_t` that oscillates around 0.5 as a function of observed volatility, which turns the open update into an EMA-like filter whose “alpha” automatically changes with market conditions.
Volatility as the steering signal:
The script measures volatility via ATR and compares it to a rolling baseline (SMA of ATR over the same length), producing a normalized deviation that is scaled by sensitivity, clamped to ±1 for stability, and then mapped to a bounded weight interval ` `, so the adaptation is strong enough to matter but never runs away.
Outcome that matters to traders:
In high volatility, the weight shifts upward toward the prior HA open, which strengthens smoothing exactly where classic HA tends to “chatter,” while in low volatility the weight shifts downward toward the most recent HA close, which speeds up reaction so quiet trends do not feel artificially delayed; this is the practical mechanism by which noise and fake signals are reduced without accepting blanket lag.
How it works
1. HA close matches classic HA:
`HA_close_t = (Open_t + High_t + Low_t + Close_t) / 4`
2. Volatility normalization:
`ATR_t` is computed over `atr_length`, its baseline is `ATR_SMA_t = SMA(ATR, atr_length)`, and the raw deviation is `(ATR_t / ATR_SMA_t − 1)`, which is then scaled by `adapt_sensitivity` and clamped to ` ` to obtain `v_t`, ensuring that pathological spikes cannot destabilize the weighting.
3. Adaptive weight around 0.5:
`w_t = 0.5 + oscillation_range v_t`, giving `w_t ∈ `, so with a default `range = 0.20` the weight stays between 0.30 and 0.70, which is wide enough to matter but narrow enough to preserve HA identity.
4. EMA-like open update:
On the very first bar the open is seeded from a stable combination of the raw open and close, and thereafter the update is
`HA_open_t = w_t HA_open_{t−1} + (1 − w_t) HA_close_{t−1}`,
which is equivalent to an EMA where higher `w_t` means heavier inertia (more smoothing) and lower `w_t` means stronger pull to the latest price information (more responsiveness).
5. High and low follow classic HA composition:
`HA_high_t = max(High_t, max(HA_open_t, HA_close_t))`,
`HA_low_t = min(Low_t, min(HA_open_t, HA_close_t))`,
thereby keeping visual semantics consistent with standard HA so that your existing reading of bodies, wicks, and transitions still applies.
Why this reduces noise and fake signals in practice
Fake flips in HA typically occur when a fixed blending rule is forced to process candles during a volatility surge, producing rapid alternations around pivots or within wide intrabar ranges; by increasing smoothing exactly when ATR jumps relative to its baseline, the adaptive open stabilizes the candle body progression and suppresses transient color changes, while in the opposite scenario of compressed ranges, the reduced smoothing allows small but persistent directional pressure to reflect in candle color earlier, which reduces the tendency to enter late after multiple slow transitions.
Parameter guide (what each input really does)
ATR Length (default 14): controls both the ATR and its baseline window, where longer values dampen the adaptation by making the baseline slower and the deviation smaller, which is helpful for noisy lower timeframes, while shorter values make the regime detector more reactive.
Oscillation Range (default 0.20): sets the maximum distance from 0.5 that the weight may travel, so increasing it towards 0.25–0.30 yields stronger smoothing in turbulence and faster response in calm periods, whereas decreasing it to 0.10–0.15 keeps the behavior closer to classical HA and is useful if your strategy already includes heavy downstream smoothing.
Adapt Sensitivity (default 6.0): multiplies the normalized ATR deviation before clamping, such that higher sensitivity accelerates adaptation to regime shifts, while lower sensitivity produces gradual transitions; negative values intentionally invert the mapping (higher vol → less smoothing) and are generally not recommended unless you are testing a counter-intuitive hypothesis.
Reading the candles and the optional diagnostic
You interpret colors and bodies just like with normal HA, but you can additionally enable the Adaptive Weight diagnostic plot to see the regime in real time, where values drifting up toward the upper bound indicate a turbulent context that is being deliberately smoothed, and values gliding down toward the lower bound indicate a calm environment in which the indicator chooses to move faster, which can be valuable for discretionary confirmation when deciding whether a fresh color shift is likely to stick.
Practical workflows and combinations
Trend-following entries: use color continuity and body expansion as usual, but expect fewer spurious alternations around news spikes or into liquidity gaps; pairing with structure (swing highs/lows, breaks of internal ranges) keeps entries disciplined.
Exit management: when the diagnostic weight remains elevated for an extended period, you can be stricter with exit triggers because flips are less likely to be accidental noise; conversely, when the weight is depressed, consider earlier partials since the indicator is intentionally more nimble.
Multi-asset, multi-TF: the adaptation is especially helpful if you rotate instruments with very different vol profiles or hop across timeframes, since you will not need to retune a fixed smoothing parameter every time conditions change.
Behavior, constraints, and performance
The script does not repaint historical bars and uses only past information on closed candles, yet just like any candle-based visualization the current live bar will update until it closes, so you should avoid acting on mid-bar flips without a rule that accounts for bar close; there are no `security()` calls or higher-timeframe lookups, which keeps performance light and execution deterministic, and the clamping of the volatility signal ensures numerical stability even during extreme ATR spikes.
Sensible defaults and quick tuning
Start with the defaults (`ATR 14`, `Range 0.20`, `Sensitivity 6.0`) and observe the weight plot across a few volatile events; if you still see too many flips in turbulence, either raise `Range` to 0.25 or trim `Sensitivity` to 4–5 so that the weight can move high but does not overreact, and if the indicator feels too slow in quiet markets, lower `Range` toward 0.15 or raise `Sensitivity` to 7–8 to bias the weight a bit more aggressively downward when conditions compress.
What this indicator is—and is not
Adaptive Heikin Ashi is a context-aware visualization layer that improves the signal-to-noise ratio and reduces fake flips by modulating smoothing with volatility, but it is not a complete trading system, it does not predict the future, and it should be combined with structure, risk controls, and position management that fit your market and timeframe; always forward-test on your instruments, and remember that even adaptive smoothing can delay recognition at sharp turning points when volatility remains elevated.
Disclaimer
The content provided, including all code and materials, is strictly for educational and informational purposes only. It is not intended as, and should not be interpreted as, financial advice, a recommendation to buy or sell any financial instrument, or an offer of any financial product or service. All strategies, tools, and examples discussed are provided for illustrative purposes to demonstrate coding techniques and the functionality of Pine Script within a trading context.
Any results from strategies or tools provided are hypothetical, and past performance is not indicative of future results. Trading and investing involve high risk, including the potential loss of principal, and may not be suitable for all individuals. Before making any trading decisions, please consult with a qualified financial professional to understand the risks involved.
By using this script, you acknowledge and agree that any trading decisions are made solely at your discretion and risk.
Best regards and happy trading
Chervolino
Golden/Death Cross with SMAGolden Cross: Triggered when the 50 SMA crosses above the 200 SMA.
Death Cross: Triggered when the 50 SMA crosses below the 200 SMA.