Intelligent Hindenburg Omen For ThinkOrSwim

Popeious

New member

Intelligent Hindenburg Omen (w/ Signal Cancellation)​

Purpose​

Built a ThinkorSwim study to identify and monitor Classic Hindenburg Omen conditions, while making the signal logic transparent, configurable, and historically testable. (and to also refute the Twitter DoomSayers using this signal as a fear-fud-sell-crash indicator)
1787437923766.png

Core Signal — 5 Conditions​

A Raw Signal occurs only when all five conditions pass:
  1. New Highs ≥ 2.2% of NYSE issues
  2. New Lows ≥ 2.2% of NYSE issues
  3. High/Low ratio ≤ 2.0
  4. Market Trend is positive
  5. McClellan Oscillator < 0
This produces a strict 5/5 Raw Signal rather than treating individual conditions as an omen.
( Finds the exact five-condition + NYA trend + 36-bar confirmation implementation )

Trend Modes​

Two user-selectable approaches:
  • Classic — NYSE Composite (NYA) > its 50-day moving average
  • Symbol Specific — current chart symbol > its 50-day moving average (intended for use on /ES, SPX, SPY; /NQ, NDX, QQQ, /RTY, RUT, IWM, or NYA)
This allows comparison of the traditional NYSE-wide interpretation against the trend of SPY, NYA, etc.


Signal / Confirmation Engine​

36-bar confirmation model

Initial H.Omen
First qualifying Raw Signal after the previous cluster expires.

Confirmed H.Omen
A subsequent Raw Signal occurs within 36 bars.

Continuation
Additional Raw Signals remain part of the same cluster but do not create additional Confirmed signals.

This specifically solved the original problem of the study producing far too many bubbles.


Display / Diagnostics​

Current study supports:
  • Full historical signal display
  • Current-only signal display
  • Last-N-bars signal display
  • Debug mode
  • Initial signal/Confirmed signal arrows
  • Initial signal/Confirmed signal chart bubbles
  • Background highlighting
  • Score 0–5
  • Current McClellan Oscillator value
  • Cluster state
  • Raw triggers (cluster) within the latest confirmed signal: X / 36 bars
  • Classic vs. Symbol-specific trend mode

Raw Signal (Trigger) Visualization​

Added optional individual Raw Signal dots:
  • None
  • Current Confirmed
  • All
The dot color is user selectable, with white as the default.

This gives us a clean trading view while also providing a powerful historical research/debugging view.

Backtesting​

Backtested against notable, documented, and often referenced market events:
Code:
Oct 1987     Black Monday / historic market crash - Investopedia
2008            Global Financial Crisis / major bear market - Investopedia
Sept 2018   Major Hindenburg Omen cluster preceding 2018 year-end selloff - MarketWatch / SentimenTrader
Mar 2021    Hindenburg Omen appeared during post-COVID recovery / rising market - StockCharts / David Keller
Jan 2022     Signaled elevated downside risk before the 2022 bear market - StockCharts / David Keller
Feb 2024    Initial Omen amid record-high S&P 500 - StockCharts / David Keller
May 2024   Second 2024 initial signal; renewed warning of potential correction - StockCharts / David Keller
Dec 2024   Confirmed/major 2024 Omen; first major confirmed signal in ~3 years - StockCharts / David Keller
Feb 2024   Contemporary confirmation/reporting of bearish signal - Benzinga
May 2024  Contemporary reporting of Omen trigger - InvestorPlace


Reference:
https://usethinkscript.com/threads/...ncellation-for-thinkorswim.20207/#post-149478

Screen Samples​

1787437953957.png
1787441466935.png
1787441475021.png
1787441480925.png
1787441486011.png


1787437923766.png



1787437943047.png


