
The strategy named “DCA Booster (1 minute)” is a high-frequency trading strategy that operates on a one-minute timeframe. The strategy combines Bollinger Bands and Dollar-Cost Averaging (DCA) techniques to capitalize on market fluctuations by making multiple buys and sells, aiming to generate profits. The main idea of the strategy is: when the price falls below the lower Bollinger Band for two consecutive periods, it starts building positions using DCA; when the price rises above the upper Bollinger Band, it closes all positions. Additionally, the strategy allows pyramiding, meaning it can continue adding positions if the price keeps falling.
“DCA Booster (1 minute)” is a high-frequency trading strategy that combines Bollinger Bands and DCA. It aims to capture market fluctuations and generate profits by building positions when the price is below the lower Bollinger Band and closing positions when the price crosses above the upper Bollinger Band. The strategy allows pyramiding but also faces risks such as drastic market volatility and overexposure. By introducing stop-losses, optimizing the pyramiding logic, incorporating other indicators, and optimizing parameters, the performance of this strategy can be further improved.
/*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