아룬 + 윌리엄스 + MA + BB + ADX 강력한 다중 지표 전략

저자:차오장, 날짜: 2024-01-19 14:55:03
태그:

img

전반적인 설명

이 전략은 Aroon, MA, BB, Williams, %R, ADX와 같은 다양한 기간을 가진 여러 가지 강력한 지표를 결합하여 트렌드가 명백할 때 효율적으로 포지션을 열 수 있는 다차원적인 강력한 오픈 포지션 지표 시스템을 형성합니다.

전략 원칙

이 전략은 주로 다음과 같은 지표의 조합을 사용하여 강력한 시작 신호를 생성합니다.

  1. 아론 지표: 오시일레이션 지표를 형성하기 위해 특정 기간 동안 가장 높고 가장 낮은 가격을 계산합니다. 여러 주기의 길이를 가진 아론 지표의 조합을 통해 트렌드 방향을 판단합니다.

  2. MA: 동향의 전환점을 결정하기 위해 단기 및 장기 MA의 교차점을 계산합니다.

  3. BB 대역: 가격이 BB 대역의 상단 레일을 뚫을 때, 그것은 판매 신호입니다.

  4. 윌리엄스 %R 지표: 개시 신호로서 과잉 매입 및 과잉 판매 영역에서 분리를 형성합니다.

  5. ADX: 트렌드의 강도를 판단합니다. 특정 위치 이상의 ADX는 개시 신호를 생성합니다.

위의 지표들은 서로 다른 사이클 길이의 매개 변수들로 다차원적인 판단 시스템을 형성하여 트렌드가 명백할 때 강력한 시작 신호를 생성할 수 있습니다.

특히 구매 조건은 다음과 같습니다.

  1. Aroon_1이 -85보다 작을 때
  2. MA가 황금색 십자가를 형성할 때
  3. 윌리엄스 %R가 -99보다 낮을 때
  4. ADX가 14보다 높을 때
  5. Aroon_2가 -39보다 크면

5가지 구매 조건 중 3가지가 충족되면 강력한 구매 신호가 생성됩니다.

판매 조건은 비슷합니다. 5가지 판매 조건이 있습니다. 그 중 3가지가 충족되면 판매 신호가 생성됩니다.

따라서 이 전략은 다른 지표의 조합을 통해 트렌드가 명백할 때 높은 확실성을 가진 강력한 시그널을 생성할 수 있습니다.

이점 분석

이 전략의 가장 큰 장점은 하나의 지표로 인한 잘못된 신호의 가능성을 크게 줄여 트렌드가 명백할 때 고품질의 개시 신호를 생성 할 수 있다는 지표 신호의 다차원적 조합입니다. 이것은이 전략의 가장 큰 하이라이트입니다.

다른 장점으로는 다음과 같습니다.

  1. 매개 변수는 다른 시장 특성에 적응하도록 조정할 수 있습니다.

  2. 지표의 매개 변수 설정은 과학적으로 합리적이고 매우 안정적입니다.

  3. 여러 시간 주기의 조합은 판단의 정확성을 향상시키기 위해 실현됩니다

  4. 코드의 구조는 명확하고 이해하기 쉽습니다

위험 분석

이 전략에는 또한 몇 가지 위험이 있습니다.

  1. 여러 가지 지표의 조합은 판단의 질을 향상시킬 수 있지만 전략의 복잡성을 증가시키고 과도한 최적화 위험을 확대합니다.

  2. 매개 변수 설정은 100% 완벽하지 않으며 특정 시장 조건에서 실패할 수 있습니다.

  3. 여전히 지표 방법의 조합에 최적화 할 여지가 있습니다. 조합 논리는 더 정교 할 수 있습니다.

  4. 단기적 인 적응 기회 를 놓칠 수 있습니다.

대응 솔루션:

  1. 매개 변수의 견고성을 테스트하기 위해 샘플 백테스팅을 증가

  2. 더 많은 시장에 적응하기 위해 몇 가지 매개 변수를 조정

  3. 판단 품질을 향상시키기 위해 지표 통합 방법을 최적화

  4. 단기 조정을 더 많이 포착하기 위해 일부 지표 매개 변수를 적절히 단축합니다.

