搜索
产品
社区
市场
新闻
经纪商
更多
CN
开始
OPEN-SOURCE SCRIPT
3天前
Buy/Sell Signals Boinger band
图表
原始码
更多
0
添加到收藏
添加到收藏
//
version
=5
indicator("Buy/Sell Signals", overlay=true)
// Define the Bollinger Band parameters
length = input(20, title="Bollinger Band Length")
stdDev = input(2.0, title="Bollinger Band Standard Deviation")
// Calculate the Bollinger Band
basis = ta.sma(close, length)
upper = basis + stdDev * ta.stdev(close, length)
lower = basis - stdDev * ta.stdev(close, length)
// Plot the Bollinger Band
plot(basis, color=color.new(color.blue, 0), linewidth=2)
plot(upper, color=color.red, linewidth=2)
plot(lower, color=color.green, linewidth=2)
// Define the buy signal conditions
lowerBandTouch = close <= lower
threeGreenCandles = close > open and close[1] > open[1] and close[2] > open[2]
// Define the sell signal conditions
upperBandTouch = close >= upper
threeRedCandles = close < open and close[1] < open[1] and close[2] < open[2]
// Generate the buy and sell signals
buySignal = lowerBandTouch and threeGreenCandles
sellSignal = upperBandTouch and threeRedCandles
// Plot the buy and sell signals
plotshape(buySignal, location=location.belowbar, color=color.green, style=shape.labelup, text="Buy")
plotshape(sellSignal, location=location.belowbar, color=color.red, style=shape.labeldown, text="Sell")
// Alert conditions
alertcondition(buySignal, title="Buy Signal", message="Buy signal generated!")
alertcondition(sellSignal, title="Sell Signal", message="Sell signal generated!")
CSRishavJaiswal
关注
Pine utilities
开源脚本
本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受
网站规则
约束。 您可以收藏它以在图表上使用。
想在图表上使用此脚本?
CSRishavJaiswal
关注
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在
使用条款
阅读更多信息。