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