볼린저 밴드와 DCA를 결합한 고빈도 거래 전략


생성 날짜: 2024-03-29 16:20:13 마지막으로 수정됨: 2024-03-29 16:20:13
복사: 5 클릭수: 828
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

볼린저 밴드와 DCA를 결합한 고빈도 거래 전략

개요

이 전략은 “DCA Booster (1 minute) “라고 불리며, 1 분 시간 프레임에 실행되는 고주파 거래 전략이다. 이 전략은 부린밴드와 DCA ((Dollar-Cost Averaging, 달러 비용 평균법) 두 가지 기술을 결합하여, 시장의 변동성을 이용하여 이익을 얻으려는 시도를 한다. 전략의 주요 아이디어는: 가격이 부린밴드보다 2 회 연속으로 낮아지면, DCA 방식으로 대량 포지션을 구축하기 시작하며, 가격이 부린밴드를 통과하면 모든 포지션을 평행한다.

전략 원칙

  1. 브린 띠를 계산: 간단한 이동 평균과 표준 차이를 사용하여 브린 띠의 오르락 내리락을 계산한다.
  2. DCA 파라미터를 설정합니다. 매장당 DCA 금액으로 고정 금액을 여러 부분으로 나누십시오.
  3. 포지션 구축 조건: 종식 가격이 두 차례 연속으로 부린 반도 하향 궤도보다 낮으면 포지션을 구축하기 시작합니다. 가격이 하향 궤도보다 낮게 지속되는지에 따라 전략은 최대 5개의 포지션을 구축할 수 있습니다.
  4. 평정상대 조건: 가격이 브린을 뚫고 궤도에 올랐을 때, 모든 포지션을 평정한다.
  5. 피라미드 포지션: 가격이 계속 하락하면, 전략은 최대 5개의 포지션을 추가할 수 있다.
  6. 포지션 관리: 전략은 각 포지션의 포지션 구축 상황을 기록하고, 평상시 조건이 충족되면 평상시의 포지션을 평상한다.

전략적 이점

  1. 브린 띠와 DCA 기술을 결합하여 시장의 변동성을 효과적으로 포착하고 구매 비용을 절감합니다.
  2. 피라미드 상장을 허용하여 가격 하락이 지속되는 동안 상장을 계속하고 수익을 올릴 수 있습니다.
  3. 평지 조건은 간단하고 명확하며, 수익을 빠르게 고정시킬 수 있습니다.
  4. 1분과 같은 짧은 시간 프레임에 사용하기에 적합하며, 고주파 거래가 가능합니다.

전략적 위험

  1. 만약 시장이 급격하게 변동하면, 가격이 브린을 빠르게 뚫고 궤도에 올랐을 경우, 전략이 평준화되지 않아 손실을 초래할 수 있다.
  2. 피라미드 가설은 가격이 계속 하락할 경우 과잉 노출을 초래할 수 있으며 위험을 증가시킬 수 있습니다.
  3. 이 전략은 종종 거래가 이루어지고 거래비용이 높아지기 때문에 불안정한 시장에서 더 잘 작동하지 않을 수 있습니다.

전략 최적화 방향

  1. 단일 거래의 최대 손실을 제어하기 위해 평점 조건에 스톱로스를 추가하는 것을 고려할 수 있습니다.
  2. 피라미드 가설의 논리를 최적화 할 수 있습니다. 예를 들어, 가격 하락의 정도에 따라 가설량을 조정하여 과잉 노출을 피하십시오.
  3. 다른 지표와 결합할 수 있습니다. RSI, MACD 등과 같이, 진출과 출전의 정확성을 높이기 위해.
  4. 브린 밴드의 주기 및 표준 차이의 배수와 같은 파라미터를 최적화하여 다른 시장 상황에 맞게 조정할 수 있다.

요약하다

“DCA Booster (1 minute) “는 부린 띠와 DCA를 결합한 고주파 거래 전략으로, 부린 띠 아래로 떨어질 때 포지션을 세분화하고, 가격에 부린 띠가 오르면 포지션을 청산하여 시장의 변동성을 포착하여 수익을 얻으려고 시도한다. 이 전략은 피라미드 포지션을 허용하지만, 시장의 급격한 변동과 과도한 노출의 위험에 직면하고 있다.

전략 소스 코드
/*backtest
start: 2024-02-27 00:00:00
end: 2024-03-28 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("DCA Booster (1 minute)",
  overlay=true )

// Parameters for Bollinger Bands
length = input.int(50, title="BB Length")
mult = input.float(3.0, title="BB Mult")

// Bollinger Bands calculation
basis = ta.sma(close, length)
dev = mult * ta.stdev(close, length)
upper = basis + dev
lower = basis - dev

// Variables for DCA
cantidad_dolares = 50000
orden1 = cantidad_dolares / close
orden2 = orden1 * 1.2
orden3 = orden2 * 1.3
orden4 = orden3 * 1.5
orden5 = orden4 * 1.5

// Variables for tracking purchases
var comprado1 = false
var comprado2 = false
var comprado3 = false
var comprado4 = false
var comprado5 = false

// Buy conditions
condicion_compra1 = close < lower and close[1] < lower[1] and not comprado1
condicion_compra2 = close < lower and close[1] < lower[1] and comprado1 and not comprado2
condicion_compra3 = close < lower and close[1] < lower[1] and comprado2 and not comprado3
condicion_compra4 = close < lower and close[1] < lower[1] and comprado3 and not comprado4
condicion_compra5 = close < lower and close[1] < lower[1] and comprado4 and not comprado5
// Variables de control
var int consecutive_closes_below_lower = 0
var int consecutive_closes_above_upper = 0

// Entry logic
if condicion_compra1 and barstate.isconfirmed
    consecutive_closes_below_lower := consecutive_closes_below_lower + 1
    if consecutive_closes_below_lower >= 2
        strategy.entry("Compra1", strategy.long, qty=orden1)
        comprado1 := true
        consecutive_closes_below_lower := 0

if condicion_compra2 and barstate.isconfirmed
    consecutive_closes_below_lower := consecutive_closes_below_lower + 1
    if consecutive_closes_below_lower >= 2
        strategy.entry("Compra2", strategy.long, qty=orden2)
        comprado2 := true
        consecutive_closes_below_lower := 0

if condicion_compra3 and barstate.isconfirmed
    consecutive_closes_below_lower := consecutive_closes_below_lower + 1
    if consecutive_closes_below_lower >= 2
        strategy.entry("Compra3", strategy.long, qty=orden3)
        comprado3 := true
        consecutive_closes_below_lower := 0

if condicion_compra4 and barstate.isconfirmed
    consecutive_closes_below_lower := consecutive_closes_below_lower + 1
    if consecutive_closes_below_lower >= 2
        strategy.entry("Compra4", strategy.long, qty=orden4)
        comprado4 := true
        consecutive_closes_below_lower := 0

if condicion_compra5 and barstate.isconfirmed
    consecutive_closes_below_lower := consecutive_closes_below_lower + 1
    if consecutive_closes_below_lower >= 2
        strategy.entry("Compra5", strategy.long, qty=orden5)
        comprado5 := true
        consecutive_closes_below_lower := 0


// Sell conditions
if close > upper  and comprado1 and barstate.isconfirmed
    strategy.close("Compra1")
    comprado1 := false

if close > upper  and comprado2 and barstate.isconfirmed
    strategy.close("Compra2")
    comprado2 := false

if close > upper  and comprado3 and barstate.isconfirmed
    strategy.close("Compra3")
    comprado3 := false

if close > upper and comprado4 and barstate.isconfirmed
    strategy.close("Compra4")
    comprado4 := false

if close > upper and comprado5 and barstate.isconfirmed
    strategy.close("Compra5")
    comprado5 := false