Prompt brief
ThinkScript · one source file
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.
price-channel guide
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
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.
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.
Reference points
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.
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.
Suppose the preceding three highs are 100, 102, and 101, and the current bar reaches 104 and closes at 103. The prior upper channel is 102, so both high-above and close-above conditions are true. A channel including the current bar rises to 104, making close > current upper false. These are hypothetical arithmetic checks, not strategy results.
The official Highest example excludes the current bar with high[1] and low[1]. The built-in PriceChannel also has a displacement input; positive displacement draws into the past. Keep displacement at zero when auditing when a threshold became available, and do not confuse a shifted display with an earlier signal.
Pineify thinkScript workflow
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.
In thinkorswim desktop, add a thinkScript strategy to a chart, choose the symbol, aggregation, loaded history, and trade size, then right-click a strategy arrow and choose Show Report. Inspect the AddOrder price and timing rules. Record commission and slippage assumptions separately; do not assume the native report has deducted them.
Read guideA reviewable thinkorswim Supertrend study needs a stated price basis, ATR length, ATR smoothing method, multiplier, final-band rules, and state transition condition. thinkScript provides true-range and moving-average building blocks, but the exact Supertrend formula should be written down rather than inferred from the name.
Read guideA thinkorswim support and resistance indicator can use prior session highs and lows, pivot formulas, rolling channels, or confirmed swing points. Choose one method and define its parameters. Combining every method without labels creates ambiguous levels and makes the result difficult to test.
Read guideLast 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 its target platform before relying on its output.
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.
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.
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.
Generate one editable thinkScript study or strategy, inspect the source, request focused changes, and complete the final check in thinkorswim.
Pineify generates source code. Review its syntax and chart behavior in thinkorswim before use.