Channel Breakout SE#
This is a trend-following strategy designed to capture breakouts and sustained market moves to the downside. It enters short when the market price breaks below the lowest point over a lookback period, anticipating continued downward momentum. By placing the short sell order slightly below the breakout level, the strategy confirms a clear downtrend before entering, reducing the risk of erroneous short entries.
Source Code#
| |
Code Walkthrough#
| |
Ensures that only one order is generated per bar; orders are placed only when the bar is complete.
| |
Defines two input parameters:
Price: Set toLow, meaning the strategy calculates based on each bar’s low price.Length: Set to20, the number of past bars used to calculate the lowest low.
| |
Places a short sell order named ChBrkSE. LowestFC(Price, Length) calculates the lowest value of Price (Low) over the past Length (20) bars. The short entry price is set one point below that low and submitted as a stop order — the entry triggers when the market falls to that price.