price-channel guide

Donchian Channel for thinkorswim

A Donchian channel tracks the highest high and lowest low over stated lookbacks. The key strategy decision is whether a breakout compares with a channel that includes the current bar or with the completed prior channel.

Source review completed

Prompt brief

ThinkScript · one source file

Review in thinkorswim

Example request

Create a thinkorswim Donchian upper study with configurable entry and exit lengths, prior-bar breakout markers, a midpoint, and alerts that fire only on new completed-bar breakouts.

Editable sourceFocused revisionsNative editor check

Direct answer

For a basic thinkorswim Donchian channel, plot Highest(high, length) and Lowest(low, length), with an optional midpoint. For breakout logic, compare the current bar with the prior channel value so the current high or low does not move the threshold at the same time. Use separate entry and exit lengths if that is part of the rule.

What to know first

  • Channel lookback and strategy entry-exit lookbacks may differ.
  • Current-bar inclusion can make a breakout comparison self-referential.
  • A channel marks recent extremes; it does not define risk or position size.

Reference points

Keep the calculation explicit

Upper channel
The highest high over the selected lookback.
Lower channel
The lowest low over the selected lookback.
Midline
An optional average of the upper and lower channel values.
Prior threshold
The completed previous channel value used for a non-self-referential breakout test.

Indicator and strategy versions serve different jobs

A PriceChannel-style study displays recent high and low bounds. A Donchian strategy adds rules for simulated entries and exits, and may use different lengths depending on position state.

Do not assume the visual channel’s current value is automatically the correct strategy threshold. Write the order condition with its intended offset.

Review the first breakout manually

Choose a visible bar where price exceeds the preceding lookback high. Confirm the previous upper channel, current high or close used by the rule, and the exact bar on which the marker or simulated order appears.

Pineify can build either a study or strategy, but the requested type, offset, order behavior, and exit rules must be explicit.

Pineify thinkScript workflow

Turn the specification into editable thinkScript

Give the Coding Agent the formula, inputs, plots, alerts, and edge cases. It returns one editable study or strategy file and keeps focused revisions in the same code artifact.

Open the thinkScript agent

Sources and scope

Last verified:

Pineify provides information and code-generation assistance, not investment advice. Generated scripts, strategy reports, simulations, and historical examples cannot predict prices or guarantee returns. Review every script and test it in thinkorswim before relying on its output.

Frequently asked questions

Does thinkorswim have a Donchian Channel?

The Learning Center documents PriceChannel as a channel study and Donchian as a strategy. Custom thinkScript can also plot highest-high and lowest-low channels with stated rules.

Why should a breakout use the prior channel?

If the current bar is included, its own high or low can move the threshold being tested. Referencing the prior completed channel keeps the trigger based on information available before the breakout bar.

Can Pineify create a Donchian strategy?

Yes. Define entry and exit lengths, price comparisons, order direction, repeated-entry behavior, and any filters. Run the result as a simulated strategy in thinkorswim.

Continue in the thinkScript coding workspace

Generate one editable thinkScript study or strategy, inspect the source, request focused changes, and complete the final check in thinkorswim.

Pineify generates source code. thinkorswim remains the platform authority for parsing and chart behavior.