搜索
产品
社区
市场
新闻
经纪商
更多
CN
开始
社区
/
脚本
/
High-Accuracy Buy/Sell Signal
OPEN-SOURCE SCRIPT
High-Accuracy Buy/Sell Signal
由Bensonds提供
关注
关注
昨天
8
添加到收藏
添加到收藏
昨天
//
version
=5
indicator("High-Accuracy Buy/Sell Signal", overlay=true)
// Input parameters
rsiLength = input.int(14, title="RSI Length")
rsiOverbought = input.int(70, title="RSI Overbought Level")
rsiOversold = input.int(30, title="RSI Oversold Level")
macdFastLength = input.int(12, title="MACD Fast Length")
macdSlowLength = input.int(26, title="MACD Slow Length")
macdSignalSmoothing = input.int(9, title="MACD Signal Smoothing")
bbLength = input.int(20, title="Bollinger Bands Length")
bbMultiplier = input.float(2.0, title="Bollinger Bands Multiplier")
// RSI Calculation
rsi = ta.rsi(close, rsiLength)
// MACD Calculation
[macdLine, signalLine, _] = ta.macd(close, macdFastLength, macdSlowLength, macdSignalSmoothing)
// Bollinger Bands Calculation
basis = ta.sma(close, bbLength)
dev = bbMultiplier * ta.stdev(close, bbLength)
upperBand = basis + dev
lowerBand = basis - dev
// Buy condition
buySignal = (rsi < rsiOversold) and (macdLine > signalLine) and (close < lowerBand)
// Sell condition
sellSignal = (rsi > rsiOverbought) and (macdLine < signalLine) and (close > upperBand)
// Plot signals on chart
plotshape(series=buySignal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=sellSignal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// Plot Bollinger Bands
plot(upperBand, color=color.blue, linewidth=1, title="Upper Band")
plot(lowerBand, color=color.blue, linewidth=1, title="Lower Band")
// Plot MACD and Signal Line (optional, for reference)
hline(0, "Zero Line", color=color.gray)
plot(macdLine, color=color.blue, title="MACD Line")
plot(signalLine, color=color.orange, title="Signal Line")
// Alert conditions
alertcondition(buySignal, title="Buy Alert", message="Buy Signal")
alertcondition(sellSignal, title="Sell Alert", message="Sell Signal")
Candlestick analysis
开源脚本
本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受
网站规则
约束。 您可以收藏它以在图表上使用。
想在图表上使用此脚本?
添加到收藏
Bensonds
关注
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在
使用条款
阅读更多信息。