Consecutive Up/Down Strategy


The Consecutive Up/Down Strategy enters long if for at least X consecutive bars the current close is greater than the previous close. It enters short if for at least Y consecutive bars the current close is lower than the previous close. The X and Y inputs are managed in the strategy settings, which can be accessed by right-clicking on the strategy when it’s overlaid on the chart or by clicking the Settings wheel in the top left region of the chart. 


Pine Script
//@version=4 strategy("ChannelBreakOutStrategy", overlay=true) length = input(title="Length", type=input.integer, minval=1, maxval=1000, defval=5) upBound = highest(high, length) downBound = lowest(low, length) if (not na(close[length])) strategy.entry("ChBrkLE", strategy.long, stop=upBound + syminfo.mintick, comment="ChBrkLE") strategy.entry("ChBrkSE", strategy.short, stop=downBound - syminfo.mintick, comment="ChBrkSE") //plot(strategy.equity, title="equity",, linewidth=2, style=plot.style_areabr)


The Consecutive Up/Down Strategy is primarily designed for trends. It can be used on any timeframe and it’s dependent on the values you assign to the Consecutive Bars Up and Consecutive Bars Down. This can be adjusted in the strategy Settings and it’s up to you to decide. The strategy’s default option is 3 consecutive up bars and 3 consecutive down bars. This means that if there are 3 consecutive bars that are above or below the previous bar close, the strategy will go long or short.

首页 股票筛选器 外汇筛选器 加密货币筛选器 财经日历 关于 图表功能 价格 推荐朋友 网站规则 帮助中心 网站 & 经纪商解决方案 插件 图表解决方案 轻量图表库 博客 & 新闻 Twitter