구성 가능한 BB+RSI+Aroon 전략


생성 날짜: 2023-09-21 15:05:38 마지막으로 수정됨: 2023-09-21 15:05:38
복사: 0 클릭수: 739
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

개요

이 전략은 브린 밴드 (BB), 상대적으로 강한 지수 (RSI) 및 아론 지표를 결합하여 각 지표의 장점을 활용하여 거래에 대한 효율적인 입출력 신호를 제공합니다.

전략 원칙

  1. 가격이 부린의 하위역을 뚫을 때, 다중선 신호를 표시한다.

  2. RSI 상에서 오버 바이 라인을 통과할 때, 다중 헤드 확인 신호를 표시한다.

  3. Aroon이 위를 누르면 다중 머리 확인 신호가 표시됩니다.

  4. 이 세가지 조건이 모두 충족되면 더 많이 하세요.

  5. 가격이 부린의 상반대를 넘어서면 공중 신호가 표시됩니다.

  6. RSI 아래에서 초상가 선을 넘으면 공중 확인 신호가 표시됩니다.

  7. Aroon 아래에서 착용할 때, 공중 머리 확인 신호를 표시한다.

  8. 위의 세 가지 조건이 동시에 충족되면, 공백을 다.

전략적 이점

  • 최적의 조합으로 최적화 가능한 변수
  • 다양한 지표 확인, 신호 정확도 향상
  • 다양한 시장 환경에 적합하다
  • 간단한 거래 논리, 실행하기 쉬운

전략적 위험

  • 파라미터를 적절하게 최적화하지 않고 너무 많은 오류 신호를 생성할 수 있습니다.
  • 다중 지표의 부진으로 급격한 전환이 놓칠 수 있습니다.
  • 역기술은 거래의 빈도와 비용을 증가시킵니다.

최적화 방향

  • 다중 시장 다중 시간 프레임 리테스트
  • 각 지표의 효과를 평가하고 필요한 경우 삭제합니다.
  • 기계 학습에 기반한 변수 최적화를 시도합니다.
  • 정책 코드를 최적화하여 계산량을 줄여줍니다.
  • 다른 지주 시간 변수를 테스트합니다.

요약하다

이 전략은 여러 지표의 장점을 통합하여 강력한 입문 신호를 형성한다. 매개 변수 최적화, 불필요한 지표 제거 및 최적화 코드를 통해 전략 효과를 더 높은 수준으로 끌어 올릴 수 있다. 전체적으로 이 전략은 거래에 대한 효과적인 맞춤형 솔루션을 제공합니다.

