pine-scripts

CASOON Open Source

Indicators that check their data before they read it.

pine-scripts is a collection of TradingView indicators and strategies in Pine Script v6: market structure, trend, momentum and confluence. Each script is reviewed for whether its inputs carry a signal on the instrument it runs on, not only for whether its maths is correct.

MITPine Script v6TradingView

Indicator indexDocumentation

pivot_momentum_structure.pinePine Script v6
//@version=6
// ============================================================================
// Pivot Momentum Structure [WavesUnchained]
// Version: 2.9.0
// Author: WavesUnchained
// Build: 2026-09-08
// ============================================================================
// Structure-oriented oscillator:
//
//   ✓ Selectable RSI, WaveTrend, Stochastic RSI, CCI, Fisher Transform, TSI,
//     Williams %R, CMO, or MFI (the only volume-based source)
//   ✓ Price pivots are the authoritative structural anchors
//   ✓ HH / HL / LH / LL classification from confirmed price pivots (ATR-tolerant on price)
//   ✓ Divergence/confirmation anchor is scored (recency, oscillator rate-of-change,
//     extreme-zone context, price distinctness) across a window of recent pivots,
//     not just the nearest qualifying one
//   ✓ Optional local-oscillator-extreme anchor mode (reduces price/oscillator pivot mistiming)
//   ✓ Regular bullish / bearish divergence
//   ✓ Hidden bullish / bearish divergence
//   ✓ Momentum alignment (structure agreement, distinct from divergence)
//   ✓ Structure presets (Scalping / Intraday / Swing / Position / Major Structure / Custom)
//   ✓ Oscillator-difference filter: reference-range %, standard deviation, or off
//   ✓ Optional oscillator and price divergence lines
//   ✓ Optional price-pivot labels on the main chart
//   ✓ Dashboard with pivot type and event age
//   ✓ Drawing-object retention limits
//   ✓ Alert conditions
//
// Important:
// Pivots require right-side confirmation bars. Signals are therefore confirmed
// only after `Pivot right bars`, but are drawn back on the original pivot bar.
//
// Data Contract:
//   Price:     REQUIRED   chart symbol
//   Volume:    OPTIONAL   only for the MFI source — inactive without real trade volume
//   OI:        NO
//   Reference: NO
//   Verdict:   CFD-degraded
// ============================================================================
indicator directories, each with its own page
95
indicator scripts (.pine)
109
scripts with a declared Data Contract so far
40
scripts published on TradingView
6

What it does

  1. Data before maths

    Whether volume is trade volume comes from <code>syminfo.volumetype</code>, not from the existence of a <code>volume</code> series. Without it, volume parts switch off visibly and the remaining weights are renormalised.

  2. A Data Contract in the header

    Scripts state which data they need — price, volume, open interest, a reference market — and a verdict: <code>CFD-degraded</code>, <code>Reference-required</code> or <code>Exchange-only</code>.

  3. One role per indicator

    An indicator measures one thing: structure, trend strength, exhaustion. Composite indicators combine roles explicitly and show which part drives the reading.

  4. Alerts that keep working

    Named conditions with stable titles and codes, one message format, and a bar-close gate so an alert does not fire on a forming bar and vanish.

  5. 7 strategy wrappers

    Standalone strategies for the Strategy Tester, with confirmed-bar entries and a guard that warns on Heikin Ashi, Renko and other synthetic chart types.

Quickstart

From choosing an indicator to a first alert. The walkthrough in the documentation covers each step.

  1. Pick an indicator by the question you want answered, from the index or the sidebar.
  2. Check its data requirements: the Data Contract in the header, or the README.
  3. Paste the .pine file into the Pine Editor, or add the published version on TradingView.
  4. Create an alert from its named conditions; messages carry a stable code per indicator.
Alert message formattext
<code> · <event> · {{ticker}} {{interval}}

CPM4 · WATCH LONG · {{ticker}} {{interval}}
CPM4 · LONG · {{ticker}} {{interval}}