달러 비용 평균화 전략

저자:차오장, 날짜: 2023-09-15 16:52:06
태그:

이 전략은 달러 비용 평균화 전략 (Dollar Cost Averaging Strategy) 라고 불립니다. 주기적인 고정 금액 구매를 통해 목표 지점 크기를 축적하여 장기 보유를 가능하게합니다.

어떻게 작동하는지:

  1. 고정된 구매 금액과 주파수를 설정하세요.
  2. 정해진 금액에 따라 일정 간격으로 주기적으로 매입을 합니다.
  3. 누적된 포지션 크기가 임계치에 도달하면 판매합니다.
  4. 순차적으로 순위를 계속 축적하기 위해 반복합니다.

일반적인 작업 흐름:

  1. 일정 금액의 자산을 주기적으로 구매합니다. (예를 들어, 매달 200달러).
  2. 누적된 포지션 크기가 한 임계치를 초과할 때 모든 것을 매각한다 (예를 들어 200개의 주식).
  3. 순차적인 구매를 다시 시작해서 포지션을 계속 축적해

이 전략의 장점:

  1. 장기 보유로 평균 비용이 낮습니다.
  2. 마감 위험을 줄이고, 높은 가격으로 구매를 피합니다.
  3. 시장 모니터링이 필요 없이 일관성 있게 실행하기 쉽습니다.

이 전략의 위험:

  1. 장기적인 보유 기간이 필요하고, 단기 가격 변동에 적응할 수 없습니다.
  2. 장기적인 하락 추세에서 손실을 입을 수 있습니다.
  3. 최저 출구 타이밍은 최고의 판매점을 놓칠 수 있습니다.

요약하자면, 달러 비용 평균화 전략은 장기 투자자들에게 친근한 팩트 구매를 통해 자산을 축적합니다. 그러나 거래자는 여전히 광범위한 시장 위험을 경계하고 높은 가격에서 팩트 판매를 통해 이익을 극대화하기 위해 출구 전략을 최적화해야합니다.


/*backtest
start: 2022-09-08 00:00:00
end: 2023-09-14 00:00:00
period: 1d
basePeriod: 1h
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/
// © tanoshimooo

//@version=5
strategy ("DCA", initial_capital=44700, overlay=true)

// To start script at a given date
tz = 0 //timezone
timeadj = time + tz * 60 * 60 * 1000 //adjust the time (unix)
t1 = timeadj >= timestamp(2003, 03, 01, 0, 0) ? 1 : 0 //get the starting time

// Variables
var float lastRef = na
if barstate.isfirst
    lastRef := close
var float cash = 50000 // available money
var float sell_contracts = na
var bool first_trade_done = false

// Parameters
var float sell_min = 200 //200 sell more than sell_min or sell all
var float buy_dollars = 200

var int bi = 90

// LONGS
// if bar_index < bi
strategy.order("Long", strategy.long, int(buy_dollars/close))
cash := cash - int(buy_dollars/close)*close
// label.new(bar_index, na, na, xloc.bar_index, yloc.abovebar, color.blue, label.style_triangleup, color.blue, size.tiny)

//plot(cash)

// SHORTS
// if longExit  
//     if (strategy.position_size*sf*close > sell_min) and (strategy.position_size*sf >= 1)
//         strategy.order ("Long", strategy.short, strategy.position_size*sf)
//         cash := cash + strategy.position_size*sf*close
//     else 
//         strategy.order ("Long", strategy.short, strategy.position_size)
//         cash := cash + strategy.position_size*close
//     lastRef := close
//     label.new(bar_index, na, na, xloc.bar_index, yloc.belowbar, color.red, label.style_triangledown, color.red, size.tiny)

if bar_index == last_bar_index - 2 // bi
    strategy.order ("Long", strategy.short, strategy.position_size)

더 많은