// Copyright (c) 2026 Capital41 | MIT License
// CAPITAL41 FUSION OSCILLATOR v3 (Companion)
// What it does:
// - Plots a 0–100 Fusion Oscillator based on the same four conditions used in
// Capital41 Fusion Scalp (EMA trend, RSI, W%R, ATR/Volume expansion).
// - Designed as a separate panel (like RSI) for quick confluence reading.
//
// v3 changes:
// - ADDED: Alert conditions for zone and midline crosses, matching the C41
// Oscillator companion. Gated by barstate.isconfirmed.
//
// TradingView setup:
// 1) Open TradingView -> Pine Editor.
// 2) Paste this script, Save, and Add to chart.
// 3) Use 30m timeframe on BTC or US stocks.
// 4) Keep inputs synced with Capital41 Fusion Scalp.
//
// Usage guide (30m):
// - 75+ = bullish confluence, 25- = bearish confluence.
// - Use with Fusion Scalp signals for timing and confirmation.
//@version=6
indicator("Capital41 Fusion Oscillator v3", overlay = false)
// Inputs (sync with Fusion Scalp)
emaLen = input.int(50, "EMA length", minval = 5)
rsiLen = input.int(14, "RSI length", minval = 2)
rsiOB = input.int(65, "RSI overbought", minval = 50, maxval = 90)
rsiOS = input.int(35, "RSI oversold", minval = 10, maxval = 50)
wrLen = input.int(14, "Williams %R length", minval = 2)
wrOB = input.float(-20.0, "W%R overbought")
wrOS = input.float(-80.0, "W%R oversold")
requireTurn = input.bool(true, "Require RSI/W%R turn")
atrLen = input.int(14, "ATR length", minval = 1)
atrAvgLen = input.int(20, "ATR avg length", minval = 5)
atrExpMult = input.float(1.1, "ATR expansion multiplier", minval = 1.0, maxval = 3.0)
volLen = input.int(50, "Volume SMA length", minval = 5)
volMult = input.float(1.0, "Volume multiplier", minval = 0.5, maxval = 3.0)
oscSmooth = input.int(3, "Oscillator smoothing", minval = 1, maxval = 20)
showZones = input.bool(true, "Show 25/50/75 zones")
showBg = input.bool(true, "Background highlight")
colorBull = color.new(color.lime, 0)
colorBear = color.new(color.red, 0)
// === Trend filter ===
ema = ta.ema(close, emaLen)
trendLong = close > ema
trendShort = close < ema
// === RSI ===
rsi = ta.rsi(close, rsiLen)
rsiLongTurn = rsi[1] < rsiOS and rsi > rsi[1]
rsiShortTurn = rsi[1] > rsiOB and rsi < rsi[1]
rsiLong = requireTurn ? rsiLongTurn : rsi < rsiOS
rsiShort = requireTurn ? rsiShortTurn : rsi > rsiOB
// === Williams %R ===
wr_manual(_high, _low, _close, _len) =>
hh = ta.highest(_high, _len)
ll = ta.lowest(_low, _len)
rng = hh - ll
rng == 0 ? -50.0 : (hh - _close) / rng * -100
wr = wr_manual(high, low, close, wrLen)
wrLongTurn = wr[1] < wrOS and wr > wr[1]
wrShortTurn = wr[1] > wrOB and wr < wr[1]
wrLong = requireTurn ? wrLongTurn : wr < wrOS
wrShort = requireTurn ? wrShortTurn : wr > wrOB
// === ATR + Volume expansion ===
atr = ta.atr(atrLen)
atrAvg = ta.sma(atr, atrAvgLen)
atrExp = atrAvg > 0 and atr > atrAvg * atrExpMult
volSma = ta.sma(volume, volLen)
volOk = volSma > 0 and volume > volSma * volMult
expansionOK = atrExp and volOk
// Fusion Oscillator (0–100)
expLong = expansionOK and trendLong ? 1 : 0
expShort = expansionOK and trendShort ? 1 : 0
scoreLong = (trendLong ? 1 : 0) + (rsiLong ? 1 : 0) + (wrLong ? 1 : 0) + expLong
scoreShort = (trendShort ? 1 : 0) + (rsiShort ? 1 : 0) + (wrShort ? 1 : 0) + expShort
fusionRaw = scoreLong - scoreShort
fusion = (fusionRaw + 4) * 12.5
fusionSm = ta.sma(fusion, oscSmooth)
oscColor = fusionRaw > 0 ? colorBull : fusionRaw < 0 ? colorBear : color.new(color.gray, 0)
plot(fusionSm, title = "Fusion Oscillator", color = oscColor, linewidth = 2)
plot(showZones ? 75 : na, title = "Upper", color = color.new(color.gray, 70))
plot(showZones ? 50 : na, title = "Mid", color = color.new(color.gray, 80))
plot(showZones ? 25 : na, title = "Lower", color = color.new(color.gray, 70))
bgcolor(showBg ? (fusionSm >= 75 ? color.new(colorBull, 90) : fusionSm <= 25 ? color.new(colorBear, 90) : na) : na)
// Alerts (crosses hoisted so ta.* runs every bar, then confirmed on bar close)
bullZoneCross = ta.crossover(fusionSm, 75)
bearZoneCross = ta.crossunder(fusionSm, 25)
midCrossUp = ta.crossover(fusionSm, 50)
midCrossDown = ta.crossunder(fusionSm, 50)
alertcondition(bullZoneCross and barstate.isconfirmed, title = "Fusion Osc Bull Zone",
message = "Fusion Oscillator: crossed above upper zone on {{ticker}} ({{interval}})")
alertcondition(bearZoneCross and barstate.isconfirmed, title = "Fusion Osc Bear Zone",
message = "Fusion Oscillator: crossed below lower zone on {{ticker}} ({{interval}})")
alertcondition(midCrossUp and barstate.isconfirmed, title = "Fusion Osc Mid Cross Up",
message = "Fusion Oscillator: crossed above midline on {{ticker}} ({{interval}})")
alertcondition(midCrossDown and barstate.isconfirmed, title = "Fusion Osc Mid Cross Down",
message = "Fusion Oscillator: crossed below midline on {{ticker}} ({{interval}})")
Overview
Capital41 Fusion Oscillator v3 evaluates four criteria: EMA trend direction, RSI oversold or overbought turns, Williams %R thresholds, and ATR and volume expansion. Values above 75 indicate strong bullish confluence, while values below 25 signal bearish confluence. Users can adjust oscillator smoothing, horizontal zone levels, trend and momentum periods, and reversal turn strictness to match companion strategy settings.
Composite 0-100 confluence oscillator score
EMA trend, RSI, and Williams %R condition mapping
ATR and Volume expansion detection
Customizable smoothing and horizontal reference zones
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
EMA length
int
50
emaLen
RSI length
int
14
rsiLen
RSI overbought
int
65
rsiOB
RSI oversold
int
35
rsiOS
Williams %R length
int
14
wrLen
W%R overbought
float
-20.0
wrOB
W%R oversold
float
-80.0
wrOS
Require RSI/W%R turn
bool
true
requireTurn
ATR length
int
14
atrLen
ATR avg length
int
20
atrAvgLen
ATR expansion multiplier
float
1.1
atrExpMult
Volume SMA length
int
50
volLen
Show all 16 settings
Setting
Type
Default
Variable
Volume multiplier
float
1.0
volMult
Oscillator smoothing
int
3
oscSmooth
Show 25/50/75 zones
bool
true
showZones
Background highlight
bool
true
showBg
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
The Momentum Setup is a multi-indicator visual tool designed for trend and momentum analysis directly on the price chart. It combines Relative Strength Index (RSI), Money Flow Index (MFI), Commodity Channel Index (CCI), Supertrend, and a 250-bar percentage cha
This indicator overlay generates buy and sell signals based on Aroon extreme levels combined with optional volume or volatility filters. It calculates Aroon Up and Aroon Down lines using localized high and low lookbacks, generating trade entries when Aroon rea
This indicator plots a volume-weighted average price of the typical price on the chart and colors that line by ADX strength. It draws a standard-deviation envelope around VWAP and tints the fill green when plus DI leads and red when minus DI leads. Triangle ma
The MACD RSI EMA Aggressive indicator generates momentum and trend-following signals on the price chart. It combines a MACD crossover or crossunder with an RSI threshold filter, price location relative to an Exponential Moving Average, volume expansion above a
This indicator generates trade entry signals and target levels optimized for 1-hour timeframes, designed for external signal extraction. It calculates 7-period and 16-period EMAs alongside 10-period RSI and ATR filters. Long signals occur when the fast EMA cro
This indicator plots an oscillator in a separate pane. It builds several SuperTrend series across a user-defined factor range and step, using ATR as the band width. On each bar it measures the distance between the close and each SuperTrend output, then groups