전략 소스 코드
/*backtest
start: 2023-09-13 00:00:00
end: 2023-09-20 00:00:00
period: 5m
basePeriod: 1m
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/
// Developed by Marco Jarquin as part of Arkansas 22 Project for Binary Options
// CBRA for binary options (Configurable Bollinger Bands, RSI and Aroon)

//@version=4
// ====================================================================================

//strategy("A22.CBRA.Strat", overlay=true, initial_capital=10000, currency="USD", calc_on_every_tick=true, default_qty_type=strategy.cash, default_qty_value=4000, commission_type=strategy.commission.cash_per_order, commission_value=0)

// Aroonish Parameters
// ====================================================================================

Aroonish_length = input(4, minval=1, title="Aroonish Lenght")
Aroonish_ConfVal = input(50, minval=0, maxval=100, step=25, title="Aroonish Confirmation Value")
Aroonish_upper = 100 * (-highestbars(high, Aroonish_length+1) + Aroonish_length)/Aroonish_length
Aroonish_lower = 100 * (-lowestbars(low, Aroonish_length+1) + Aroonish_length)/Aroonish_length

// Aroonish confirmations
// ====================================================================================
Aroonish_ConfLong = (Aroonish_lower >= Aroonish_ConfVal) and (Aroonish_upper < Aroonish_lower)
Aroonish_ConfShrt = (Aroonish_upper >= Aroonish_ConfVal) and (Aroonish_upper > Aroonish_lower)

plotshape(crossover(Aroonish_lower, Aroonish_upper), color = color.red, style = shape.triangledown, location = location.abovebar, size = size.auto, title = "Ar-B")
plotshape(crossover(Aroonish_upper, Aroonish_lower), color = color.green, style = shape.triangleup, location = location.belowbar, size = size.auto, transp = 0, title = "Ar-S")

// RSI Parameters
// ====================================================================================
RSI_length = input(4, title="RSI Lenght")
RSI_overSold = input(20, title="RSI Oversold Limit")
RSI_overBought = input(80, title="RSI Overbought Limit" )

RSI = rsi(close, RSI_length)

plotshape(crossover(RSI, RSI_overSold), color = color.orange, style = shape.square, location = location.belowbar, size = size.auto, title = "RSI-B")
plotshape(crossunder(RSI, RSI_overBought), color = color.orange, style = shape.square, location = location.abovebar, size = size.auto, transp = 0, title = "RSI-S")

// Bollinger Parameters
// ====================================================================================
BB_length = input(20, minval=1, title="Bollinger Lenght")
BB_mult = input(2.5, minval=0.1, maxval=50, step=0.1, title="Bollinger Std Dev")
// BB_bars = input(3, minval=1, maxval=5, title="Check bars after crossing")

BB_basis = sma(close, BB_length)
BB_dev = BB_mult * stdev(close, BB_length)

BB_upper = BB_basis + BB_dev
BB_lower = BB_basis - BB_dev

p1 = plot(BB_upper, color=color.blue)
p2 = plot(BB_lower, color=color.blue)

// Bars to have the operation open
// ====================================================================================
nBars = input(3, minval=1, maxval=30, title="Bars to keep the operation open")

// Strategy condition short or long
// ====================================================================================
ConditionShrt = ((crossunder(close, BB_upper) or crossunder(close[1], BB_upper[1])) and Aroonish_ConfShrt) and (crossunder(RSI, RSI_overBought) or crossunder(RSI[1], RSI_overBought[1]))
ConditionLong = ((crossover(close, BB_lower) or crossover(close[1], BB_lower[1])) and Aroonish_ConfLong) and (crossover(RSI, RSI_overSold) or crossover(RSI[1], RSI_overSold[1]))

plotshape(crossover(close, BB_lower), color = color.blue, style = shape.circle, location = location.belowbar, size = size.auto, title = "BB-B")
plotshape(crossunder(close, BB_upper), color = color.blue, style = shape.circle, location = location.abovebar, size = size.auto, transp = 0, title = "BB-S")


// Make input options that configure backtest date range
// ====================================================================================
iMo = input(title="Start Month", type=input.integer, defval=1, minval=1, maxval=12)
iDy = input(title="Start Date", type=input.integer, defval=1, minval=1, maxval=31)
iYr = input(title="Start Year", type=input.integer, defval=(2020), minval=1800, maxval=2100)

eMo = input(title="End Month", type=input.integer, defval=1, minval=1, maxval=12)
eDy = input(title="End Date", type=input.integer, defval=1, minval=1, maxval=31)
eYr = input(title="End Year", type=input.integer, defval=(2021), minval=1800, maxval=2100)

// Look if the close time of the current bar falls inside the date range
// ====================================================================================
inDateRange = true


// Evaluates conditions to enter short or long
// ====================================================================================
if (inDateRange and ConditionLong)
    strategy.entry("A22.L", strategy.long)

if (inDateRange and ConditionLong[nBars])
    strategy.close("A22.L", comment="A22.L Exit")
    
if (inDateRange and ConditionShrt)
    strategy.entry("A22.S", strategy.short)

if (inDateRange and ConditionShrt[nBars])
    strategy.close("A22.S", comment="A22.S Exit")

if (not inDateRange)
    strategy.close_all()