최적화 방향

이 전략의 주요 최적화 방향은 주로 다음을 포함하는 지표 통합 방법의 최적화입니다.

  1. 판단의 정확성을 더 향상시키기 위해 더 다양한 유형의 지표를 추가하여 지표 숲을 형성합니다.

  2. 시장 변화에 자동적으로 적응하기 위해 지표 매개 변수 설정을 최적화

  3. 기계 학습 및 다른 방법을 사용하여 최적의 지표 통합 솔루션을 자동으로 검색하십시오.

  4. 위험을 통제하기 위한 스톱 로스 전략을 늘려

  5. 감정 지표를 결합하고 시장 열기를 판단하고 동적으로 매개 변수를 조정합니다

이 전략의 판단 품질과 견고성에는 더 많은 지표, 자동 최적화 매개 변수 및 통합 계획의 통합을 통해 여전히 개선 할 여지가 있습니다.

요약

이 전략의 가장 큰 하이라이트는 트렌드가 명백할 때 상당한 성능을 발휘하는 강력한 오픈 신호를 형성하기 위해 여러 지표의 과학적 통합입니다. 이 전략의 통합 방법에는 최적화의 여지가 많이 있습니다. 더 많은 지표와 매개 변수 및 통합 방법의 지능적인 최적화를 도입함으로써이 전략은 매우 강력한 양적 거래 전략이 될 수 있습니다.


