Consecutive Up/Down Strategy

Definition

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. 

Calculations

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", color=color.red, linewidth=2, style=plot.style_areabr)

Summary

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.

首頁 股票篩選器 外匯篩選器 加密貨幣篩選器 全球財經日曆 如何運作 圖表功能 價格 推薦朋友 網站規則 幫助中心 網站 & 經紀商解決方案 小工具 圖表解決方案 輕量圖表庫 部落格 & 新聞 推特
概覽 個人資料設定 賬戶和賬單 推薦朋友 代幣 我的客服工單 幫助中心 發表的想法 粉絲 正在關注 私人訊息 在線聊天 登出