
이 전략은 “EMA와 무작위 RSI를 기반으로 한 다중 주기 트렌드 추적 거래 전략”이라고 불리며, 두 개의 다른 주기 인 지수 이동 평균 (EMA) 과 무작위 RSI 지표를 사용하여 시장의 중기 및 장기 트렌드를 포착합니다. 전략의 핵심 아이디어는 EMA의 교차를 통해 트렌드 방향을 판단하고, 무작위 RSI를 트렌드 확인 및 반전 경고 신호로 결합하여 트렌드 형성 초기 포지션을 구축하고, 트렌드 종료 포지션을 평정합니다.
빠른 EMA와 느린 EMA를 계산한다. 빠른 EMA의 기본 파라미터는 12이고, 느린 EMA의 기본 파라미터는 25이다. 실제 응용에서는 시장 특성과 거래 빈도에 따라 조정할 수 있다.
“이건 정말 놀라운 일이에요.
트렌드 확인: 보잉/보잉 신호가 나타난 후, 2개의 보잉/보잉 K선이 연속적으로 나타나야 트렌드가 형성되었다는 것을 확인한다. 이것은 가짜 신호를 필터링하는 데 도움이 된다.
무작위 RSI를 보조 판단으로 사용함:
동시에 두 개의 다른 주기의 EMA를 사용하여 트렌드 캡처의 민감성과 신뢰성을 더 잘 균형을 잡을 수 있습니다. 분석은 12⁄25 주기의 EMA 조합이 중장기 트렌드를 더 잘 파악한다는 것을 보여줍니다.
트렌드 확인 메커니즘은 대부분의 가짜 신호를 효과적으로 필터링하여 전략의 승률을 높일 수 있습니다.
무작위 RSI는 보조 판단으로 트렌드 초기에 트렌드 강도를 판단하고, 트렌드 후기에 가능한 트렌드 반전을 미리 경고합니다.
전략 논리는 간단하고, 파라미터가 적고, 이해하기 쉽고, 실행이 쉬우며, 다양한 시장과 품종에 적용된다.
EMA는 지연된 지표이며, 트렌드 반전의 초기에는 큰 슬라이드점이 발생할 수 있다.
트렌드형 전략은 흔들리는 시장에서 일반적으로 나타난다. 이 전략은 흔들리는 시장에 대한 전문적인 판단이 없다.
무작위 RSI는 시장이 급격히 변동할 때 부정확할 수 있으며 판단의 질에 영향을 미칩니다.
고정된 매개 변수는 모든 시장 상황에 적합하지 않을 수 있으며, 시장 특성에 따라 동적으로 조정할 필요가 있다.
ATR과 같은 변동률 지표를 도입하고, 변동률 동력에 따라 EMA 매개 변수를 조정하여 다른 시장 리듬에 맞게 조정한다.
불투명한 시장에 대한 판단을 높여서, 예를 들어, 부린 베인드 출구 방향과 결합하여 불투명한 시장에서 자주 거래하는 것을 피하십시오.
무작위 RSI를 기반으로 거래량 변화와 같은 보조 판단을 더 많이 통합하여 신호 신뢰성을 향상시킵니다.
시장 관련성을 고려하고, 다양한 종류의 연결 신호를 도입하고, 시스템의 위험 저항력을 강화한다.
이 전략은 EMA와 무작위 RSI의 장점을 최대한 활용하여 트렌드 추적과 동력 반전을 기반으로 한 중장기 거래 전략을 형성한다. 동선을 가로질러 트렌드를 포착하고, 무작위 RSI가 트렌드 강도를 확인하고, 경고 반전을 경고하고, 트렌드 확인 메커니즘이 신호 품질을 향상시킵니다. 이 세 가지가 유기적으로 결합되어 간단한 효과적인 양적 거래 전략 프레임워크를 형성한다.
/*backtest
start: 2023-03-02 00:00:00
end: 2024-03-07 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy('[Jacky] Trader XO Macro Trend Scanner', overlay=true)
// Variables
var ok = 0
var countBuy = 0
var countSell = 0
src = input(close, title='OHLC Type')
i_fastEMA = input(12, title='Fast EMA')
i_slowEMA = input(25, title='Slow EMA')
i_defEMA = input(25, title='Consolidated EMA')
// Allow the option to show single or double EMA
i_bothEMAs = input(title='Show Both EMAs', defval=true)
// Define EMAs
v_fastEMA = ta.ema(src, i_fastEMA)
v_slowEMA = ta.ema(src, i_slowEMA)
v_biasEMA = ta.ema(src, i_defEMA)
// Color the EMAs
emaColor = v_fastEMA > v_slowEMA ? color.green : v_fastEMA < v_slowEMA ? color.red : #FF530D
// Plot EMAs
plot(i_bothEMAs ? na : v_biasEMA, color=emaColor, linewidth=3, title='Consolidated EMA')
plot(i_bothEMAs ? v_fastEMA : na, title='Fast EMA', color=emaColor)
plot(i_bothEMAs ? v_slowEMA : na, title='Slow EMA', color=emaColor)
// Colour the bars
buy = v_fastEMA > v_slowEMA
sell = v_fastEMA < v_slowEMA
if buy
countBuy += 1
countBuy
if buy
countSell := 0
countSell
if sell
countSell += 1
countSell
if sell
countBuy := 0
countBuy
buysignal = countBuy < 2 and countBuy > 0 and countSell < 1 and buy and not buy[1]
sellsignal = countSell > 0 and countSell < 2 and countBuy < 1 and sell and not sell[1]
barcolor(buysignal ? color.green : na)
barcolor(sellsignal ? color.red : na)
// Strategy backtest
if (buysignal)
strategy.entry("Buy", strategy.long)
if (sellsignal)
strategy.entry("Sell", strategy.short)
// Plot Bull/Bear
plotshape(buysignal, title='Bull', text='Bull', style=shape.triangleup, location=location.belowbar, color=color.new(color.green, 0), textcolor=color.new(color.black, 0), size=size.tiny)
plotshape(sellsignal, title='Bear', text='Bear', style=shape.triangledown, location=location.abovebar, color=color.new(color.red, 0), textcolor=color.new(color.black, 0), size=size.tiny)
bull = countBuy > 1
bear = countSell > 1
barcolor(bull ? color.green : na)
barcolor(bear ? color.red : na)
// Set Alerts
alertcondition(ta.crossover(v_fastEMA, v_slowEMA), title='Bullish EMA Cross', message='Bullish EMA crossover')
alertcondition(ta.crossunder(v_fastEMA, v_slowEMA), title='Bearish EMA Cross', message='Bearish EMA Crossover')
// Stoch RSI code
smoothK = input.int(3, 'K', minval=1)
smoothD = input.int(3, 'D', minval=1)
lengthRSI = input.int(14, 'RSI Length', minval=1)
lengthStoch = input.int(14, 'Stochastic Length', minval=1)
rsi1 = ta.rsi(src, lengthRSI)
k = ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
d = ta.sma(k, smoothD)
bandno0 = input.int(80, minval=1, title='Upper Band', group='Bands (change this instead of length in Style for Stoch RSI colour to work properly)')
bandno2 = input.int(50, minval=1, title='Middle Band', group='Bands (change this instead of length in Style for Stoch RSI colour to work properly)')
bandno1 = input.int(20, minval=1, title='Lower Band', group='Bands (change this instead of length in Style for Stoch RSI colour to work properly)')
// Alerts
crossoverAlertBgColourMidOnOff = input.bool(title='Crossover Alert Background Colour (Middle Level) [ON/OFF]', group='Crossover Alerts', defval=false)
crossoverAlertBgColourOBOSOnOff = input.bool(title='Crossover Alert Background Colour (OB/OS Level) [ON/OFF]', group='Crossover Alerts', defval=false)
crossoverAlertBgColourGreaterThanOnOff = input.bool(title='Crossover Alert >input [ON/OFF]', group='Crossover Alerts', defval=false)
crossoverAlertBgColourLessThanOnOff = input.bool(title='Crossover Alert <input [ON/OFF]', group='Crossover Alerts', defval=false)
maTypeChoice = input.string('EMA', title='MA Type', group='Moving Average', options=['EMA', 'WMA', 'SMA', 'None'])
maSrc = input.source(close, title='MA Source', group='Moving Average')
maLen = input.int(200, minval=1, title='MA Length', group='Moving Average')
maValue = if maTypeChoice == 'EMA'
ta.ema(maSrc, maLen)
else if maTypeChoice == 'WMA'
ta.wma(maSrc, maLen)
else if maTypeChoice == 'SMA'
ta.sma(maSrc, maLen)
else
0
crossupCHECK = maTypeChoice == 'None' or open > maValue and maTypeChoice != 'None'
crossdownCHECK = maTypeChoice == 'None' or open < maValue and maTypeChoice != 'None'
crossupalert = crossupCHECK and ta.crossover(k, d) and (k < bandno2 or d < bandno2)
crossdownalert = crossdownCHECK and ta.crossunder(k, d) and (k > bandno2 or d > bandno2)
crossupOSalert = crossupCHECK and ta.crossover(k, d) and (k < bandno1 or d < bandno1)
crossdownOBalert = crossdownCHECK and ta.crossunder(k, d) and (k > bandno0 or d > bandno0)
aboveBandalert = ta.crossunder(k, bandno0)
belowBandalert = ta.crossover(k, bandno1)
bgcolor(color=crossupalert and crossoverAlertBgColourMidOnOff ? #4CAF50 : crossdownalert and crossoverAlertBgColourMidOnOff ? #FF0000 : na, title='Crossover Alert Background Colour (Middle Level)', transp=70)
bgcolor(color=crossupOSalert and crossoverAlertBgColourOBOSOnOff ? #fbc02d : crossdownOBalert and crossoverAlertBgColourOBOSOnOff ? #000000 : na, title='Crossover Alert Background Colour (OB/OS Level)', transp=70)
bgcolor(color=aboveBandalert and crossoverAlertBgColourGreaterThanOnOff ? #ff0014 : crossdownalert and crossoverAlertBgColourMidOnOff ? #FF0000 : na, title='Crossover Alert - K > Upper level', transp=70)
bgcolor(color=belowBandalert and crossoverAlertBgColourLessThanOnOff ? #4CAF50 : crossdownalert and crossoverAlertBgColourMidOnOff ? #FF0000 : na, title='Crossover Alert - K < Lower level', transp=70)
alertcondition(crossupalert or crossdownalert, title='Stoch RSI Crossover', message='STOCH RSI CROSSOVER')