Chiến lược chốt lời theo bậc Bollinger Bandit

BOLLINGER SMA stdev TP SL
Ngày tạo: 2025-08-26 11:39:47 sửa đổi lần cuối: 2025-08-26 11:39:47
sao chép: 5 Số nhấp chuột: 309
2
tập trung vào
319
Người theo dõi

Chiến lược chốt lời theo bậc Bollinger Bandit Chiến lược chốt lời theo bậc Bollinger Bandit

Ồ, chiến thuật này mạnh đến mức nào?

Bạn có biết không? Chiến lược Blink Thief này giống như một tay bắn tỉa trong thị trường! Ồ, nó không phải là loại bắn ngẫu nhiên, mà là một chiến lược nhắm vào “những kẻ vượt biên” ở rìa của Blink.

: logic cốt lõi rất đơn giản.

Trong khi đó, những người dân Việt Nam đang phải đối mặt với những vấn đề khác nhau, như vấn đề dân sự, vấn đề dân sự, vấn đề xã hội, vấn đề xã hội.

  • Giá giảm xuống đường = Bán quá mức, sẵn sàng làm nhiều hơn!
  • Giá đã vượt qua đường ray = mua quá mức, sẵn sàng để làm trống! Giống như một lò xo, càng ép càng mạnh, lò xo sẽ phản ứng mạnh hơn. Dải Brin là công cụ trực quan của “lò xo” này, đường trung bình 20 ngày là trục trung bình, đường ray lên xuống là giới hạn.

Sự kỳ diệu của loại thuốc chống nôn

Không giống như một chiến lược “một lần”, chiến lược này giống như một thương gia thông minh:

  • TP1 đạt được, đầu tiên túi 50% lợi nhuận ((3 điểm)
  • 50% còn lại tiếp tục nắm giữ, 5 điểm)
  • Nếu bạn không thể làm được điều đó, hãy cố gắng giữ 5 điểm để tránh bị hư hỏng.

Nó giống như bán hàng mặt hàng, bán một nửa số tiền trước, và chờ đợi giá tốt hơn!

Đề xuất bố trí chiến đấu

Hướng dẫn thoát hố đã đến!

  • Lựa chọn chu kỳ20 ngày là cấu hình cổ điển, nhưng bạn có thể điều chỉnh tùy theo loại giao dịch
  • Cài đặt nhânĐộ lệch tiêu chuẩn 0.1 lần phù hợp với hầu hết các trường hợp, các giống có biến động lớn có thể được điều chỉnh thành 1.5-2.0
  • Stop Loss3: 5/5/5 cấu hình rất bảo thủ, một chút cực đoan có thể thử 5/8/10

Hãy nhớ rằng: chiến lược này là tốt nhất cho các biến động, hãy cẩn thận với các lỗ hổng “bước đột phá giả” trong xu hướng đơn phương!

Tại sao họ lại chọn chiến lược này?

Nếu bạn là một nhà giao dịch thích “thắng ổn định”, thì chiến lược này hoàn toàn phù hợp với bạn! Nó sẽ không làm bạn giàu đột ngột, nhưng nó có thể giúp bạn kiếm được lợi nhuận ổn định trong sự biến động của thị trường. Giống như mở một nhà hàng, không phải là để tràn ngập hàng ngày, nhưng đảm bảo có lưu lượng khách hàng ổn định mỗi ngày!

Mã nguồn chiến lược
/*backtest
start: 2024-08-25 00:00:00
end: 2025-01-01 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT"}]
*/

//@version=6
strategy("Bollinger Bandit + TP Escalonado", overlay=true)

// Configuración básica
length = input.int(20, "Periodo", minval=1)
mult = input.float(1.0, "Multiplicador", minval=0.1, maxval=3.0)
source = input(close, "Fuente")

// Opción para cierre en media
close_on_ma = input.bool(true, "Cierre en Media Móvil")

// SL/TP CONFIGURABLE CON NIVELES FIJOS
use_sltp = input.bool(true, "Usar SL/TP Personalizado", group="Gestión de Riesgo")
sl_points = input.int(5, "Puntos para SL", minval=1, group="Gestión de Riesgo")
tp1_points = input.int(3, "Puntos para TP1", minval=1, group="Gestión de Riesgo")
tp2_points = input.int(5, "Puntos para TP2", minval=1, group="Gestión de Riesgo")

