Strategy · Pine Script v5 · Own pane

Chaikin Oscillator - Eterna MCP

by EternaHybridExchange

This strategy calculates the Chaikin Oscillator by taking the difference between fast and slow exponential moving averages of the Accumulation/Distribution line.

View on GitHub

GitHub stars9on the repository
Pine versionv5runs as is
Lines of code99
Settings6inputs
LicenceMIT
Last update7 months ago12 Mar 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

99 lines of Pine Script v5 from strategies/momentum/chaikin_oscillator.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

chaikin_oscillator.pine
//@version=5
strategy("Chaikin Oscillator - Eterna MCP", 
         shorttitle="Chaikin",
         overlay=false,
         default_qty_type=strategy.percent_of_equity,
         default_qty_value=100,
         initial_capital=1000)

// ============================================
// PARAMETERS
// ============================================
fastLength = input.int(3, "Fast EMA Length", minval=1)
slowLength = input.int(10, "Slow EMA Length", minval=1)
signalThreshold = input.float(0, "Signal Threshold", step=0.0001)
divergenceLookback = input.int(5, "Divergence Lookback", minval=3)
leverageSize = input.float(5.0, "Leverage", minval=1, maxval=100)
positionSize = input.float(0.01, "Position Size", minval=0.001, maxval=1)

// ============================================
// ACCUMULATION/DISTRIBUTION LINE
// ============================================
// Money Flow Multiplier
mfm = ((close - low) - (high - close)) / (high - low)
// Money Flow Volume
mfv = mfm * volume
// Accumulation/Distribution Line
ad = ta.cum(mfv)

// ============================================
// CHAIKIN OSCILLATOR CALCULATION
// ============================================
fastEMA = ta.ema(ad, fastLength)
slowEMA = ta.ema(ad, slowLength)
chaikin = fastEMA - slowEMA

// ============================================
// SIGNAL GENERATION
// ============================================
// Zero-line crossovers
bullishCross = ta.crossover(chaikin, signalThreshold)
bearishCross = ta.crossunder(chaikin, signalThreshold)

// Momentum confirmation
bullishMomentum = chaikin > chaikin[1] and chaikin[1] > chaikin[2]
bearishMomentum = chaikin < chaikin[1] and chaikin[1] < chaikin[2]

// Divergence detection
priceLow = ta.lowest(low, divergenceLookback)
priceHigh = ta.highest(high, divergenceLookback)
chaikinLow = ta.lowest(chaikin, divergenceLookback)
chaikinHigh = ta.highest(chaikin, divergenceLookback)

// Bullish divergence: lower price, higher Chaikin
bullishDiv = low == priceLow and chaikin > chaikinLow and chaikin < 0
// Bearish divergence: higher price, lower Chaikin
bearishDiv = high == priceHigh and chaikin < chaikinHigh and chaikin > 0

// Combined entry signals
buySignal = (bullishCross and bullishMomentum) or bullishDiv
sellSignal = (bearishCross and bearishMomentum) or bearishDiv

// ============================================
// STRATEGY LOGIC
// ============================================
if buySignal and strategy.position_size == 0
    strategy.entry("Long", strategy.long)
    alert('{"action":"buy","symbol":"' + syminfo.ticker + '","size":' + str.tostring(positionSize) + ',"leverage":' + str.tostring(leverageSize) + '}', alert.freq_once_per_bar_close)

if sellSignal and strategy.position_size == 0
    strategy.entry("Short", strategy.short)
    alert('{"action":"sell","symbol":"' + syminfo.ticker + '","size":' + str.tostring(positionSize) + ',"leverage":' + str.tostring(leverageSize) + '}', alert.freq_once_per_bar_close)

// Exit on opposite signal
if sellSignal and strategy.position_size > 0
    strategy.close("Long")

if buySignal and strategy.position_size < 0
    strategy.close("Short")

// ============================================
// PLOTTING
// ============================================
plot(chaikin, "Chaikin Oscillator", color=chaikin >= 0 ? color.green : color.red, linewidth=2, style=plot.style_histogram)
hline(signalThreshold, "Zero Line", color=color.gray, linestyle=hline.style_solid, linewidth=2)

