Indicator · Pine Script v5 · On the chart

TD Sequential 9/13

by zhuzp98· code credited to rhapsodyz

This indicator tracks DeMark's TD Sequential 9 and 13 setup and countdown conditions directly on the price chart.

View on GitHub

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code49
Settings0inputs
LicenceNone statedfile: MPL-2.0
Last update1 year ago17 Jan 2025

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

49 lines of Pine Script v5 from PineScript/Ind_TD_One.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

Ind_TD_One.pine
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © rhapsodyz

//@version=5
indicator("TD Sequential 9/13", shorttitle="TD", overlay=true)

// Function to calculate TD Setup
tdSetup() =>
    var int setupCount = 0
    var int setupDirection = 0
    if close > close[4]
        if setupDirection != 1
            setupCount := 1
            setupDirection := 1
        else
            setupCount += 1
    else if close < close[4]
        if setupDirection != -1
            setupCount := -1
            setupDirection := -1
        else
            setupCount -= 1
    else
        setupCount := 0
    [setupCount, setupDirection]


// Function to calculate TD Countdown
tdCountdown(setupCount, setupDirection) =>
    var int countdown = 0
    if math.abs(setupCount) == 9
        for i = 1 to 13
            if setupDirection > 0 and low < low[2]
                countdown += 1
            else if setupDirection < 0 and high > high[2]
                countdown += 1
            if countdown >= 13
                break
    countdown

// Calculating TD Setup and TD Countdown
[setup, direction] = tdSetup()
countdown = tdCountdown(setup, direction)

// Plotting
plotshape(series=countdown == 9 and direction > 0, location=location.abovebar, color=color.red, style=shape.labelup, text="9D")
plotshape(series=countdown == 9 and direction < 0, location=location.belowbar, color=color.green, style=shape.labeldown, text="9U")
plotshape(series=countdown == 13 and direction > 0, location=location.abovebar, color=color.purple, style=shape.labelup, text="13D")
plotshape(series=countdown == 13 and direction < 0, location=location.belowbar, color=color.blue, style=shape.labelup, text="13U")

Overview

TD Sequential 9/13 compares the current close price to the close four bars prior to determine setup counts, switching direction when price crosses. When setup or countdown thresholds reach 9 or 13, it plots shape labels above or below the bar to highlight potential exhaustion points. The script runs automatically with standard default calculations and offers no customizable input parameters.

Details

Published by

zhuzp98 on GitHub

Code credit

rhapsodyz, as written in the script's header

Draws

On the price chart

Markets

Crypto

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.

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

PivotHighLow

by Alorse
330 stars

This indicator calculates pivot high and pivot low points on the price chart based on configurable left and right bar counts. Confirmed pivot highs and lows are plotted with negative bar offsets directly on the price chart using line and cross styles. Addition

Indicator v4 Support & resistanceOscillators & momentum Repaints
Updated 2 months ago · None stated GitHub repository of PivotHighLow
114 stars

This indicator calculates key support and resistance levels by analyzing the first and second momentum derivatives of a Double Exponential Moving Average (DEMA). When the second derivative (momentum of momentum) crosses zero, it identifies local turning points

Indicator v4 Support & resistanceOscillators & momentum
Updated 1 year ago · None stated GitHub repository of Support and Resistance Levels

Moon Dev Lunar Sniper

by moondevonyt
92 stars

Moon Dev Lunar Sniper is a multi-indicator overlay that scores confluence across fast and slow EMAs, RSI, MACD, DMI, and BB width to fire signals only when score meets the minimum threshold. It plots buy and sell signals on the price chart, highlights cosmic b

Indicator v6 TrendOscillators & momentum Repaints
Updated 2 months ago · Custom licence GitHub repository of Moon Dev Lunar Sniper
23 stars

This indicator collection calculates and plots previous daily high and low price levels on the chart to identify potential supply and demand zones. It includes real-time intraday high and low calculations, RSI divergence detection across a customizable period

Indicator v4 Support & resistanceDivergence
Updated 3 years ago · None stated GitHub repository of Daily High and Low Strategy
14 stars

Self-Aware Trend System calculates volatility-adaptive ATR trailing bands using a Trend Quality Index engine that evaluates market efficiency, momentum persistence, and structural pivots. It plots adaptive trend bands and character-flip trend signals directly

Indicator v6 TrendVolatility & bands
Updated 3 weeks ago · MIT GitHub repository of Self-Aware Trend System [WillyAlgoTrader]

More Oscillators & momentum scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

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

Compare brokers