Code:
#=====================================================================
#
# Classic Hindenburg Omen
# 2026.08.22 - Developed by Popeious in cooperation with CHATgpt
#   Developed using the CLASSIC definition and methods
#   Incorporated Omen cancellation concepts from  https://usethinkscript.com/threads/hindenburg-omen-with-mcclellan-cancellation-for-thinkorswim.20207/#post-149478
#
# Version 1.6
#
# Backtested against historical, documented, and noteworthy Hindenberg Omen alignments to market events
#   Oct 1987    Black Monday / historic market crash    (Investopedia)
#   2008    Global Financial Crisis / major bear market    (Investopedia)
#   Sept 2018    Major Hindenburg Omen cluster preceding 2018 year-end selloff    (MarketWatch / SentimenTrader)
#   Mar 2021    Hindenburg Omen appeared during post-COVID recovery / rising market    ( StockCharts / David Keller )
#   Jan 2022    Signaled elevated downside risk before the 2022 bear market    ( StockCharts / David Keller )
#   Feb 2024    Initial Omen amid record-high S&P 500    ( StockCharts / David Keller )
#   May 2024    Second 2024 initial signal; renewed warning of potential correction    ( StockCharts / David Keller )
#   Dec 2024    Confirmed/major 2024 Omen; first major confirmed signal in ~3 years    ( StockCharts / David Keller )
#   Feb 2024    Contemporary confirmation/reporting of bearish signal    ( Benzinga )
#   May 2024    Contemporary reporting of Omen trigger    ( InvestorPlace )
#
# Why? Because so many people toss this around like its some kind of 'predictor' or 'sell signal'...
# ... AND ITS NOT!  But.. they only way to see IF, WHEN, or WHY.. is to have a powerful clean, easy to visualize tool.
# ... CONTEXT is EVERYTHING... a signal, or a trigger, or a cluster of triggers alone.. is irrelevant.
#
# This is intended to be used on a DAILY aggregation; so, 20y1d, 10y1d, 5y1d, 1y1d, 6m1d, 3m1d (not 10y1week or 10y1month)
#
#
#
# TREND MODE:
#
#   Classic
#       Uses NYSE Composite (NYA)
#
#       NYA > 50-day NYA average
#
#   SymbolSpecific
#       Uses current chart symbol
#
#       Close > 50-day current-symbol average
#
# CONFIRMATION:
#
#   Initial RawSignal
#       First qualifying signal after previous cluster expires
#
#   Confirmed RawSignal
#       First subsequent RawSignal within ConfirmationBars
#
#   Additional RawSignals
#       Remain part of the same cluster
#       but do NOT generate additional Confirmed signals
#
# MCCLELLAN CANCELLATION:
#
#   None
#       No cancellation logic.
#
#   Intraday
#       Cancellation occurs when McClellan becomes positive
#       after a confirmed Hindenburg.
#
#   Closing
#       Cancellation occurs when McClellan closes positive
#       after a confirmed Hindenburg.
#
# IMPORTANT:
#
#   Cancellation NEVER creates an Initial or Confirmed signal.
#
#   Cancellation only terminates an already-confirmed cluster.
#
# RAW SIGNAL DISPLAY:
#
#   None
#       No individual Raw Signal markers (triggers)
#
#   CurrentConfirmed
#       Shows Raw Signals (triggers) belonging to the current confirmed cluster
#
#   All
#       Shows all Raw Signals (triggers) historically
#
#=====================================================================

declare upper;

#=====================================================================
# INPUTS
#=====================================================================

#=====================================================================
# TREND MODE
#=====================================================================

input TrendMode =
{
    default Classic,
    SymbolSpecific
};

input ConfirmationBars = 36;
input HistoryBars = 90;

#=====================================================================
# DISPLAY MODE
#=====================================================================

input DisplayMode =
{
    default FullHistory,
    CurrentOnly,
    LastNBars,
    Debug
};

input BreadthThreshold = 2.2;
input MaxHighLowRatio = 2.0;

input EnableInitialAlert = yes;
input EnableConfirmedAlert = yes;

input ShowLabels = yes;
input ShowBackground = yes;
input ShowInitialSignals = yes;
input ShowConfirmedSignals = yes;
input ShowChartBubbles = yes;

#=====================================================================
# MCCLELLAN CANCELLATION
#=====================================================================

input McClellanCancellation =
{
    default None,
    Intraday,
    Closing
};

#=====================================================================
# RAW SIGNAL DISPLAY
#=====================================================================

input RawSignalDisplay =
{
    default None,
    CurrentConfirmed,
    All
};

input RawSignalDotColor =
{
    default White,
    Yellow,
    Cyan,
    Green,
    Orange,
    Red,
    Magenta,
    Gray
};

#=====================================================================
# NYMO / MCCLELLAN DEFINITION
#=====================================================================

input RatioAdjustedMcClellan = yes;

input TrendLength = 50;

input FastLength = 19;
input SlowLength = 39;

#=====================================================================
# NYSE MARKET INTERNALS
#=====================================================================

def AdvRaw =
    close("$ADVN");

def DecRaw =
    close("$DECN");

def UncRaw =
    close("$UNCN");

def HighRaw =
    close("$NYHGH");

def LowRaw =
    close("$NYLOW");

def AddRaw =
    close("$ADD");

def TickRaw =
    close("$TICK");

def TrinRaw =
    close("$TRIN");

def UpVolRaw =
    close("$UVOL");

def DnVolRaw =
    close("$DVOL");

#=====================================================================
# HOLD PREVIOUS VALUE WHEN DATA IS UNAVAILABLE
#=====================================================================

def Adv =
    if IsNaN(AdvRaw)
    then Adv[1]
    else AdvRaw;

def Dec =
    if IsNaN(DecRaw)
    then Dec[1]
    else DecRaw;

def Unc =
    if IsNaN(UncRaw)
    then Unc[1]
    else UncRaw;

def NewHigh =
    if IsNaN(HighRaw)
    then NewHigh[1]
    else HighRaw;

def NewLow =
    if IsNaN(LowRaw)
    then NewLow[1]
    else LowRaw;

def AddLine =
    if IsNaN(AddRaw)
    then AddLine[1]
    else AddRaw;

def Tick =
    if IsNaN(TickRaw)
    then Tick[1]
    else TickRaw;

def Trin =
    if IsNaN(TrinRaw)
    then Trin[1]
    else TrinRaw;

def UpVol =
    if IsNaN(UpVolRaw)
    then UpVol[1]
    else UpVolRaw;

def DnVol =
    if IsNaN(DnVolRaw)
    then DnVol[1]
    else DnVolRaw;

#=====================================================================
# DERIVED VALUES
#=====================================================================

def TotalIssues =
    Adv + Dec + Unc;

def HighPercent =
    if TotalIssues > 0
    then 100 * NewHigh / TotalIssues
    else 0;

def LowPercent =
    if TotalIssues > 0
    then 100 * NewLow / TotalIssues
    else 0;

def HighLowRatio =
    if Min(NewHigh, NewLow) > 0
    then Max(NewHigh, NewLow) / Min(NewHigh, NewLow)
    else 999;

#=====================================================================
# MCCLELLAN OSCILLATOR
#=====================================================================

def BreadthDifference =
    Adv - Dec;

def BreadthRatio =
    if (Adv + Dec) > 0
    then 1000 * BreadthDifference / (Adv + Dec)
    else 0;

def McClellanInput =
    if RatioAdjustedMcClellan
    then BreadthRatio
    else BreadthDifference;

def McClellan =
    ExpAverage(
        McClellanInput,
        FastLength
    )
    -
    ExpAverage(
        McClellanInput,
        SlowLength
    );

#=====================================================================
# TREND ENGINE
#
# CLASSIC:
#   NYSE Composite = NYA
#
# SYMBOL SPECIFIC:
#   Current chart symbol
#
#=====================================================================

#---------------------------------------------------------------------
# CLASSIC NYA TREND
#---------------------------------------------------------------------

def NYA =
    close("NYA");

def NYATrendAverage =
    Average(
        NYA,
        TrendLength
    );

def ClassicTrendOK =
    NYA > NYATrendAverage;

#---------------------------------------------------------------------
# SYMBOL-SPECIFIC TREND
#---------------------------------------------------------------------

def SymbolTrendAverage =
    Average(
        close,
        TrendLength
    );

def SymbolTrendOK =
    close > SymbolTrendAverage;

#---------------------------------------------------------------------
# SELECTED TREND
#---------------------------------------------------------------------

def TrendOK =
    if TrendMode == TrendMode.Classic
    then ClassicTrendOK
    else SymbolTrendOK;

#=====================================================================
# CLASSIC CONDITIONS
#=====================================================================

def ConditionHighs =
    HighPercent >= BreadthThreshold;

def ConditionLows =
    LowPercent >= BreadthThreshold;

def ConditionRatio =
    HighLowRatio <= MaxHighLowRatio;

def ConditionTrend =
    TrendOK;

def ConditionMcClellan =
    McClellan < 0;

#=====================================================================
# SCORE ENGINE
#=====================================================================

def ScoreHigh =
    if ConditionHighs
    then 1
    else 0;

def ScoreLow =
    if ConditionLows
    then 1
    else 0;

def ScoreRatio =
    if ConditionRatio
    then 1
    else 0;

def ScoreTrend =
    if ConditionTrend
    then 1
    else 0;

def ScoreMcClellan =
    if ConditionMcClellan
    then 1
    else 0;

def HindenburgScore =
    ScoreHigh
    +
    ScoreLow
    +
    ScoreRatio
    +
    ScoreTrend
    +
    ScoreMcClellan;

#=====================================================================
# RAW SIGNAL
#
# ALL FIVE CONDITIONS MUST PASS
#=====================================================================

def RawSignal =
    ConditionHighs
    and ConditionLows
    and ConditionRatio
    and ConditionTrend
    and ConditionMcClellan;

#=====================================================================
# 36-BAR CONFIRMATION ENGINE
#=====================================================================

def PreviousRawSignal =
    Highest(
        if RawSignal[1]
        then 1
        else 0,
        ConfirmationBars
    ) > 0;

#---------------------------------------------------------------------
# INITIAL SIGNAL
#---------------------------------------------------------------------

def InitialSignal =
    RawSignal
    and
    !PreviousRawSignal;

#---------------------------------------------------------------------
# CLUSTER STATE
#---------------------------------------------------------------------

def ClusterConfirmed =
    CompoundValue(
        1,

        if !PreviousRawSignal
        then 0

        else if RawSignal
        and PreviousRawSignal
        and !ClusterConfirmed[1]
        then 1

        else ClusterConfirmed[1],

        0
    );

#---------------------------------------------------------------------
# CONFIRMED SIGNAL
#
# NOTE:
#
# This remains independent of McClellan cancellation.
#
# Cancellation must NEVER create or alter a ConfirmedSignal.
#---------------------------------------------------------------------

def ConfirmedSignal =
    RawSignal
    and
    PreviousRawSignal
    and
    !ClusterConfirmed[1];

#---------------------------------------------------------------------
# CLUSTER CONTINUATION
#---------------------------------------------------------------------

def ClusterContinuation =
    RawSignal
    and
    ClusterConfirmed[1];

#---------------------------------------------------------------------
# RAW SIGNAL (trigger) COUNT
#---------------------------------------------------------------------

def ClusterCount =
    Sum(
        if RawSignal
        then 1
        else 0,
        ConfirmationBars
    );

#=====================================================================
# MCCLELLAN CANCELLATION ENGINE
#
# IMPORTANT:
#
# Cancellation can ONLY occur after a confirmed Hindenburg.
#
# It does NOT participate in:
#
#   RawSignal
#   InitialSignal
#   ConfirmedSignal
#
# Therefore enabling cancellation cannot create additional
# Initial or Confirmed Hindenburg signals.
#=====================================================================

#---------------------------------------------------------------------
# CANCELLATION CONDITION
#
# For this study McClellan is calculated from the current bar.
#
# Intraday:
#   Current McClellan > 0
#
# Closing:
#   McClellan value at the completed/current bar > 0
#
# On daily charts these are effectively identical.
#---------------------------------------------------------------------

def McClellanPositive =
    McClellan > 0;

#---------------------------------------------------------------------
# CANCELLATION EVENT
#
# Only an ACTIVE confirmed cluster can be cancelled.
#
# ClusterConfirmed[1] ensures the confirmation existed BEFORE
# the cancellation event.
#---------------------------------------------------------------------

def CancellationTrigger =
    McClellanCancellation != McClellanCancellation.None
    and
    ClusterConfirmed[1]
    and
    !McClellanPositive[1]
    and
    McClellanPositive;

#---------------------------------------------------------------------
# CANCELLATION STATE
#
# Once cancelled, remain cancelled until the confirmed cluster
# naturally expires.
#---------------------------------------------------------------------

def ClusterCancelled =
    CompoundValue(
        1,

        if !ClusterConfirmed
        then 0

        else if CancellationTrigger
        then 1

        else ClusterCancelled[1],

        0
    );

#---------------------------------------------------------------------
# NEW CANCELLATION EVENT
#---------------------------------------------------------------------

def NewCancellation =
    CancellationTrigger
    and
    !ClusterCancelled[1];

#=====================================================================
# RAW SIGNAL (trigger) DISPLAY ENGINE
#=====================================================================

def ShowAllRawSignals =
    RawSignalDisplay == RawSignalDisplay.All;

def ShowCurrentConfirmedRawSignals =
    RawSignalDisplay == RawSignalDisplay.CurrentConfirmed;

#---------------------------------------------------------------------
# CURRENT CONFIRMED RAW SIGNAL
#
# Cancellation stops the display of additional dots belonging to
# the cancelled confirmed cluster.
#---------------------------------------------------------------------

def PlotRawSignal =
    RawSignal
    and
    (
        ShowAllRawSignals
        or
        (
            ShowCurrentConfirmedRawSignals
            and
            ClusterConfirmed
            and
            !ClusterCancelled
        )
    );

#=====================================================================
# BAR INFORMATION
#=====================================================================

def CurrentBar =
    BarNumber();

def LastBar =
    HighestAll(CurrentBar);

def InHistoryWindow =
    CurrentBar >= LastBar - HistoryBars;

#=====================================================================
# DISPLAY FILTER
#=====================================================================

def ShowSignal =

    if DisplayMode == DisplayMode.FullHistory
    then yes

    else if DisplayMode == DisplayMode.LastNBars
    then InHistoryWindow

    else if DisplayMode == DisplayMode.Debug
    then yes

    else CurrentBar == LastBar;

#=====================================================================
# RAW SIGNAL DISPLAY FILTER
#=====================================================================

def PlotRawSignalDisplay =

    PlotRawSignal
    and
    ShowSignal;

#=====================================================================
# EDGE DETECTION
#=====================================================================

def NewInitialSignal =
    InitialSignal
    and
    !InitialSignal[1];

def NewConfirmedSignal =
    ConfirmedSignal;

#=====================================================================
# PLOT FLAGS
#=====================================================================

def PlotInitialSignal =
    ShowSignal
    and
    ShowInitialSignals
    and
    InitialSignal;

def PlotConfirmedSignal =
    ShowSignal
    and
    ShowConfirmedSignals
    and
    ConfirmedSignal;

#=====================================================================
# RAW SIGNAL DOT COLOR
#=====================================================================

plot RawSignalDot =

    if PlotRawSignalDisplay
    then low
    else Double.NaN;

RawSignalDot.SetPaintingStrategy(
    PaintingStrategy.POINTS
);

RawSignalDot.SetLineWeight(2);

RawSignalDot.AssignValueColor(

    if RawSignalDotColor == RawSignalDotColor.White
    then Color.WHITE

    else if RawSignalDotColor == RawSignalDotColor.Yellow
    then Color.YELLOW

    else if RawSignalDotColor == RawSignalDotColor.Cyan
    then Color.CYAN

    else if RawSignalDotColor == RawSignalDotColor.Green
    then Color.GREEN

    else if RawSignalDotColor == RawSignalDotColor.Orange
    then Color.ORANGE

    else if RawSignalDotColor == RawSignalDotColor.Red
    then Color.RED

    else if RawSignalDotColor == RawSignalDotColor.Magenta
    then Color.MAGENTA

    else Color.GRAY

);

#=====================================================================
# INITIAL ARROW
#=====================================================================

plot InitialArrow =

    if PlotInitialSignal
    then low
    else Double.NaN;

InitialArrow.SetPaintingStrategy(
    PaintingStrategy.ARROW_UP
);

InitialArrow.SetDefaultColor(
    Color.ORANGE
);

InitialArrow.SetLineWeight(3);

#=====================================================================
# CONFIRMED ARROW
#=====================================================================

plot ConfirmedArrow =

    if PlotConfirmedSignal
    then low
    else Double.NaN;

ConfirmedArrow.SetPaintingStrategy(
    PaintingStrategy.ARROW_UP
);

ConfirmedArrow.SetDefaultColor(
    Color.RED
);

ConfirmedArrow.SetLineWeight(5);

#=====================================================================
# BACKGROUND
#=====================================================================

AssignBackgroundColor(

    if !ShowBackground
    then Color.CURRENT

    else if PlotConfirmedSignal
    then CreateColor(90,0,0)

    else if PlotInitialSignal
    then CreateColor(70,40,0)

    else Color.CURRENT

);

#=====================================================================
# CHART BUBBLES
#
# HINDENBURG SIGNALS
#=====================================================================

AddChartBubble(

    ShowChartBubbles
    and
    (PlotInitialSignal or PlotConfirmedSignal),

    low,

    if PlotConfirmedSignal
    then "Confirmed H.Omen"
    else "Initial H.Omen",

    if PlotConfirmedSignal
    then Color.RED
    else Color.ORANGE,

    no

);

#=====================================================================
# CANCELLATION BUBBLE
#=====================================================================

AddChartBubble(

    ShowChartBubbles
    and
    ShowSignal
    and
    NewCancellation,

    high,

    "Cancelled H.Omen",

    Color.YELLOW,

    yes

);

#=====================================================================
# PRIMARY LABELS
#=====================================================================

#---------------------------------------------------------------------
# TREND MODE
#---------------------------------------------------------------------

AddLabel(

    ShowLabels,

    if TrendMode == TrendMode.Classic
    then "Mode: CLASSIC"
    else "Mode: SYMBOL",

    if TrendMode == TrendMode.Classic
    then Color.CYAN
    else Color.YELLOW

);

#---------------------------------------------------------------------
# SIGNAL STATE
#---------------------------------------------------------------------

AddLabel(

    ShowLabels
    and
    (InitialSignal or ConfirmedSignal),

    if ConfirmedSignal
    then "CONFIRMED HINDENBURG"
    else "INITIAL HINDENBURG",

    if ConfirmedSignal
    then Color.RED
    else Color.ORANGE

);

#---------------------------------------------------------------------
# CANCELLATION STATE
#---------------------------------------------------------------------

AddLabel(

    ShowLabels
    and
    ClusterCancelled,

    "H.Omen: CANCELLED",

    Color.YELLOW

);

#---------------------------------------------------------------------
# SCORE
#---------------------------------------------------------------------

AddLabel(

    ShowLabels,

    "Score: "
    + HindenburgScore
    + " / 5",

    if HindenburgScore == 5
    then Color.GREEN
    else Color.GRAY

);

#---------------------------------------------------------------------
# MCCLELLAN
#---------------------------------------------------------------------

AddLabel(

    ShowLabels,

    "McClellan: "
    + Round(McClellan,1),

    if McClellan < 0
    then Color.GREEN
    else Color.RED

);

#---------------------------------------------------------------------
# CLUSTER STATE
#---------------------------------------------------------------------

AddLabel(

    ShowLabels,

    "State: "
    +
    (
        if ClusterCancelled
        then "CANCELLED"

        else if ClusterConfirmed
        then "CONFIRMED"

        else "WAITING"
    ),

    if ClusterCancelled
    then Color.YELLOW

    else if ClusterConfirmed
    then Color.RED

    else Color.ORANGE

);

#---------------------------------------------------------------------
# RAW SIGNAL COUNT
#---------------------------------------------------------------------

AddLabel(

    ShowLabels,

    "Raw Signals: "
    + ClusterCount
    + " / "
    + ConfirmationBars
    + " bars",

    Color.CYAN

);

#---------------------------------------------------------------------
# CANCELLATION MODE
#---------------------------------------------------------------------

AddLabel(

    ShowLabels
    and
    McClellanCancellation != McClellanCancellation.None,

    "Cancel: "
    +
    (
        if McClellanCancellation == McClellanCancellation.Intraday
        then "INTRADAY"
        else "CLOSING"
    ),

    Color.YELLOW

);

#=====================================================================
# ALERTS
#=====================================================================

Alert(

    EnableInitialAlert
    and
    NewInitialSignal,

    "Initial Hindenburg Omen",

    Alert.BAR,

    Sound.Ding

);

Alert(

    EnableConfirmedAlert
    and
    NewConfirmedSignal,

    "Confirmed Hindenburg Omen",

    Alert.BAR,

    Sound.Bell

);

#=====================================================================
# DEBUG PANEL
#=====================================================================

def DebugMode =
    DisplayMode == DisplayMode.Debug;

AddLabel(

    DebugMode,

    "NYSE Issues: "
    + TotalIssues,

    Color.WHITE

);

AddLabel(

    DebugMode,

    "New Highs: "
    + NewHigh
    + " ("
    + Round(HighPercent,2)
    + "%)",

    if ConditionHighs
    then Color.GREEN
    else Color.RED

);

AddLabel(

    DebugMode,

    "New Lows: "
    + NewLow
    + " ("
    + Round(LowPercent,2)
    + "%)",

    if ConditionLows
    then Color.GREEN
    else Color.RED

);

AddLabel(

    DebugMode,

    "High/Low Ratio: "
    + Round(HighLowRatio,2),

    if ConditionRatio
    then Color.GREEN
    else Color.RED

);

AddLabel(

    DebugMode,

    "Trend: "
    +
    (
        if ConditionTrend
        then "PASS"
        else "FAIL"
    ),

    if ConditionTrend
    then Color.GREEN
    else Color.RED

);

AddLabel(

    DebugMode,

    "McClellan: "
    + Round(McClellan,2),

    if ConditionMcClellan
    then Color.GREEN
    else Color.RED

);

AddLabel(

    DebugMode,

    "Raw Signal: "
    +
    (
        if RawSignal
        then "YES"
        else "NO"
    ),

    if RawSignal
    then Color.GREEN
    else Color.GRAY

);

AddLabel(

    DebugMode,

    "Initial HB: "
    +
    (
        if InitialSignal
        then "YES"
        else "NO"
    ),

    if InitialSignal
    then Color.ORANGE
    else Color.GRAY

);

AddLabel(

    DebugMode,

    "Confirmed HB: "
    +
    (
        if ConfirmedSignal
        then "YES"
        else "NO"
    ),

    if ConfirmedSignal
    then Color.RED
    else Color.GRAY

);

AddLabel(

    DebugMode,

    "Cluster State: "
    +
    (
        if ClusterCancelled
        then "CANCELLED"

        else if ClusterConfirmed
        then "CONFIRMED"

        else "WAITING"
    ),

    if ClusterCancelled
    then Color.YELLOW

    else if ClusterConfirmed
    then Color.RED

    else Color.ORANGE

);

AddLabel(

    DebugMode,

    "Cancellation: "
    +
    (
        if McClellanCancellation == McClellanCancellation.None
        then "NONE"

        else if McClellanCancellation == McClellanCancellation.Intraday
        then "INTRADAY"

        else "CLOSING"
    ),

    Color.YELLOW

);

AddLabel(

    DebugMode,

    "Cancellation Trigger: "
    +
    (
        if NewCancellation
        then "YES"
        else "NO"
    ),

    if NewCancellation
    then Color.YELLOW
    else Color.GRAY

);

AddLabel(

    DebugMode,

    "Raw Signals / "
    + ConfirmationBars
    + " Bars: "
    + ClusterCount,

    Color.CYAN

);

AddLabel(

    DebugMode,

    "Raw Display: "
    +
    (
        if RawSignalDisplay == RawSignalDisplay.None
        then "NONE"

        else if RawSignalDisplay == RawSignalDisplay.CurrentConfirmed
        then "CURRENT CONFIRMED"

        else "ALL"
    ),

    Color.WHITE

);

AddLabel(

    DebugMode,

    "Score = "
    + HindenburgScore,

    Color.YELLOW

);

AddLabel(

    DebugMode,

    "NYA: "
    + Round(NYA,0),

    Color.WHITE

);

AddLabel(

    DebugMode,

    "NYA 50MA: "
    + Round(NYATrendAverage,0),

    Color.WHITE

);

AddLabel(

    DebugMode,

    "Classic NYA Trend: "
    +
    (
        if ClassicTrendOK
        then "PASS"
        else "FAIL"
    ),

    if ClassicTrendOK
    then Color.GREEN
    else Color.RED

);

#=====================================================================
# HIDDEN OUTPUTS
#=====================================================================

plot RawSignalPlot =

    if RawSignal
    then 1
    else 0;

RawSignalPlot.Hide();

plot InitialSignalPlot =

    if InitialSignal
    then 1
    else 0;

InitialSignalPlot.Hide();

plot ConfirmedSignalPlot =

    if ConfirmedSignal
    then 1
    else 0;

ConfirmedSignalPlot.Hide();

plot ScorePlot =
    HindenburgScore;

ScorePlot.Hide();

plot McClellanPlot =
    McClellan;

McClellanPlot.Hide();

#=====================================================================
# END OF STUDY
#=====================================================================
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Thread starter Similar threads Forum Replies Date
F Hindenburg Omen with McClellan Cancellation For ThinkOrSwim Custom 3

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
982 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top