OPEN-SOURCE SCRIPT

Moving Average Channel (MAC)

The strategy uses two Simple Moving Averages (SMA): an upper MA based on the high price and a lower MA based on the low price. Key features include:

Entry Condition: Enter a long position after five consecutive bars close above the upper MA.
Exit Conditions:
Close the position if five consecutive bars close below the lower MA.
Close the position if the price drops below 25% of the highest price recorded since entry (stop-loss).

Key Features:
Dynamic Entry: Long position is triggered only after consistent strength in price (5 bars above the upper MA).
Dynamic Exit:
Tracks weakness (5 bars below the lower MA) for exit.
Implements a stop-loss based on 25% retracement from the highest price recorded post-entry.
Customizable Parameters: MA lengths and stop-loss percentage are adjustable to fit different trading styles and market conditions.
This script provides a simple yet effective trend-following strategy with built-in risk management.






Bands and ChannelsTrend Analysis

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