네 가지 지표 동력 역전 전략

저자:차오장, 날짜: 2023-11-27 15:51:01
태그:

img

전반적인 설명

이 전략은 EMA 크로스오버와 RSI와 CCI의 과잉판매/ 과잉구매 판독으로 확인된 추가 항목을 통해 가격 동력을 식별하기 위해 이동 평균 EMA, 상대 강도 지수 RSI 및 상품 채널 지수 CCI의 세 가지 주요 기술 지표를 사용합니다. 이 중장기 거래 전략은 동력 반전을 포착하는 것을 목표로합니다.

전략 논리

  1. 4주기 및 8주기 EMA 사이의 교차점을 사용하여 가격 동력을 결정합니다. 더 빠른 4주기 EMA는 신속하게 반응하고 더 느린 8주기 EMA는 확인합니다.

  2. EMA가 상향으로 전환되면, 즉 4주기 EMA가 8주기 EMA를 넘어서면, RSI (65 이상) 및 CCI (0 이상) 가 긴 신호를 주기 위해 과잉 구매되지 않았는지 확인합니다.

  3. EMA가 하락하는 경우, 즉 4주기 EMA가 8주기 EMA를 넘어서는 경우, RSI (35 이하) 와 CCI (0 이하) 가 마감 신호를 주기 위해 과잉 판매되었는지 확인합니다.

  4. 트레이드 신호가 발사되면 입력 거리를 기준으로 스톱 로스 및 취리 가격을 설정합니다.

요약하자면 이 전략은 중장기 트렌드와 단기 과반 구매/ 과반 판매 수준이 상대적으로 안정적인 신호를 형성하는 것으로 간주하며, 손해를 멈추고 이익을 취하는 것은 거래당 손실을 효과적으로 제한합니다.

이점 분석

  1. 여러 지표가 개별 오시레이터로부터의 잘못된 신호를 완화합니다.

  2. EMA는 주요 트렌드를 결정하고 RSI와 CCI는 승률을 향상시키기 위해 과열된 영역을 피합니다.

  3. 자동 스톱 로스 및 취득 설정은 극단적인 움직임에서 손실을 제한합니다.

  4. 순전히 기술적인 특성으로 이 전략은 모든 시간대에 쉽게 구현될 수 있습니다.

위험 분석

  1. 주요 근본적인 뉴스는 기술적인 수준보다 더 중요할 수 있습니다.

  2. 스톱 손실은 더 넓은 스톱을 요구하는 엄청난 변동성으로 이루어질 수 있습니다.

  3. 빈번한 거래는 더 높은 거래 비용을 유발합니다. 따라서 고주파 알고리즘에 가장 잘 남겨집니다.

더 나은 기회

  1. 기계 학습 모델을 기본에 기반한 자동 조정 매개 변수로 통합합니다.

  2. 고정된 거리가 아닌 변동성에 반응하는 적응식 정지점을 구축합니다.

결론

이 다각적인 전략은 최적화된 매개 변수에서 일관된 중장기 수익을 창출 할 수 있으며 접근 가능한 기술 시스템으로 만들어집니다.