// MOSTRAR TEXTO DE PRECIO
show_price_text = input.bool(true, "Mostrar Precio SL/TP", group="Visualización")

// Cálculo de las Bandas de Bollinger
basis = ta.sma(source, length)
dev = mult * ta.stdev(source, length)
upper = basis + dev
lower = basis - dev

// Detección de cruces
longCondition = ta.crossover(close, lower)
shortCondition = ta.crossunder(close, upper)

// Cálculo de SL/TP con niveles FIJOS EXACTOS - CORREGIDO
var float last_sl_price = na
var float last_tp1_price = na
var float last_tp2_price = na
var int last_entry_bar = 0
var float last_entry_price = na
var bool last_is_long = false

if longCondition or shortCondition
    last_entry_price := close
    last_is_long := longCondition
    if longCondition
        // COMPRA: SL = entrada - 5 puntos, TP1 = entrada + 3 puntos, TP2 = entrada + 5 puntos
        last_sl_price := last_entry_price - sl_points
        last_tp1_price := last_entry_price + tp1_points
        last_tp2_price := last_entry_price + tp2_points
    else
        // VENTA: SL = entrada + 5 puntos, TP1 = entrada - 3 puntos, TP2 = entrada - 5 puntos
        last_sl_price := last_entry_price + sl_points
        last_tp1_price := last_entry_price - tp1_points
        last_tp2_price := last_entry_price - tp2_points
    last_entry_bar := bar_index

// Entradas
if (longCondition)
    strategy.entry("Long", strategy.long)
    
if (shortCondition)
    strategy.entry("Short", strategy.short)

// DETECCIÓN DE CIERRES CON TEXTO PERSONALIZADO
var bool long_closed_by_sl = false
var bool long_closed_by_tp1 = false
var bool long_closed_by_tp2 = false
var bool short_closed_by_sl = false
var bool short_closed_by_tp1 = false
var bool short_closed_by_tp2 = false

// Para posiciones LARGAS
if (use_sltp and strategy.position_size > 0)
    if low <= last_sl_price
        strategy.close("Long", comment="LongSL")
        long_closed_by_sl := true
    else if high >= last_tp1_price and not long_closed_by_tp1
        strategy.close("Long", qty_percent=50, comment="LongTP1")
        long_closed_by_tp1 := true
    else if high >= last_tp2_price and not long_closed_by_tp2
        strategy.close("Long", comment="LongTP2")
        long_closed_by_tp2 := true
else if (strategy.position_size > 0)
    if (ta.crossunder(close, upper))
        strategy.close("Long", comment="STOP")
    if (close_on_ma and ta.crossunder(close, basis))
        strategy.close("Long", comment="STOPMedia")

// Para posiciones CORTAS
if (use_sltp and strategy.position_size < 0)
    if high >= last_sl_price
        strategy.close("Short", comment="ShortSL")
        short_closed_by_sl := true
    else if low <= last_tp1_price and not short_closed_by_tp1
        strategy.close("Short", qty_percent=50, comment="ShortTP1")
        short_closed_by_tp1 := true
    else if low <= last_tp2_price and not short_closed_by_tp2
        strategy.close("Short", comment="ShortTP2")
        short_closed_by_tp2 := true
else if (strategy.position_size < 0)
    if (ta.crossover(close, lower))
        strategy.close("Short", comment="STOP")
    if (close_on_ma and ta.crossover(close, basis))
        strategy.close("Short", comment="STOPMedia")

// Reset flags cuando no hay posición
if strategy.position_size == 0
    long_closed_by_sl := false
    long_closed_by_tp1 := false
    long_closed_by_tp2 := false
    short_closed_by_sl := false
    short_closed_by_tp1 := false
    short_closed_by_tp2 := false

// Visualización (manteniendo tus colores y estilo)
plot(basis, "Media", color=color.blue, linewidth=1)
plot(upper, "Banda Superior", color=color.orange, linewidth=2)
plot(lower, "Banda Inferior", color=color.green, linewidth=2)

// Señales de entrada
plotshape(longCondition, "↑ Compra", shape.triangleup, location.belowbar, color=color.green, size=size.tiny)
plotshape(shortCondition, "↓ Venta", shape.triangledown, location.abovebar, color=color.red, size=size.tiny)

// Relleno entre bandas (manteniendo tu estilo)
bgcolor = color.new(color.yellow,80)
fill(plot(upper), plot(lower), bgcolor)