Strategy · Pine Script v6 · On the chart

Capital41 Fusion Core Strategy

by damianpitt· code credited to Capital41 | MIT License

Capital41 Fusion Core Strategy is an overlay trading strategy that combines an exponential moving average trend filter, RSI, Williams %R, and volume/ATR expansion into a composite momentum oscillator.

View on GitHub

GitHub stars6on the repository
Pine versionv6current
Lines of code187
Settings25inputs
LicenceMIT
Last update8 weeks ago31 Aug 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

187 lines of Pine Script v6 from Capital41_Fusion Strategy/Capital41_Fusion_Core_Strategy_v3.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

Capital41_Fusion_Core_Strategy_v3.pine
// Copyright (c) 2026 Capital41 | MIT License
// CAPITAL41 FUSION CORE STRATEGY v3

// What it does:
// - Converts Fusion Scalp + Fusion Oscillator into a simple execution strategy.
// - Uses the same four core metrics: EMA trend, RSI state, W%R state,
//   and ATR/Volume expansion.
// - Enters on Fusion Oscillator threshold breaks with trend alignment.
// - Exits on momentum fade (oscillator back through midline) or EMA failure.
//
// v2 changes:
// - FIXED: Commission increased from 0.01% to 0.075% (realistic for crypto exchanges).
// - FIXED: ATR TP/SL now locks ATR at entry time using a var variable, so stop
//   and target levels remain consistent throughout the trade instead of shifting
//   with each new bar's ATR value.
//
// TradingView setup:
// 1) Open TradingView -> Pine Editor.
// 2) Paste this script, Save, and Add to chart.
// 3) Use 30m on BTC or US stocks.
// 4) Keep defaults first, then tune thresholds/risk inputs.
//
// Usage guide (30m):
// - Long entry: trend is up and Fusion Oscillator crosses into strong bull zone.
// - Short entry: trend is down and Fusion Oscillator crosses into strong bear zone.
// - ATR TP/SL locks at entry for consistent risk model.



//@version=6
strategy("Capital41 Fusion Core Strategy v3", overlay = true, pyramiding = 0,
         initial_capital = 10000, commission_type = strategy.commission.percent, commission_value = 0.075)

// Inputs

emaLen      = input.int(50, "EMA length", minval = 5)
showEMA     = input.bool(true, "Show EMA")

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)
useExpFilter = input.bool(true, "Require expansion for entries")

oscSmooth   = input.int(3, "Oscillator smoothing", minval = 1, maxval = 20)
longTrig    = input.float(75.0, "Long trigger", minval = 50.0, maxval = 100.0)
shortTrig   = input.float(25.0, "Short trigger", minval = 0.0, maxval = 50.0)
exitMid     = input.float(50.0, "Exit midline", minval = 25.0, maxval = 75.0)

useAtrRisk  = input.bool(true, "Use ATR TP/SL")
atrStopMult = input.float(1.8, "ATR stop multiplier", minval = 0.2, maxval = 10.0)
rrTarget    = input.float(1.5, "Risk-reward target", minval = 0.5, maxval = 10.0)

showSignals = input.bool(true, "Show entry markers")
showBg      = input.bool(true, "Show setup background")
showBadge   = input.bool(true, "Show status badge")

colorBull    = color.new(color.lime, 0)
colorBear    = color.new(color.red, 0)
colorNeutral = color.new(color.gray, 80)

// === Core metrics (same as Fusion Scalp/Oscillator) ===
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

ema = ta.ema(close, emaLen)
trendLong = close > ema
trendShort = close < ema
plot(showEMA ? ema : na, title = "EMA", color = trendLong ? colorBull : trendShort ? colorBear : color.new(color.gray, 0), linewidth = 2)

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

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 = 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 scoring (same map as companion: 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)

entryFilter = useExpFilter ? expansionOK : true
longSetup = trendLong and fusionSm >= longTrig and entryFilter
shortSetup = trendShort and fusionSm <= shortTrig and entryFilter

longEntry = barstate.isconfirmed and longSetup and not longSetup[1]
shortEntry = barstate.isconfirmed and shortSetup and not shortSetup[1]

// v2: Lock ATR at entry time so stop/target levels don't shift bar-to-bar
var float entryAtr = na