/*backtest
start: 2023-11-19 00:00:00
end: 2023-11-26 00:00:00
period: 45m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © SoftKill21

//@version=4


strategy(title="Moving Average Exponential", shorttitle="EMA", overlay=true)


len4 = input(4, minval=1, title="Length_MA4")
src4 = input(close, title="Source")
offset4 = input(title="Offset", type=input.integer, defval=0, minval=-500, maxval=500)
out4 = ema(src4, len4)
plot(out4, title="EMA", color=color.blue, offset=offset4)

len8 = input(8, minval=1, title="Length_MA8")
src8 = input(close, title="Source")
offset8 = input(title="Offset", type=input.integer, defval=0, minval=-500, maxval=500)
out8 = ema(src8, len8)
plot(out8, title="EMA", color=color.blue, offset=offset8)


//rsioma
src = close, len = input(14, minval=1, title="Length")
up = rma(max(change(ema(src, len)), 0), len)
down = rma(-min(change(ema(src, len)), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
//plot(rsi, color=color.blue)
//band1 = hline(80)
//band0 = hline(20)
//fill(band1, band0, color=color.purple, transp=90)
//hline(50, color=color.gray, linestyle=plot.style_line)
sig = ema(rsi, 21)
//plot(sig, color=color.purple)

//woodie
cciTurboLength = input(title="CCI Turbo Length", type=input.integer, defval=6, minval=3, maxval=14)
cci14Length = input(title="CCI 14 Length", type=input.integer, defval=14, minval=7, maxval=20)

source = close

cciTurbo = cci(source, cciTurboLength)
cci14 = cci(source, cci14Length)

last5IsDown = cci14[5] < 0 and cci14[4] < 0 and cci14[3] < 0 and cci14[2] < 0 and cci14[1] < 0
last5IsUp = cci14[5] > 0 and cci14[4] > 0 and cci14[3] > 0 and cci14[2] > 0 and cci14[1] > 0
histogramColor = last5IsUp ? color.green : last5IsDown ? color.red : cci14 < 0 ? color.green : color.red


// Exit Condition
// Exit Condition
a = input(12)*10
b = input(15)*10
c = a*syminfo.mintick
d = b*syminfo.mintick


longCondition = crossover(out4, out8) and (rsi >= 65 and cci14>=0)
shortCondition = crossunder(out4, out8) and (rsi <=35 and cci14<=0)


long_stop_level     = float(na)
long_profit_level1  = float(na)
long_profit_level2  = float(na)
long_even_level     = float(na)

short_stop_level    = float(na)
short_profit_level1 = float(na)
short_profit_level2 = float(na)
short_even_level    = float(na)

long_stop_level     := longCondition  ? close - c : long_stop_level     [1]
long_profit_level1  := longCondition  ? close + d : long_profit_level1  [1]
//long_profit_level2  := longCondition  ? close + d : long_profit_level2  [1]
//long_even_level     := longCondition  ? close + 0 : long_even_level     [1]

short_stop_level    := shortCondition ? close + c : short_stop_level    [1]
short_profit_level1 := shortCondition ? close - d : short_profit_level1 [1]
//short_profit_level2 := shortCondition ? close - d : short_profit_level2 [1]
//short_even_level    := shortCondition ? close + 0 : short_even_level    [1] 


//ha
// === Input ===
//ma1_len = input(1, title="MA 01")
//ma2_len = input(40, title="MA 02")

// === MA 01 Filter ===
//o=ema(open,ma1_len)
//cc=ema(close,ma1_len)
//h=ema(high,ma1_len)
//l=ema(low,ma1_len)

// === HA calculator ===
//ha_t = heikinashi(syminfo.tickerid)
//ha_o = security(ha_t, timeframe.period, o)
//ha_c = security(ha_t, timeframe.period, cc)
//ha_h = security(ha_t, timeframe.period, h)
//ha_l = security(ha_t, timeframe.period, l)

// === MA 02 Filter ===
//o2=ema(ha_o, ma2_len)
//c2=ema(ha_c, ma2_len)
//h2=ema(ha_h, ma2_len)
//l2=ema(ha_l, ma2_len)

// === Color def ===
//ha_col=o2>c2 ? color.red : color.lime

// ===  PLOTITING===
//plotcandle(o2, h2, l2, c2, title="HA Smoothed", color=ha_col)

tp=input(120)
sl=input(96)
    
strategy.entry("long", strategy.long, when = longCondition)
//strategy.close("long", when = o2>c2 , comment="ha_long")
strategy.entry("short", strategy.short , when =shortCondition )
//strategy.close("short", when = o2<=c2 , comment = "ha_short" )

//strategy.close("long",when=long_profit_level1 or long_stop_level  , comment="tp/sl")
//strategy.close("short",when=short_profit_level1 or short_stop_level , comment="tp/sl")

strategy.exit("x_long","long",profit = tp, loss = sl) //when = o2>c2)
strategy.exit("x_short","short",profit = tp, loss = sl) //when = o2<c2)



더 많은