OPEN-SOURCE SCRIPT
Donchian x WMA Crossover (2025 Only, Adjustable TP, Real OHLC)

Short Description:
Long-only breakout system that goes long when the Donchian Low crosses up through a Weighted Moving Average, and closes when it crosses back down (with an optional take-profit), restricted to calendar year 2025. All signals use the instrument’s true OHLC data (even on Heikin-Ashi charts), start with 1 000 AUD of capital, and deploy 100 % equity per trade.
Ideal parameters configured for Temple & Webster on ASX 30 minute candles. Adjust parameter to suit however best to download candle interval data and have GPT test the pine script for optimum parameters for your trading symbol.
Detailed Description
1. Strategy Concept
This strategy captures trend-driven breakouts off the bottom of a Donchian channel. By combining the Donchian Low with a WMA filter, it aims to:
Enter when volatility compresses and price breaks above the recent Donchian Low while the longer‐term WMA confirms upward momentum.
Exit when price falls back below that same WMA (i.e. when the Donchian Low crosses back down through WMA), but only if the WMA itself has stopped rising.
Optional Take-Profit: you can specify a profit target in decimal form (e.g. 0.01 = 1 %).
2. Timeframe & Universe
In-sample period: only bars stamped between Jan 1 2025 00:00 UTC and Dec 31 2025 23:59 UTC are considered.
Any resolution (e.g. 30 m, 1 h, D, etc.) is supported—just set your preferred timeframe in the TradingView UI.
3. True-Price Execution
All indicator calculations (Donchian Low, WMA, crossover checks, take-profit) are sourced from the chart’s underlying OHLC via request.security(). This guarantees that:
You can view Heikin-Ashi or other styled candles, but your strategy will execute on the real OHLC bars.
Chart styling never suppresses or distorts your backtest results.
4. Position Sizing & Equity
Initial capital: 1 000 AUD
Size per trade: 100 % of available equity
No pyramiding: one open position at a time
5. Inputs (all exposed in the “Inputs” tab):
Input Default Description
Donchian Length 7 Number of bars to calculate the Donchian channel low
WMA Length 62 Period of the Weighted Moving Average filter
Take Profit (decimal) 0.01 Exit when price ≥ entry × (1 + take_profit_perc)
6. How It Works
Donchian Low: ta.lowest(low, DonchianLength) over the specified look-back.
WMA: ta.wma(close, WMALength) applied to true closes.
Entry: ta.crossover(DonchianLow, WMA) AND barTime ∈ 2025.
Exit:
Cross-down exit: ta.crossunder(DonchianLow, WMA) and WMA is not rising (i.e. momentum has stalled).
Take-profit exit: price ≥ entry × (1 + take_profit_perc).
Calendar exit: barTime falls outside 2025.
7. Usage Notes
After adding to your chart, open the Strategy Tester tab to review performance metrics, list of trades, equity curve, etc.
You can toggle your chart to Heikin-Ashi for visual clarity without affecting execution, thanks to the real-OHLC calls.
Long-only breakout system that goes long when the Donchian Low crosses up through a Weighted Moving Average, and closes when it crosses back down (with an optional take-profit), restricted to calendar year 2025. All signals use the instrument’s true OHLC data (even on Heikin-Ashi charts), start with 1 000 AUD of capital, and deploy 100 % equity per trade.
Ideal parameters configured for Temple & Webster on ASX 30 minute candles. Adjust parameter to suit however best to download candle interval data and have GPT test the pine script for optimum parameters for your trading symbol.
Detailed Description
1. Strategy Concept
This strategy captures trend-driven breakouts off the bottom of a Donchian channel. By combining the Donchian Low with a WMA filter, it aims to:
Enter when volatility compresses and price breaks above the recent Donchian Low while the longer‐term WMA confirms upward momentum.
Exit when price falls back below that same WMA (i.e. when the Donchian Low crosses back down through WMA), but only if the WMA itself has stopped rising.
Optional Take-Profit: you can specify a profit target in decimal form (e.g. 0.01 = 1 %).
2. Timeframe & Universe
In-sample period: only bars stamped between Jan 1 2025 00:00 UTC and Dec 31 2025 23:59 UTC are considered.
Any resolution (e.g. 30 m, 1 h, D, etc.) is supported—just set your preferred timeframe in the TradingView UI.
3. True-Price Execution
All indicator calculations (Donchian Low, WMA, crossover checks, take-profit) are sourced from the chart’s underlying OHLC via request.security(). This guarantees that:
You can view Heikin-Ashi or other styled candles, but your strategy will execute on the real OHLC bars.
Chart styling never suppresses or distorts your backtest results.
4. Position Sizing & Equity
Initial capital: 1 000 AUD
Size per trade: 100 % of available equity
No pyramiding: one open position at a time
5. Inputs (all exposed in the “Inputs” tab):
Input Default Description
Donchian Length 7 Number of bars to calculate the Donchian channel low
WMA Length 62 Period of the Weighted Moving Average filter
Take Profit (decimal) 0.01 Exit when price ≥ entry × (1 + take_profit_perc)
6. How It Works
Donchian Low: ta.lowest(low, DonchianLength) over the specified look-back.
WMA: ta.wma(close, WMALength) applied to true closes.
Entry: ta.crossover(DonchianLow, WMA) AND barTime ∈ 2025.
Exit:
Cross-down exit: ta.crossunder(DonchianLow, WMA) and WMA is not rising (i.e. momentum has stalled).
Take-profit exit: price ≥ entry × (1 + take_profit_perc).
Calendar exit: barTime falls outside 2025.
7. Usage Notes
After adding to your chart, open the Strategy Tester tab to review performance metrics, list of trades, equity curve, etc.
You can toggle your chart to Heikin-Ashi for visual clarity without affecting execution, thanks to the real-OHLC calls.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.