OPEN-SOURCE SCRIPT
Larry Williams Donchian Breakout Strategy

This strategy is based on a breakout of the Donchian Channel with customizable risk-reward parameters and optional entry filters. It combines visual elements from the Donchian Channel indicator with a fully executable trading logic.
How entries are generated
A long trade is opened when the chosen signal price (either bar’s High or Close) closes above the upper Donchian Channel on each of the three previous bars.
A short trade is opened when the chosen signal price (either bar’s Low or Close) closes below the lower Donchian Channel on each of the three previous bars.
Both long and short signals can be configured to use either High/Low or Close values for confirmation.
Stop Loss and Take Profit
The Stop Loss is automatically placed relative to the Donchian middle line with a user-defined offset.
The Take Profit is calculated using a Risk/Reward multiplier.
Separate risk-reward ratios can be set for long and short positions.
Visual elements
The Donchian Channel (upper, lower, and middle bands) is plotted on the chart.
High-High, Higher-Low, Lower-High, and Lower-Low markers are displayed when pivot conditions are met.
Each trade is visualized with three horizontal lines drawn for a limited number of recent trades:
Entry (blue)
Stop Loss (red)
Take Profit (green)
To keep the chart clean, only the last ten trades (30 lines in total) remain visible.
Entry filters
Two optional filters are included and can be enabled or disabled independently:
LWTI filter – Long trades are only allowed when the Larry Williams Trade Index is green, and short trades are only allowed when the index is red.
Volume filter – Trades are only allowed when the current volume is above its 30-period SMA.
Use case
The strategy is designed to test Donchian Channel breakout conditions with risk management and simple filters. It can serve as a foundation for further development, allowing traders to experiment with additional filters or money management rules.
Disclaimer
This strategy is for educational and research purposes only. It is not financial advice. Always test thoroughly before using any strategy in live trading, and make trading decisions at your own risk.
How entries are generated
A long trade is opened when the chosen signal price (either bar’s High or Close) closes above the upper Donchian Channel on each of the three previous bars.
A short trade is opened when the chosen signal price (either bar’s Low or Close) closes below the lower Donchian Channel on each of the three previous bars.
Both long and short signals can be configured to use either High/Low or Close values for confirmation.
Stop Loss and Take Profit
The Stop Loss is automatically placed relative to the Donchian middle line with a user-defined offset.
The Take Profit is calculated using a Risk/Reward multiplier.
Separate risk-reward ratios can be set for long and short positions.
Visual elements
The Donchian Channel (upper, lower, and middle bands) is plotted on the chart.
High-High, Higher-Low, Lower-High, and Lower-Low markers are displayed when pivot conditions are met.
Each trade is visualized with three horizontal lines drawn for a limited number of recent trades:
Entry (blue)
Stop Loss (red)
Take Profit (green)
To keep the chart clean, only the last ten trades (30 lines in total) remain visible.
Entry filters
Two optional filters are included and can be enabled or disabled independently:
LWTI filter – Long trades are only allowed when the Larry Williams Trade Index is green, and short trades are only allowed when the index is red.
Volume filter – Trades are only allowed when the current volume is above its 30-period SMA.
Use case
The strategy is designed to test Donchian Channel breakout conditions with risk management and simple filters. It can serve as a foundation for further development, allowing traders to experiment with additional filters or money management rules.
Disclaimer
This strategy is for educational and research purposes only. It is not financial advice. Always test thoroughly before using any strategy in live trading, and make trading decisions at your own risk.
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。