OPEN-SOURCE SCRIPT

MA + RSI Strategy

//version=5
indicator("Buy and Sell Indicator", overlay=true)

// Input Parameters
fastLength = input.int(9, title="Fast Moving Average Length")
slowLength = input.int(21, title="Slow Moving Average Length")
rsiLength = input.int(14, title="RSI Length")
rsiOverbought = input.int(70, title="RSI Overbought Level")
rsiOversold = input.int(30, title="RSI Oversold Level")

// Calculations
fastMA = ta.sma(close, fastLength)
slowMA = ta.sma(close, slowLength)
rsi = ta.rsi(close, rsiLength)

// Buy and Sell Conditions
buyCondition = ta.crossover(fastMA, slowMA) and rsi < rsiOversold
sellCondition = ta.crossunder(fastMA, slowMA) and rsi > rsiOverbought

// Plot Buy and Sell Signals
plotshape(series=buyCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=sellCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")

// Plot Moving Averages
plot(fastMA, color=color.blue, title="Fast MA")
plot(slowMA, color=color.orange, title="Slow MA")

// Alerts
alertcondition(buyCondition, title="Buy Alert", message="Buy Signal Triggered!")
alertcondition(sellCondition, title="Sell Alert", message="Sell Signal Triggered!")
Bands and ChannelsCandlestick analysisChart patterns

開源腳本

在真正的TradingView精神中,這個腳本的作者以開源的方式發佈,這樣交易員可以理解和驗證它。請向作者致敬!您可以免費使用它,但在出版物中再次使用這段程式碼將受到網站規則的約束。 您可以收藏它以在圖表上使用。

想在圖表上使用此腳本?

免責聲明