// Momentum line overlay
plot(chaikin, "Chaikin Line", color=color.blue, linewidth=1)

// Signals
plotshape(buySignal, "Buy", shape.triangleup, location.bottom, color.green, size=size.normal)
plotshape(sellSignal, "Sell", shape.triangledown, location.top, color.red, size=size.normal)

// Divergence markers
plotshape(bullishDiv, "Bullish Div", shape.diamond, location.bottom, color.lime, size=size.small)
plotshape(bearishDiv, "Bearish Div", shape.diamond, location.top, color.orange, size=size.small)

// Trend background
bgcolor(chaikin > 0 and bullishMomentum ? color.new(color.green, 97) : 
        chaikin < 0 and bearishMomentum ? color.new(color.red, 97) : na)

Overview

Chaikin Oscillator - Eterna MCP generates long and short entries when the oscillator crosses the signal threshold with directional momentum confirmation, or when price and oscillator divergence is detected. Existing positions close on opposite signals. Designed for automated execution, it includes webhook alert payloads for position size and leverage. It plots in a separate pane as a colored histogram. There are no stop-loss or take-profit orders.

Details

Published by

EternaHybridExchange on GitHub

Type

Strategy, Pine Script v5

Draws

Separate pane below the chart

Category

Oscillators & momentum, Volume, Divergence

Markets

Crypto

Timeframes

Any timeframe

Risk Notes

  • The strategy enters trades without a stop loss

Topics

algorithmic-tradingautomated-tradingbacktestingbybitcrypto-tradingeternamcppine-scripttrading-strategiestradingview

Settings

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

SettingTypeDefaultVariable
Fast EMA Lengthint3fastLength
Slow EMA Lengthint10slowLength
Signal Thresholdfloat0signalThreshold
Divergence Lookbackint5divergenceLookback
Leveragefloat5.0leverageSize
Position Sizefloat0.01positionSize
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

330 stars

MACD + Divergences [Alorse] is a momentum strategy that calculates the MACD oscillator and identifies regular and hidden divergences using pivot high and low points. It filters trade signals with dual Exponential Moving Averages (EMA 150 and 600) to ensure tra

Strategy v4 Oscillators & momentumDivergence Repaints
Updated 2 months ago · None stated GitHub repository of MACD + Divergences [Alorse]

Q-Trend + KVO Strategy

by TradersPost
218 stars

This strategy combines the ATR-banded Q-Trend indicator with the Klinger Volume Oscillator (KVO) to execute confluence trades. It enters long when a Q-Trend buy trigger aligns with a positive KVO value and a bullish candle confirmation, taking short trades und

Strategy v6 TrendVolume
Updated 3 months ago · None stated GitHub repository of Q-Trend + KVO Strategy

BBPBΔ(OBV-PVT)BB

by hasnocool
106 stars

This strategy calculates the normalized rate of change between On-Balance Volume (OBV) and Price Volume Trend (PVT) indicators. It applies Bollinger Bands to this volume metric along with a Hodrick-Prescott filter array for time series decomposition. Displayed

Strategy v4 VolumeVolatility & bands
Updated 2 years ago · GPL-3.0 GitHub repository of BBPBΔ(OBV-PVT)BB

BTC Futures MACD

by iamrichardD
57 stars

This strategy plots a MACD oscillator in a separate pane and trades Bitcoin futures from zero-line and signal-line crosses. Optional early momentum signals, a volume filter, and a trend moving-average filter can confirm entries. It sizes positions as fixed con

Strategy v6 Oscillators & momentumMoving averages Repaints
Updated 1 year ago · Apache-2.0 GitHub repository of BTC Futures MACD

RSI-VWAP Indicator

by oguzhandilber
47 stars

This strategy calculates a Relative Strength Index (RSI) applied to the Volume Weighted Average Price (VWAP) rather than standard close values. It plots dedicated long and short RSI-VWAP lines with customizable overbought and oversold thresholds, alongside an

Strategy v4 Oscillators & momentumVolume
Updated 5 years ago · None stated GitHub repository of RSI-VWAP Indicator

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