Breakout Indicator

ZenAndTheArtOfTrading · study · 18 行 · 点赞 3,912 · TradingView 原页

本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。

Pine Script

// BKOI v1.0 - Created by Matthew J. Slabosz
//@version=3
study(title = "Breakout Indicator", shorttitle="BKOI", overlay = true, precision=5)
 
// Get user input
longBreakout = input(0.0, minval=0.0, title="Long Breakout Price:")
shortBreakout = input(0.0, minval=0.0, title="Short Breakout Price:")
longAlerts = input(title="Long Alerts?", type=bool, defval=false)
shortAlerts = input(title="Short Alerts?", type=bool, defval=false)
longAlert = longAlerts and longBreakout > 0 and close[1] > longBreakout
shortAlert = shortAlerts and shortBreakout > 0 and close[1] < shortBreakout
 
// Plot data to chart
plot(longBreakout > 0 ? longBreakout : na, title="Long Breakout Price", color=green, transp=0, linewidth=1)
plot(shortBreakout > 0 ? shortBreakout : na, title="Short Breakout Price", color=red, transp=0, linewidth=1)
 
// Send out an alert if this candle meets our conditions
alertcondition(longAlert or shortAlert, title="Breakout Alert!", message="Breakout signal for XXX/XXX")

← 返回列表