OPEN-SOURCE SCRIPT

Donchian Trend V1

Updated
The Donchian Trend strategy is a trend-following approach that uses the Donchian Channels indicator to identify potential entry and exit points in a security. The Donchian Channels are formed by taking the highest high and the lowest low prices over a specified period and plotting them as upper and lower channels around the current price. The width of the channels indicates the level of volatility in the market.

In this strategy, the Donchian Channels are used as a trend filter to determine the direction of the market. When the price is above the upper channel, it suggests an uptrend, and when the price is below the lower channel, it indicates a downtrend. The length of the Donchian Channels is a key parameter in the strategy, as it determines the look-back period for identifying the high and low prices.

Additional Logic: To further refine the entry and exit signals, The script uses two moving averages, a fast one (MA5) and a slow one (MA45), to identify trends and generate trading signals. When the fast moving average crosses above the slow moving average, a buy signal is generated, indicating that the market is trending upwards. Conversely, when the fast moving average crosses below the slow moving average, a sell signal is generated, indicating that the market is trending downwards.

Evaluation: The script was backtested on historical price data for the [Insert your chosen trading pair here] pair. The backtest results showed that the script was able to generate a net profit of [Insert your backtest net profit here], with a profit factor of [Insert your backtest profit factor here] and a Sharpe ratio of [Insert your backtest Sharpe ratio here]. The script also includes metrics such as the number of winning and losing trades, the average trade, and the largest winning and losing trades.
The strategy is evaluated based on its net profit, gross profit, gross loss, max run-up, max drawdown, buy & hold return, Sharpe ratio, Sortino ratio, and profit factor. The parameters used in the backtest include a Donchian Channel length of 42, which corresponds to a weekly time with divide of 4h time frame, and a short-term MA of 5 and a long-term MA of 45 for more accurate entry and exit signals.

Disclaimer: This script is for educational and research purposes only and should not be used for trading with real money without further testing and validation. Past performance is not indicative of future results.
Release Notes
There are some coding upgrades on the script.
Feel free to use it, thank you in advance guys.
Release Notes
In oder to increase the profit % the ema filter was added in strategy, if you have any applicable sugestions to decrease the drawdown feel free to write us guys, thank you in advance.
Release Notes
Some minor adjustments was made.
Release Notes
Price based trailing stop loss was ( similar to donchian base line ) added on the strategy in order to increase profitability and decrease the dragdown.
Hope you are enjoying the results guys :D There are lots of thing needs to be improved we are aware of it and we appreciate if you write us your comments, thank you in advance.
Release Notes
Some codes was updated and macd was added as a trend filter too , look for results ...
Release Notes
Hello guys,
The strategy is refined for visual understanding we also added a three limited take profit sections.
Hop you enjoy it and dont forget to like & share , we are also appreciate if you buy us a coffe or beer either way we dont say no to donations :D
Bands and ChannelsdonchianchanneleducationalMoving Averagestrendpattern

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer