BarUpDn Strategy

Definition

The BarUpDn strategy enters a long position if the current bar is green (close > open) and opens above the close of the previous bar. If the current bar is red and its open is below the close of the previous bar, it will enter short. If the loss percent per day exceeds the number specified in the indicator settings, all positions will be closed.

Calculations

Pine Script code
//@version=4 strategy("BarUpDn Strategy", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 10) maxIdLossPcnt = input(1, "Max Intraday Loss(%)", type=input.float) strategy.risk.max_intraday_loss(maxIdLossPcnt, strategy.percent_of_equity) if (close > open and open > close[1]) strategy.entry("BarUp", strategy.long) if (close < open and open < close[1]) strategy.entry("BarDn", strategy.short) //plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)

Conclusion

The BarUpDn strategy is based on whether or not a specific bar is green and higher than the previous bar or red and lower than the previous bar. The strategy is looking for quick changes in price and attempting to trade those changes, potentially jumping into the start of an uptrend or a downtrend. The BarUpDn strategy is also relatively simple and can be used as an educational starting point for those new to Pine strategies.

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