OPEN-SOURCE SCRIPT

5SMA+B.B.+RSI

98
//version=5
indicator("5SMA+B.B.+RSI", overlay = true)


// SMAの各種設定
SMAEnable = input.bool(true, title = "SMA Enable", group = "SMA settings")

SMASource1 = input.source(close, title = "SMA1 Source")
SMALength1 = input.int(5, title = "SMA1 Length")

SMASource2 = input.source(close, title = "SMA2 Source")
SMALength2 = input.int(25, title = "SMA2 Length")

SMASource3 = input.source(close, title = "SMA3 Source")
SMALength3 = input.int(75, title = "SMA3 Length")

SMASource4 = input.source(close, title = "SMA4 Source")
SMALength4 = input.int(100, title = "SMA4 Length")

SMASource5 = input.source(close, title = "SMA5 Source")
SMALength5 = input.int(150, title = "SMA5 Length")


// Bollinger Bandの各種設定
BBEnable = input.bool(true, title = "Bollinger Band Enable", group = "B.B. settings")
BBSource = input.source(close, title = "BB Source")
BBLength = input.int(20, title = "BB Length")
BBDeviation = input.float(2.0, title = "BB 偏差")


// RSIの各種設定
RSIEnable = input.bool(true, title = "RSI Enable", group = "RSI settings")
RSISource = input.source(close, title = "RSI Source")
RSILength = input.int(14, title = "RSI Length")
RSIUpper = input.float(70.0, title = "RSI Upper level")
RSILower = input.float(30.0, title = "RSI Lower level")


// SMAの算出
SMA1 = ta.sma(SMASource1, SMALength1)
SMA2 = ta.sma(SMASource2, SMALength2)
SMA3 = ta.sma(SMASource3, SMALength3)
SMA4 = ta.sma(SMASource4, SMALength4)
SMA5 = ta.sma(SMASource5, SMALength5)


// Bollinger Bandの算出
BBSMA = ta.sma(BBSource, BBLength)
BBDev = ta.stdev(BBSource, BBLength)
BBUpper = BBSMA + BBDeviation * BBDev
BBLower = BBSMA - BBDeviation * BBDev


// RSIの算出
RSIValue = ta.rsi(RSISource, RSILength)


// プロット
plot(SMAEnable ? SMA1 : na, title = "SMA1", linewidth = 2, color = color.white)
plot(SMAEnable ? SMA2 : na, title = "SMA2", linewidth = 2, color = color.blue)
plot(SMAEnable ? SMA3 : na, title = "SMA3", linewidth = 2, color = color.yellow)
plot(SMAEnable ? SMA4 : na, title = "SMA4", linewidth = 2, color = color.green)
plot(SMAEnable ? SMA5 : na, title = "SMA5", linewidth = 2, color = color.gray)

plot(BBEnable ? BBSMA : na, title = "BB SMA", color = color.orange)
plot(BBEnable ? BBUpper : na, title = "BB Upper", color = color.orange)
plot(BBEnable ? BBLower : na, title = "BB Lower", color = color.orange)

plotshape(RSIEnable and RSIUpper < RSIValue, style = shape.triangleup, location = location.abovebar, color = color.white, display = display.pane)
plotshape(RSIEnable and RSIValue < RSILower, style = shape.triangledown, location = location.belowbar, color = color.white, display = display.pane)//version=5
indicator("5SMA+B.B.+RSI", overlay = true)


// SMAの各種設定
SMAEnable = input.bool(true, title = "SMA Enable", group = "SMA settings")

SMASource1 = input.source(close, title = "SMA1 Source")
SMALength1 = input.int(5, title = "SMA1 Length")

SMASource2 = input.source(close, title = "SMA2 Source")
SMALength2 = input.int(25, title = "SMA2 Length")

SMASource3 = input.source(close, title = "SMA3 Source")
SMALength3 = input.int(75, title = "SMA3 Length")

SMASource4 = input.source(close, title = "SMA4 Source")
SMALength4 = input.int(100, title = "SMA4 Length")

SMASource5 = input.source(close, title = "SMA5 Source")
SMALength5 = input.int(150, title = "SMA5 Length")


// Bollinger Bandの各種設定
BBEnable = input.bool(true, title = "Bollinger Band Enable", group = "B.B. settings")
BBSource = input.source(close, title = "BB Source")
BBLength = input.int(20, title = "BB Length")
BBDeviation = input.float(2.0, title = "BB 偏差")


// RSIの各種設定
RSIEnable = input.bool(true, title = "RSI Enable", group = "RSI settings")
RSISource = input.source(close, title = "RSI Source")
RSILength = input.int(14, title = "RSI Length")
RSIUpper = input.float(70.0, title = "RSI Upper level")
RSILower = input.float(30.0, title = "RSI Lower level")


// SMAの算出
SMA1 = ta.sma(SMASource1, SMALength1)
SMA2 = ta.sma(SMASource2, SMALength2)
SMA3 = ta.sma(SMASource3, SMALength3)
SMA4 = ta.sma(SMASource4, SMALength4)
SMA5 = ta.sma(SMASource5, SMALength5)


// Bollinger Bandの算出
BBSMA = ta.sma(BBSource, BBLength)
BBDev = ta.stdev(BBSource, BBLength)
BBUpper = BBSMA + BBDeviation * BBDev
BBLower = BBSMA - BBDeviation * BBDev


// RSIの算出
RSIValue = ta.rsi(RSISource, RSILength)


// プロット
plot(SMAEnable ? SMA1 : na, title = "SMA1", linewidth = 2, color = color.white)
plot(SMAEnable ? SMA2 : na, title = "SMA2", linewidth = 2, color = color.blue)
plot(SMAEnable ? SMA3 : na, title = "SMA3", linewidth = 2, color = color.yellow)
plot(SMAEnable ? SMA4 : na, title = "SMA4", linewidth = 2, color = color.green)
plot(SMAEnable ? SMA5 : na, title = "SMA5", linewidth = 2, color = color.gray)

plot(BBEnable ? BBSMA : na, title = "BB SMA", color = color.orange)
plot(BBEnable ? BBUpper : na, title = "BB Upper", color = color.orange)
plot(BBEnable ? BBLower : na, title = "BB Lower", color = color.orange)

plotshape(RSIEnable and RSIUpper < RSIValue, style = shape.triangleup, location = location.abovebar, color = color.white, display = display.pane)
plotshape(RSIEnable and RSIValue < RSILower, style = shape.triangledown, location = location.belowbar, color = color.white, display = display.pane)

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.