if longEntry
    entryAtr := atr
    strategy.entry("Long", strategy.long)

if shortEntry
    entryAtr := atr
    strategy.entry("Short", strategy.short)

longExit = strategy.position_size > 0 and (fusionSm < exitMid or close < ema)
shortExit = strategy.position_size < 0 and (fusionSm > exitMid or close > ema)

if longExit
    strategy.close("Long", comment = "Core Exit")

if shortExit
    strategy.close("Short", comment = "Core Exit")

// v2: ATR-based TP/SL with entry-locked ATR (no longer shifts every bar)
if useAtrRisk and strategy.position_size != 0 and not na(entryAtr)
    atrStop = entryAtr * atrStopMult
    atrTP   = atrStop * rrTarget
    if strategy.position_size > 0
        strategy.exit("Long TP/SL", "Long",
                      stop  = strategy.position_avg_price - atrStop,
                      limit = strategy.position_avg_price + atrTP)
    if strategy.position_size < 0
        strategy.exit("Short TP/SL", "Short",
                      stop  = strategy.position_avg_price + atrStop,
                      limit = strategy.position_avg_price - atrTP)

plotshape(showSignals and longEntry, title = "Core Long Entry", style = shape.triangleup,
          location = location.belowbar, color = colorBull, size = size.small, text = "L")

plotshape(showSignals and shortEntry, title = "Core Short Entry", style = shape.triangledown,
          location = location.abovebar, color = colorBear, size = size.small, text = "S")

bgcolor(showBg ? (longSetup ? color.new(colorBull, 90) : shortSetup ? color.new(colorBear, 90) : na) : na)

// Status badge
var table status = table.new(position.bottom_left, 6, 1, border_width = 1)
if barstate.islast
    if showBadge
        trText = trendLong ? " EMA+ " : trendShort ? " EMA- " : " EMA0 "
        rsiText = rsiLong ? " RSI+ " : rsiShort ? " RSI- " : " RSI0 "
        wrText = wrLong ? " WR+ " : wrShort ? " WR- " : " WR0 "
        exText = expansionOK ? " VOL+ " : " VOL0 "
        oscText = " OSC " + str.tostring(fusionSm, "#.0") + " "
        sigText = longSetup ? " SET L " : shortSetup ? " SET S " : " SET - "

        table.cell(status, 0, 0, trText,  bgcolor = trendLong ? color.new(colorBull, 70) : trendShort ? color.new(colorBear, 70) : colorNeutral, text_color = color.white, text_size = size.tiny)
        table.cell(status, 1, 0, rsiText, bgcolor = rsiLong ? color.new(colorBull, 70) : rsiShort ? color.new(colorBear, 70) : colorNeutral, text_color = color.white, text_size = size.tiny)
        table.cell(status, 2, 0, wrText,  bgcolor = wrLong ? color.new(colorBull, 70) : wrShort ? color.new(colorBear, 70) : colorNeutral, text_color = color.white, text_size = size.tiny)
        table.cell(status, 3, 0, exText,  bgcolor = expansionOK ? color.new(color.orange, 70) : colorNeutral, text_color = color.white, text_size = size.tiny)
        table.cell(status, 4, 0, oscText, bgcolor = fusionSm >= 75 ? color.new(colorBull, 65) : fusionSm <= 25 ? color.new(colorBear, 65) : color.new(color.gray, 75), text_color = color.white, text_size = size.tiny)
        table.cell(status, 5, 0, sigText, bgcolor = longSetup ? color.new(colorBull, 60) : shortSetup ? color.new(colorBear, 60) : colorNeutral, text_color = color.white, text_size = size.tiny)
    else
        for i = 0 to 5
            table.cell(status, i, 0, "", bgcolor = color.new(color.black, 100), text_color = color.new(color.black, 100))

alertcondition(longEntry, title = "Fusion Core Long", message = "Fusion Core Strategy: long entry on {{ticker}} ({{interval}})")
alertcondition(shortEntry, title = "Fusion Core Short", message = "Fusion Core Strategy: short entry on {{ticker}} ({{interval}})")
alertcondition(longExit, title = "Fusion Core Long Exit", message = "Fusion Core Strategy: long exit on {{ticker}} ({{interval}})")
alertcondition(shortExit, title = "Fusion Core Short Exit", message = "Fusion Core Strategy: short exit on {{ticker}} ({{interval}})")

