Channel BreakOut Strategy

Definition

The Channel BreakOut Strategy creates a channel with its bands based on the highest and lowest values for the last X bars (X is the value of the 'Length' setting). The strategy enters long if the high of the current bar is higher than the upper channel band of the previous bar. It enters short if the low of the current bar is lower than the lower channel band of the previous bar.

Calculations

Pine Script 
//@version=4 strategy("Bollinger Bands Strategy directed", overlay=true) source = close length = input(20, minval=1) mult = input(2.0, minval=0.001, maxval=50) direction = input(0, title = "Strategy Direction", type=input.integer, minval=-1, maxval=1) strategy.risk.allow_entry_in(direction == 0 ? strategy.direction.all : (direction < 0 ? strategy.direction.short : strategy.direction.long)) basis = sma(source, length) dev = mult * stdev(source, length) upper = basis + dev lower = basis - dev if (crossover(source, lower)) strategy.entry("BBandLE", strategy.long, stop=lower, oca_name="BollingerBands", oca_type=strategy.oca.cancel, comment="BBandLE") else strategy.cancel(id="BBandLE") if (crossunder(source, upper)) strategy.entry("BBandSE", strategy.short, stop=upper, oca_name="BollingerBands", oca_type=strategy.oca.cancel, comment="BBandSE") else strategy.cancel(id="BBandSE") //plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)

Summary

The Channel Breakout Strategy attempts to create a strategy just like its name says - trades based on whether a symbol breaks out from a channel or not. The channel is dependent on the length, which is chosen in the strategy settings. The strategy then enters long if the high of the current bar is higher than the upper channel band of the previous bar. It enters short if the low of the current bar is lower than the lower channel band of the previous bar.

Home Stock Screener Forex Screener Crypto Screener Economic Calendar How It Works Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Referred friends Coins My Support Tickets Help Center Ideas Published Followers Following Private Messages Chat Sign Out