
슈퍼트렌드와 EMA 조합 전략은 슈퍼트렌드 지표와 여러 EMA 지표를 결합한 거래 전략이다. 이 전략은 슈퍼트렌드 지표를 통해 현재 시장의 경향 방향을 판단하고, 동시에 다른 주기의 EMA 지표를 구매 신호의 트리거 조건으로 사용합니다. 단기 EMA와 중기 EMA가 갈라져, 슈퍼트렌드 지표가 상승 추세를 나타낸다면, 구매 신호를 생성한다. 단기 EMA와 중기 EMA가 사각지대를 나타낸다면, 슈퍼트렌드 지표가 하락 추세를 나타낸다면, 판매 신호를 생성한다.
슈퍼트렌드와 EMA 조합 전략의 핵심 원칙은 슈퍼트렌드 지표와 EMA 지표의 특성을 활용하여 시장의 트렌드 변화와 가격 변동을 포착하는 것입니다. 슈퍼트렌드 지표는 현재 마켓의 트렌드 방향을 판단하기 위해 현재 마켓의 트렌드 방향을 판단합니다. 마켓이 상승 추세에 진입하는 것은 마켓이 상승 추세에 진입했을 때입니다. 마켓이 하락 추세에 진입하는 것은 마켓이 하락 추세에 진입했을 때입니다.
슈퍼트렌드 및 EMA 조합 전략은 슈퍼트렌드 지표와 복수의 EMA 지표를 결합하여 전체적인 트렌드 추적 거래 시스템을 형성한다. 이 전략은 슈퍼트렌드 지표를 사용하여 시장 추세를 판단하고, 동시에 EMA 지표의 교차 상황을 통해 구매 및 판매 신호를 생성하며, 트렌드 추적 능력, 신호 확인 신뢰성, 적응력 등이 장점이다. 그러나 전략은 파라미터 최적화, 시장 변동 및 트렌드 전환과 같은 위험에 직면해 있으며, 전략의 안정성과 수익성을 높이기 위해 파라미터 최적화, 신호 필터링, 손해 중지 및 다중 종의 다중 주기 등의 방법으로 최적화 및 개선이 필요합니다.
/*backtest
start: 2023-06-01 00:00:00
end: 2024-06-06 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("Supertrend EMA Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// Supertrend Parameters
atrPeriod = input(10, title="ATR Period")
src = input(hl2, title="Source")
multiplier = input(3.0, title="ATR Multiplier", step=0.1)
changeATR = input(true, title="Change ATR Calculation Method?")
showSignals = input(true, title="Show Buy/Sell Signals?")
highlighting = input(true, title="Highlighter On/Off?")
// Calculate ATR
atr = changeATR ? atr(atrPeriod) : sma(tr, atrPeriod)
// Calculate Supertrend
up = src - (multiplier * atr)
dn = src + (multiplier * atr)
up1 = nz(up[1], up)
dn1 = nz(dn[1], dn)
up := close[1] > up1 ? max(up, up1) : up
dn := close[1] < dn1 ? min(dn, dn1) : dn
trend = 1
trend := nz(trend[1], trend)
trend := trend == -1 and close > dn1 ? 1 : trend == 1 and close < up1 ? -1 : trend
// Plot Supertrend
upPlot = plot(trend == 1 ? up : na, title="Up Trend", style=plot.style_linebr, linewidth=2, color=color.green)
dnPlot = plot(trend == 1 ? na : dn, title="Down Trend", style=plot.style_linebr, linewidth=2, color=color.red)
// EMA Parameters
shortEmaLength = input(20, title="Short EMA Length")
mediumEmaLength = input(50, title="Medium EMA Length")
longEmaLength = input(100, title="Long EMA Length")
longestEmaLength = input(200, title="Longest EMA Length")
// Calculate EMA
shortEma = ema(close, shortEmaLength)
mediumEma = ema(close, mediumEmaLength)
longEma = ema(close, longEmaLength)
longestEma = ema(close, longestEmaLength)
// Plot EMA
plot(shortEma, color=color.red, title="EMA 20")
plot(mediumEma, color=color.orange, title="EMA 50")
plot(longEma, color=color.aqua, title="EMA 100")
plot(longestEma, color=color.blue, title="EMA 200")
// Define Buy and Sell Conditions
buyCondition = crossover(shortEma, mediumEma) and trend == 1
sellCondition = crossunder(shortEma, mediumEma) and trend == -1
// Plot Buy/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")
// Add Text Labels for Buy and Sell Signals
if (buyCondition)
label.new(bar_index, high, text="Buy", color=color.green, textcolor=color.white, style=label.style_label_up, yloc=yloc.abovebar)
if (sellCondition)
label.new(bar_index, low, text="Sell", color=color.red, textcolor=color.white, style=label.style_label_down, yloc=yloc.belowbar)
// Strategy Entry and Exit
if (buyCondition)
strategy.entry("Buy", strategy.long)
if (sellCondition)
strategy.close("Buy")
// Highlight Trend
longFillColor = highlighting ? (trend == 1 ? color.green : color.white) : color.white
shortFillColor = highlighting ? (trend == -1 ? color.red : color.white) : color.white
fill(plot(ohlc4, title="", style=plot.style_circles, linewidth=0), upPlot, title="UpTrend Highlighter", color=longFillColor)
fill(plot(ohlc4, title="", style=plot.style_circles, linewidth=0), dnPlot, title="DownTrend Highlighter", color=shortFillColor)
// Alerts
alertcondition(buyCondition, title="Buy Alert", message="Supertrend EMA Buy Signal")
alertcondition(sellCondition, title="Sell Alert", message="Supertrend EMA Sell Signal")