Overview

Capital41 Fusion Core Strategy executes long trades when the smoothed oscillator crosses above a bullish threshold aligned with the trend, and short trades when it crosses below a bearish threshold. Exits occur when momentum crosses back through the midline, trend fails, or via locked ATR-based stop loss and risk-reward take profit levels set at trade entry. Key settings allow customization of trigger levels, filter lengths, and ATR risk parameters.

Details

Published by

damianpitt on GitHub

Code credit

Capital41 | MIT License, as written in the script's header

Type

Strategy, Pine Script v6

Draws

On the price chart

Category

Trend, Oscillators & momentum, Volatility & bands, Volume

Markets

Crypto, Stocks

Timeframes

M15-H1, H4 and above

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

cryptoindicatorsmarket-structureorder-blockspinescriptsmart-moneytechnical-analysistechnical-analysis-indicatorstradingtradingview

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
EMA lengthint50emaLen
Show EMAbooltrueshowEMA
RSI lengthint14rsiLen
RSI overboughtint65rsiOB
RSI oversoldint35rsiOS
Williams %R lengthint14wrLen
W%R overboughtfloat-20.0wrOB
W%R oversoldfloat-80.0wrOS
Require RSI/W%R turnbooltruerequireTurn
ATR lengthint14atrLen
ATR avg lengthint20atrAvgLen
ATR expansion multiplierfloat1.1atrExpMult
Show all 25 settings
SettingTypeDefaultVariable
Volume SMA lengthint50volLen
Volume multiplierfloat1.0volMult
Require expansion for entriesbooltrueuseExpFilter
Oscillator smoothingint3oscSmooth
Long triggerfloat75.0longTrig
Short triggerfloat25.0shortTrig
Exit midlinefloat50.0exitMid
Use ATR TP/SLbooltrueuseAtrRisk
ATR stop multiplierfloat1.8atrStopMult
Risk-reward targetfloat1.5rrTarget
Show entry markersbooltrueshowSignals
Show setup backgroundbooltrueshowBg
Show status badgebooltrueshowBadge
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.

Similar Pine Scripts

This strategy executes trades on gold based on a confluence of Supertrend, RSI, MACD, Bollinger Bands, and volume spikes. It enters long or short positions when trend direction aligns with momentum and price positioning relative to volatility bands, filtered b

Strategy v6 TrendOscillators & momentum
Updated 1 year ago · None stated GitHub repository of XAUUSD High Probability Strategy

Parabolic SAR

by g-moe
3 stars

This strategy overlays a smoothed moving average on price and combines it with Aroon, Chaikin Money Flow and a Chaikin oscillator to define long and short conditions. Relative Vigor Index and Parabolic SAR values are calculated for exits. Entries can be limite

Strategy v5 TrendOscillators & momentum
Updated 5 months ago · None stated GitHub repository of Parabolic SAR
2 stars

This strategy calculates MACD, ADX trend strength, ATR, and a rolling VWAP resetting at fixed bar intervals. It plots the VWAP line, stop loss levels, and profit targets directly on the price chart. Long positions enter when MACD crosses above its signal line

Strategy v5 TrendOscillators & momentum Repaints
Updated 8 months ago · MIT GitHub repository of MACD & VWAP Strategy with ATR SL/Targets

This strategy generates trade entries by combining up to five normalized 0-100 technical indicators: Relative Strength Index (RSI with divergence detection), Stochastic RSI, Money Flow Index (MFI), Relative Volatility Index (RVI), and Average Directional Index

Strategy v5 Oscillators & momentumVolatility & bands
Updated 1 year ago · None stated GitHub repository of TLC 0TO100 Five Indicators Strategy

12-BB

by sam30606
1 stars

This overlay strategy combines a Bollinger-style band with separate ATR upper and lower envelopes and optional ADX, Volume Flow Indicator, and RSI filters. It sizes positions as a percentage of equity. Settings change band length and multiplier, ATR periods an

Strategy v5 TrendOscillators & momentum
Updated 3 years ago · None stated GitHub repository of 12-BB

More strategys

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers