Technical theory guide

Dow Theory Indicator: Swing Structure and Its Limits

A Dow Theory indicator usually encodes selected trend rules, such as rising peaks and troughs. That is narrower than the historical theory: a single-chart pivot script does not establish primary market phases, compare industrial and transportation averages, or identify institutional buying. The example below labels swings and crossings on the chart symbol.

Define a custom swing tracker

Dow Theory principles and what a script can represent

Dow Theory developed from Charles Dow’s market writing and later interpretations. Its trend and confirmation concepts are an analytical framework, not a guarantee that prices contain all information or that a particular entry will work. Modern SMC terminology should not be presented as a verbatim historical rule.

  • Trend scales: primary trends, secondary reactions, and shorter fluctuations describe different horizons. A fixed pivot length does not automatically assign these economic horizons.
  • Trend sequence: successive rising peaks and troughs describe an uptrend; falling peaks and troughs describe a downtrend. Sideways and mixed sequences need a separate state.
  • Phases: accumulation, participation, and distribution are retrospective descriptions. OHLC candles alone do not identify the owners or motives of trades.
  • Confirmation: the historical comparison concerns industrial and transportation averages. Replacing them with Nasdaq and S&P 500 is a different model that needs its own definition and testing.
  • Volume: comparing activity with direction is one traditional confirmation idea. Low volume does not prove that institutional sellers are absent.
  • Reversal: specify the observations that would change a trend classification. A rule that labels a break is not a forecast of its follow-through.

Manual rules and automated swing tracking

Automation repeats the chosen rule. The choice of lookback, equality handling, session, and timeframe remains a modeling decision; neither manual nor coded analysis removes uncertainty.

DecisionWritten manual processCoded process
Pivot definitionMark a high with a specified number of lower neighboring highsUse fixed left/right pivot lengths and record the later confirmation time
Break definitionChoose wick penetration or a completed close in advanceTest the same condition; a live close can move back before bar completion
AlertsCreate and monitor the relevant alertAn alert call still needs an alert created in TradingView; this example monitors one chart
TimeframeApply the same written rule to each chartThe same bar count represents different elapsed time on 5-minute and daily charts

Pine Script v6 swing-pivot demonstration

This single-chart indicator labels detected pivots and plots crosses of the latest stored high or low. With the default length of 5, a pivot is detected five bars after the pivot bar, then its label is drawn back on that earlier bar. Live pivot candidates and BOS markers can change before the current bar closes. The alert calls use once-per-bar-close frequency, which does not make the plotted markers close-only. Equal highs are labeled LH and equal lows LL by the supplied comparison. The script has no trend-state filter, volume test, phase detection, or second-index confirmation; its BOS name therefore means a level crossing, not a strict continuation classification. Repeated crossings can produce repeated markers. This is an indicator, not a strategy or broker connection.

Single-chart pivot tracker; labels are drawn on earlier pivot barspinescript
//@version=6
indicator("Dow Theory Structure Tracker [Pineify]", overlay=true)

// Pivot sensitivity settings
int swingLength = input.int(5, "Swing Lookback Length", minval=2)

// Find swing highs and lows
float ph = ta.pivothigh(high, swingLength, swingLength)
float pl = ta.pivotlow(low, swingLength, swingLength)

var float prevHigh = na
var float prevLow = na

// Label swing structure
if not na(ph)
    string highLabel = na(prevHigh) ? "H" : (ph > prevHigh ? "HH" : "LH")
    label.new(bar_index[swingLength], ph, highLabel, color=color.new(color.red, 20), textcolor=color.white, style=label.style_label_down, size=size.tiny)
    prevHigh := ph

if not na(pl)
    string lowLabel = na(prevLow) ? "L" : (pl > prevLow ? "HL" : "LL")
    label.new(bar_index[swingLength], pl, lowLabel, color=color.new(color.green, 20), textcolor=color.white, style=label.style_label_up, size=size.tiny)
    prevLow := pl

// Break of structure logic (BOS)
bool bullBOS = not na(prevHigh) and ta.crossover(close, prevHigh)
bool bearBOS = not na(prevLow) and ta.crossunder(close, prevLow)

plotshape(bullBOS, "Bullish BOS", shape.triangleup, location.belowbar, color.green, size=size.small, text="BOS")
plotshape(bearBOS, "Bearish BOS", shape.triangledown, location.abovebar, color.red, size=size.small, text="BOS")

if bullBOS
    alert("Bullish Dow Theory Break of Structure at " + str.tostring(close), alert.freq_once_per_bar_close)
if bearBOS
    alert("Bearish Dow Theory Break of Structure at " + str.tostring(close), alert.freq_once_per_bar_close)

How to evaluate a secondary-reaction rule

A pullback is not inherently the safest entry. If you want to test buying a higher low, specify when that low becomes known and how an order would fill after confirmation.

  • Choose a pivot rule and record both the swing time and detection time. Do not place a hypothetical entry on a pivot bar that was recognizable only later.
  • If adding volume, record the feed and units: exchange share/contract volume differs from broker tick volume and fragmented crypto exchange volume.
  • Define entry, stop, time exit, and costs separately. A stop below a swing can fill worse during gaps; the pivot label does not cap loss.
  • Compare untouched dates and retain failed setups. The supplied indicator has no orders or Strategy Tester performance report.
Where Pineify fits

Pine Script AI Coding Agent

Draft a swing tracker from written pivot, confirmation, and alert rules. Compile and inspect the generated script; code generation does not establish a trading edge. Access and usage depend on your plan.

Also useful: Visual Pine Script Editor. Build indicator or strategy conditions from supported components, then inspect their generated Pine Script and chart behavior.

Define a custom swing tracker

Frequently asked questions

Educational purposes only, not financial or investment advice. Dow Theory indicators evaluate historical structural swing points. Market conditions can violate historical patterns during extreme volatility. Always employ sound risk management.

Sources and verification