OPEN-SOURCE SCRIPT

EUR/USD Multi-Indicator Trading Strategy

//version=5
indicator("EUR/USD Multi-Indicator Trading Strategy", overlay=true)

// Input parameters
shortMA_length = input(10, title="Short MA Length")
longMA_length = input(50, title="Long MA Length")
rsi_length = input(14, title="RSI Length")
rsi_overbought = input(70, title="RSI Overbought Level")
rsi_oversold = input(30, title="RSI Oversold Level")
macd_fast_length = input(12, title="MACD Fast Length")
macd_slow_length = input(26, title="MACD Slow Length")
macd_signal_length = input(9, title="MACD Signal Length")
bollinger_length = input(20, title="Bollinger Bands Length")
bollinger_std_dev = input(2.0, title="Bollinger Bands Standard Deviation")
stoch_k_length = input(14, title="Stochastic %K Length")
stoch_d_length = input(3, title="Stochastic %D Length")

// Moving Averages
shortMA = ta.sma(close, shortMA_length)
longMA = ta.sma(close, longMA_length)
plot(shortMA, color=color.red, title="Short MA")
plot(longMA, color=color.blue, title="Long MA")

// RSI
rsi = ta.rsi(close, rsi_length)
hline(rsi_overbought, "Overbought", color=color.red)
hline(rsi_oversold, "Oversold", color=color.green)

// MACD
[macdLine, signalLine, _] = ta.macd(close, macd_fast_length, macd_slow_length, macd_signal_length)

// Bollinger Bands
basis = ta.sma(close, bollinger_length)
dev = bollinger_std_dev * ta.stdev(close, bollinger_length)
upperBand = basis + dev
lowerBand = basis - dev
plot(upperBand, color=color.green, title="Upper Band")
plot(lowerBand, color=color.red, title="Lower Band")

// Stochastic
k = ta.stoch(close, high, low, stoch_k_length)
d = ta.sma(k, stoch_d_length) // คำนวณ %D
hline(80, "Stochastic Overbought", color=color.red)
hline(20, "Stochastic Oversold", color=color.green)

// Buy and Sell Conditions
buyCondition = ta.crossover(shortMA, longMA) and rsi < rsi_oversold and (macdLine > signalLine) and (close <= lowerBand) and (k < 20 and ta.crossover(k, d))
sellCondition = ta.crossunder(shortMA, longMA) and rsi > rsi_overbought and (macdLine < signalLine) and (close >= upperBand) and (k > 80 and ta.crossunder(k, d))

// Plot Buy and Sell signals
plotshape(series=buyCondition, location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=sellCondition, location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
Bands and ChannelsBill Williams IndicatorsBreadth Indicatorsstrategytrading

오픈 소스 스크립트

진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?

면책사항