Indicator · Pine Script v4 · Own pane

Derivative Oscillator

by everget

The Derivative Oscillator calculates a double-exponentially smoothed Relative Strength Index (RSI) and subtracts its Simple Moving Average (SMA) to form the main oscillator line.

View on GitHub

GitHub stars948on the repository
Pine versionv4older, still runs
Lines of code19
Settings6inputs
LicenceGPL-3.0
Last update10 days ago18 Oct 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 indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

19 lines of Pine Script v4 from oscillators/derivative_oscillator.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.

derivative_oscillator.pine
//@version=4
// Copyright (c) 2018-present, Alex Orekhov (everget)
// Derivative Oscillator script may be freely distributed under the terms of GPL-3.0 license.
study("Derivative Oscillator", shorttitle="DOSC")

rsiLength = input(title="RSI Length", type=input.integer, defval=14)
ema1Length = input(title="1st EMA Smoothing Length", type=input.integer, defval=5)
ema2Length = input(title="2nd EMA Smoothing Length", type=input.integer, defval=3)
smaLength = input(title="3rd SMA Smoothing Length", type=input.integer, defval=9)
signalLength = input(title="Signal Length", type=input.integer, defval=9)
src = input(title="Source", type=input.source, defval=close)

smoothedRSI = ema(ema(rsi(src, rsiLength), ema1Length), ema2Length)
dosc = smoothedRSI - sma(smoothedRSI, smaLength)
signal = sma(dosc, signalLength)

doscColor = dosc >= 0 ? dosc[1] < dosc ? #26A69A : #B2DFDB : dosc[1] < dosc ? #FFCDD2 : #EF5350
plot(dosc, title="DOSC", style=plot.style_columns, linewidth=2, color=doscColor, transp=0)
plot(signal, title="Signal", linewidth=2, color=color.black, transp=0)

Overview

A secondary signal line is plotted using an SMA of the main oscillator values. The script draws a colored histogram in a separate pane, where bar colors shift depending on whether momentum is accelerating above or below the zero center line. Users can adjust the RSI calculation period, both EMA smoothing lengths, the oscillator SMA length, signal length, and input source.

Details

Published by

everget on GitHub

Type

Indicator, Pine Script v4

Draws

Separate pane below the chart

Category

Oscillators & momentum, Moving averages

Markets

Any symbol

Timeframes

Any timeframe

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

pinepinescripttechnical-indicatorsindicatorsoscillatorbandsaveragetradingviewindicatormoving-average

Settings

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

SettingTypeDefaultVariable
RSI Lengthint14rsiLength
1st EMA Smoothing Lengthint5ema1Length
2nd EMA Smoothing Lengthint3ema2Length
3rd SMA Smoothing Lengthint9smaLength
Signal Lengthint9signalLength
Sourcesourceclosesrc
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

Beep Boop

by magic8bot
409 stars

This indicator calculates a modified MACD oscillator and signal line alongside a trend EMA filter, plotting the output as a stylized column histogram in a separate pane. Instead of plotting true MACD distance, it quantifies positive and negative histogram mome

Indicator v4 Oscillators & momentumTrend
Updated 3 years ago · MIT GitHub repository of Beep Boop

MACD

by Alorse
330 stars

This indicator calculates and plots the standard Moving Average Convergence Divergence oscillator in a separate pane. It computes the difference between a fast and slow moving average, derives a signal line through smoothing, and plots a histogram representing

Indicator v4 Oscillators & momentumMoving averages
Updated 2 months ago · None stated GitHub repository of MACD

MACD-V

by harryguiacorn
219 stars

MACD-V is a volatility-normalized momentum indicator based on research by Alex Spiroglou. It calculates the standard MACD histogram and normalizes it by dividing by the Average True Range (ATR). Plotted in a separate pane as a colored histogram, it includes us

Indicator v5 Oscillators & momentumVolatility & bands
Updated 1 year ago · None stated GitHub repository of MACD-V
218 stars

Multi-Timeframe Analysis Suite calculates trend direction and momentum conditions across five user-selected timeframes using moving averages, RSI, and Stochastic oscillators. It evaluates moving average slope and oscillator levels to compute trend alignment, m

Indicator v6 Screeners & dashboardsTrend
Updated 3 months ago · None stated GitHub repository of Multi-Timeframe Analysis Suite

KamaFama

by Mastaaa1987
141 stars

KamaFama is an indicator that translates a Freqtrade trading strategy into Pine Script for visualization. It combines Kaufman Adaptive Moving Average (KAMA), MAMA/FAMA calculations derived via Hilbert Transform, Williams %R, and correlation trend filters to ev

Indicator v6 Moving averagesOscillators & momentum
Updated 6 weeks ago · MIT GitHub repository of KamaFama

Aggregate Signal (v.2)

by capissimo
114 stars

Aggregate Signal (v.2) is an oscillator indicator that combines multiple technical factors into a single composite score. It scales OHLCV data using minimax normalization and evaluates indicators such as MACD, RSI, Stochastic, CCI, Momentum, On-Balance Volume,

Indicator v4 Oscillators & momentumMoving averages Repaints
Updated 1 year ago · None stated GitHub repository of Aggregate Signal (v.2)

More indicators

Trade Your Charts With a Regulated Broker

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

Compare brokers