/*backtest
start: 2023-12-19 00:00:00
end: 2024-01-18 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=3
strategy(title="Aroon+Williams+MA2+ADX+Aroon Str.", shorttitle="Aroon+Williams+MA2+ADX+Aroon Str.", overlay=true)
//https://cafe.naver.com/watchbot/1945
//<<빙썸 매각 기념>> 바이낸스 이오스 복합지표	

//Aroon_1
length_1 = input(264, minval=1, title="Length Aroon_1")
upper_1 = 100 * (highestbars(high, length_1+1) + length_1)/length_1
lower_1 = 100 * (lowestbars(low, length_1+1) + length_1)/length_1
midp_1 = 0
oscillator_1 = upper_1 - lower_1
//osc_1 = plot(oscillator_1, color=red)

//Aroon_2
length_2 = input(72, minval=1, title="Length Aroon_2")
upper_2 = 100 * (highestbars(high, length_2+1) + length_2)/length_2
lower_2 = 100 * (lowestbars(low, length_2+1) + length_2)/length_2
midp_2 = 0
oscillator_2 = upper_2 - lower_2
//osc_2 = plot(oscillator_2, color=red)

//Aroon_3
length_3 = input(137, minval=1, title="Length Aroon_3")
upper_3 = 100 * (highestbars(high, length_3+1) + length_3)/length_3
lower_3 = 100 * (lowestbars(low, length_3+1) + length_3)/length_3
midp_3 = 0
oscillator_3 = upper_3 - lower_3
//osc_3 = plot(oscillator_3, color=red)

//Aroon_4
length_4 = input(62, minval=1, title="Length Aroon_4")
upper_4 = 100 * (highestbars(high, length_4+1) + length_4)/length_4
lower_4 = 100 * (lowestbars(low, length_4+1) + length_4)/length_4
midp_4 = 0
oscillator_4 = upper_4 - lower_4
//osc_4 = plot(oscillator_4, color=red)

//Ma double
short_ma_1 = sma(close, 9)
long_ma_1 = sma(close, 21)
// plot(short_ma_1, color = red)
// plot(long_ma_1, color = green)
// plot(cross(short_ma_1, long_ma_1) ? short_ma_1 : na, style = cross, linewidth = 4)

short_ma_2 = sma(close, 9)
long_ma_2 = sma(close, 21)
// plot(short_ma_2, color = red)
// plot(long_ma_2, color = green)
plot(cross(short_ma_2, long_ma_2) ? short_ma_2 : na, transp= 100, title = "ma cross_2", style = cross, linewidth = 4)

//BB
length_bb = input(270, minval=1, title="BB length")
src_bb = input(close, title="Source")
mult_bb = input(2.0, minval=0.001, maxval=50, title="BB mult")
basis_bb = sma(src_bb, length_bb)
dev_bb = mult_bb * stdev(src_bb, length_bb)
upper_bb = basis_bb + dev_bb
lower_bb = basis_bb - dev_bb
// plot(basis_bb, color=red)
// p1 = plot(upper_bb, color=blue)
// p2 = plot(lower_bb, color=blue)
// fill(p1, p2)

//Williams
length_wil = input(130, minval=1, title="Length Williams %R")
upper_wil = highest(length_wil)
lower_wil = lowest(length_wil)
out_wil = 100 * (close - upper_wil) / (upper_wil - lower_wil)
// plot(out_wil)
// band1 = hline(-20)
// band0 = hline(-80)
// fill(band1, band0)



//ADX
adxlen = input(14, title="ADX Smoothing")
dilen = input(145, title="DI Length")
dirmov(len) =>
	up_adx = change(high)
	down_adx = -change(low)
	plusDM = na(up_adx) ? na : (up_adx > down_adx and up_adx > 0 ? up_adx : 0)
    minusDM = na(down_adx) ? na : (down_adx > up_adx and down_adx > 0 ? down_adx : 0)
	truerange = rma(tr, len)
	plus_adx = fixnan(100 * rma(plusDM, len) / truerange)
	minus_adx = fixnan(100 * rma(minusDM, len) / truerange)
	[plus_adx, minus_adx]

adx(dilen, adxlen) =>
	[plus_adx, minus_adx] = dirmov(dilen)
	sum_adx = plus_adx + minus_adx
	adx = 100 * rma(abs(plus_adx - minus_adx) / (sum_adx == 0 ? 1 : sum_adx), adxlen)

sig_adx = adx(dilen, adxlen)

// plot(sig_adx, color=red, title="ADX")


//ADX 2
adxlen_2 = input(14, title="ADX Smoothing")
dilen_2 = input(150, title="DI Length")
dirmov_2(len) =>
	up_adx_2 = change(high)
	down_adx_2 = -change(low)
	plusDM_2 = na(up_adx_2) ? na : (up_adx_2 > down_adx_2 and up_adx_2 > 0 ? up_adx_2 : 0)
    minusDM_2 = na(down_adx_2) ? na : (down_adx_2 > up_adx_2 and down_adx_2 > 0 ? down_adx_2 : 0)
	truerange_2 = rma(tr, len)
	plus_adx_2 = fixnan(100 * rma(plusDM_2, len) / truerange_2)
	minus_adx_2 = fixnan(100 * rma(minusDM_2, len) / truerange_2)
	[plus_adx_2, minus_adx_2]

adx_2(dilen_2, adxlen_2) =>
	[plus_adx_2, minus_adx_2] = dirmov_2(dilen_2)
	sum_adx_2 = plus_adx_2 + minus_adx_2
	adx_2 = 100 * rma(abs(plus_adx_2 - minus_adx_2) / (sum_adx_2 == 0 ? 1 : sum_adx_2), adxlen_2)

sig_adx_2 = adx(dilen_2, adxlen_2)

// plot(sig_adx_2, color=red, title="ADX_2")

//Input Position
//buy position
pos_aroon1 = input(-85, title="Aroon_1 Position Index_Down")
pos_madouble1_short = input(117, title="ma double_1 wma_Short")
pos_madouble1_long =  input(86, title="ma double_1 sma_Long")
pos_wil = input(-99, title="Williams Position Index_Down")
pos_adx= input(14, title="ADX Position Index_Up")
pos_aroon2 = input(-39, title="Aroon_2 Position Index_Up")

//sell position
pos_bb = input(120, title="BB Position Index_Up")
pos_aroon_3 = input(99, title="Aroon_3 Position Index_Up")
pos_madouble2_short= input(88, title="ma double_2 ema_Short")
pos_madouble2_long= input(96, title="ma double_2 sma_Long")
pos_adx_2= input(9, title="ADX_2 Position Index_Up")
pos_aroon_4 = input(35, title="Aroon_4 Position Index_Down")

//Condition
longCondition_aroon_1 = (oscillator_1 <= pos_aroon1)
longCondition_ma2 = (pos_madouble1_short > pos_madouble1_long)
longCondition_wil = (out_wil <= pos_wil)
longCondition_adx = (sig_adx >= pos_adx)
longCondition_aroon_2 = (oscillator_2 >= pos_aroon2)

shortCondition_bb = (close > basis_bb)
shortCondition_aroon_3 = (oscillator_3 >= pos_aroon_3)
shortCondition_ma2 = (pos_madouble2_short < pos_madouble2_long)
shortCondition_adx = (sig_adx_2 >= pos_adx_2)
shortCondition_aroon_4 = (oscillator_4 <= pos_aroon_4)

vl_aroon_1 = 0
vl_ma2 = 0
vl_wil = 0
vl_adx = 0
vl_aroon_2 = 0

if longCondition_aroon_1
    vl_aroon_1 := 1
    
if longCondition_ma2
    vl_ma2 := 3

if longCondition_wil
    vl_wil := 1
    
if longCondition_adx
    vl_adx := -1

if longCondition_aroon_2
    vl_aroon_2 := -1
	

vs_bb = 0
vs_aroon_3 = 0
vs_ma2 = 0
vs_adx = 0
vs_aroon_4 = 0

if shortCondition_bb
    vs_bb := 1

if shortCondition_aroon_3
    vs_aroon_3 := 1
    
if shortCondition_ma2
    vs_ma2 := 3

if shortCondition_adx
    vs_adx := -2

if shortCondition_aroon_4
    vs_aroon_4 := -1

// plotshape(vl_aroon_1, title= "vl_aroon_1", location=location.belowbar, color=green, text="vl_aroon_1")
// plotshape(vl_ma2, title= "vl_ma2", location=location.belowbar, color=green, text="\nvl_ma2")
// plotshape(vl_wil, title= "vl_wil", location=location.belowbar, color=green, text="\n\nvl_wil")
// plotshape(vl_adx, title= "vl_adx", location=location.belowbar, color=green, text="\n\n\nvl_adx")
// plotshape(vl_aroon_2, title= "vl_aroon_2", location=location.belowbar, color=green, text="\n\n\n\nvl_aroon_2")

// plotshape(vs_bb, title= "vs_bb", location=location.abovebar, color=orange, text="vs_bb")
// plotshape(vs_aroon_3, title= "vs_aroon_3", location=location.abovebar, color=orange, text="vs_aroon_3\n")
// plotshape(vs_ma2, title= "vs_ma2", location=location.abovebar, color=orange, text="vs_ma2\n\n")
// plotshape(vs_adx, title= "vs_adx", location=location.abovebar, color=orange, text="vs_adx\n\n\n")
// plotshape(vs_aroon_4, title= "vs_aroon_4", location=location.abovebar, color=orange, text="vs_aroon_4\n\n\n\n")

longCondition = (vl_aroon_1 + vl_ma2 + vl_wil + vl_adx + vl_aroon_2) >= 3 ? true : na
shortCondition = (vs_bb + vs_aroon_3 + vs_ma2 + vs_adx + vs_aroon_4) >= 3 ? true : na

buy = longCondition == 1 ? longCondition : na
sell = shortCondition == 1? shortCondition : na

// plotshape(buy, title= "buy", location=location.bottom, color=green, text="buy")
// plotshape(sell, title= "sell", location=location.top, color=orange, text="sell")


// === BACKTEST RANGE ===
FromMonth = input(defval = 8, title = "From Month", minval = 1, maxval = 12)
FromDay   = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
FromYear  = input(defval = 2018, title = "From Year", minval = 2014)
ToMonth   = input(defval = 12, title = "To Month", minval = 1, maxval = 12)
ToDay     = input(defval = 31, title = "To Day", minval = 1, maxval = 31)
ToYear    = input(defval = 2018, title = "To Year", minval = 2014)

strategy.entry("L", strategy.long, when=(buy))
strategy.close("L", when=(sell))
// strategy.entry("S", strategy.short, when=(sell and (time >= timestamp(FromYear, FromMonth, FromDay, 00, 00)) and (time <= timestamp(ToYear, ToMonth, ToDay, 23, 59))))
// strategy.close("S", when=(buy and (time <= timestamp(ToYear, ToMonth, ToDay, 23, 59))))

더 많은