The idea
This is Chart0bserver's open-source strategy, published as "DMI Toolbox Strategy" (short title "DMI Toolbox"). It uses J. Welles Wilder's directional movement: +DI for upside direction, -DI for downside direction, and ADX for trend strength, then adds a further smoothing layer on each. The inputs offer many optional entry patterns; only a handful are enabled in the defaults.
It is long-only. Before an entry, the script first requires an active bullish pattern: +DI has crossed above smoothed -DI and has not crossed back below, and no more than 150 bars have passed since that cross. Close must also be above the 200-period simple average, and volume above its own 21-period average. When those gates are open, either of two default triggers may start a long: +DI crossing 30, or smoothed ADX crossing smoothed -DI. The default exit is ADX crossing back under smoothed ADX while ADX itself is still above 38, plus a 2.5% stop based on open strategy profit. The author's chart is CRYPTO:BTCUSD, 1-hour. The strategy sets calc_on_every_tick=true, so the tester may fill during the bar, not only at the close.

How the lines are built
- Directional movement follows the usual Wilder construction: up moves from the change in high, down moves from the change in low, then RMA smoothing, to produce +DI and -DI. The DI length defaults to 14.
- +DI is then smoothed again with an RMA of period 4 (the blue plot). -DI is calculated on the 14-period length, then a simple average of period 8 produces smoothed -DI (orange).
- ADX is the absolute gap between +DI and -DI, relative to their sum, then an EMA of length "ADX Signal Length" (default 20). That is the red plot. Smoothed ADX is an 8-period simple average of ADX (white).
- A 21-period and a 200-period simple average of close, plus a 21-period average of volume, are used as default filters. They are not plotted in the pane.
- A table in the corner uses request.security to show whether the 5-minute, 15-minute, 1-hour, 4-hour, and daily charts are in the "+DI has crossed above smoothed -DI and has not crossed back" state. That table is display only; entries and exits do not read it.
Entry rules
- Long only. The source never calls strategy.short.
- All default mandatory gates must be true: an active bullish pattern after +DI crossed above smoothed -DI and before it crosses back; no more than 150 bars since that cross; close above the 200-period average; and volume above its 21-period average. There is also a switch requiring close below the 21-period average; it is off by default, so that filter is not applied.
- When those gates are open, the script calls strategy.entry('Long', strategy.long) if either default trigger fires: +DI crossing 30, or smoothed ADX crossing smoothed -DI.
- The other +DI thresholds, ADX crosses, smoothed-ADX crosses, and the multi-step "ADX then crosses smoothed ADX, then -DI, then +DI" pattern are all off unless you enable them.
- Pyramiding is set to 5, so a new long signal can add to an existing long, up to five entries.
- Because calc_on_every_tick is on, those crosses can fire during the bar, not only at the close.
Exits and position size
- The default exit is ADX crossing under smoothed ADX while ADX is above 38. The script then calls strategy.close('Long') at market.
- The switch to exit when +DI crosses back under smoothed -DI is off by default, so that event is not an exit on its own.
- A stop is on by default: if strategy.openprofit_percent reaches -2.5, the script calls strategy.close_all('Stop Loss'). That is a threshold on open strategy profit, not a stop order resting at a price.
- Take-profit is off by default. If you turn it on, an open profit of 8% calls strategy.close_all('Take Profit').
- Orders default to 10% of equity, with initial_capital set to 10000, commission 0.1%, slippage set to 3, and currency USD.
Inputs (defaults in the source)
| Input | Default | What it does |
|---|---|---|
| ADX Signal Length | 20 | EMA length used when building ADX from the +DI / -DI gap. |
| DI Length | 14 | Base length for +DI and -DI. |
| Smoothed +DI Period | 4 | Extra RMA smoothing applied to +DI. |
| Smoothed ADX Period | 8 | Simple average of ADX, giving smoothed ADX. |
| Smoothed -DI Period | 8 | Simple average of -DI, giving smoothed -DI. |
| Require Bullish +DI above -DI Signal | true | Requires the active pattern after +DI has crossed above smoothed -DI. |
| Max candles since +DI crossed above -DI | 150 | Maximum bars allowed since that cross. |
| Price is below the 21 Period Moving Average | false | If enabled, close must also be below the 21-period average. Off by default. |
| Price is above its 200 Period Moving Average | true | Requires close above the 200-period simple average. |
| Volume is above its 21 Period Moving Average | true | Requires volume above its 21-period average. |
| +DI Crossover smooth -DI Long Signal | false | If enabled, the +DI cross above smoothed -DI itself is also a trigger. Off by default. |
| +DI crossover 20 / 25 | false | Optional +DI crosses of 20 or 25. Off by default. |
| +DI crossover 30 | true | One of the two default triggers: +DI crossing 30. |
| ADX crossover smooth ADX / smooth -DI / +DI / 10 / 20 / 30 | false | These ADX-cross triggers are all off by default. |
| Smooth ADX crossover smooth -DI | true | The other default trigger: smoothed ADX crossing smoothed -DI. |
| Smooth ADX crossover +DI / 10 / 20 / 30 | false | The other smoothed-ADX crosses are off by default. |
| ADX Sustained Momentum Signal | false | Enables the multi-step ADX pattern only when turned on. |
| Exit on +DI Crossunder -DI | false | If enabled, +DI crossing back under smoothed -DI exits the long. Off by default. |
| Exit on ADX Trend Reversal | true | Default exit: ADX crossing under smoothed ADX. |
| Minimum ADX Level for Trend Reversal Exit | 38 | That exit also requires ADX to be above this level. |
| Use Stop Loss / Stop Loss % | true / 2.5 | Closes all positions when open strategy profit reaches -2.5%. |
| Use Take Profit / Take Profit % | false / 8.0 | Take-profit is off; if enabled, an 8% open profit closes all positions. |
Caveats
- This is a toolbox, not a strategy with every pattern switched on. Many cross options are off in the defaults; with the published settings, the only live entry triggers are +DI crossing 30 and smoothed ADX crossing smoothed -DI.
- A comment in the source mentions resetting the bullish pattern after 12 bars, but the code resets it when +DI crosses back under smoothed -DI. The bar-count limit that actually runs is the 150-bar input, not 12.
- The strategy never goes short. When +DI weakens or ADX rolls over, the default path only exits an open long.
- The stop uses strategy.openprofit_percent, the open return of the whole strategy, not a stop order at a price. Added-on longs share that one open-profit figure.
- calc_on_every_tick=true means a condition that is true mid-bar and gone by the close can still fill in the tester.
- Up to five longs can stack, and the default size is already 10% of equity, so a cluster of signals can build a large position.
- The multi-timeframe table is display only and does not change orders. The author's chart is 1-hour; the same 30, 38, and 150 thresholds will mean something different on another timeframe.
Install it on TradingView
- Download the .pine file from Coinpred (a current membership is required; see the page) or check the original publication for a newer revision.
- Open the symbol and timeframe you want in TradingView, open the Pine Editor, paste the source, and add it to the chart. The strategy sets overlay=false, so it lands in a separate pane.
- Leave the default switches in place first so you can see the mandatory gates, the +DI-30 and smoothed-ADX triggers, and the high-ADX rollover exit, then decide whether to enable any other patterns.
- The source sizes orders at 10% of equity, sets initial capital to 10000, commission to 0.1%, slippage to 3, turns on calc_on_every_tick, and allows up to five pyramid entries. Live order routing has to be set separately.
- Crypto trades around the clock. The tester's timezone and session settings may differ from your venue by several hours.
About backtest figures
Source, license, and version
- Source: https://www.tradingview.com/script/kgsU4SHu-DMI-Toolbox-Strategy/
- Author: Chart0bserver (header © Chart0bserver)
- License: Mozilla Public License 2.0. Redistribution must keep the original copyright and license notices; if you modify the source file, the modified file must remain under MPL 2.0. Coinpred ships the unmodified source.
- Version: 4.0 in the publication record and pine-facade. scriptAccess is open_no_auth.



