볼린저 밴딧 티어 이익실현 전략

BOLLINGER SMA stdev TP SL
생성 날짜: 2025-08-26 11:39:47 마지막으로 수정됨: 2025-08-26 11:39:47
복사: 5 클릭수: 309
avatar of ianzeng123 ianzeng123
2
집중하다
319
수행원

볼린저 밴딧 티어 이익실현 전략 볼린저 밴딧 티어 이익실현 전략

, 이 전략이 얼마나 강력한가?

이 ‘블린 강도’ 전략은 시장의 저격수와 비슷하다! 오, 이건 무작위적으로 총을 쏘는 것이 아니라, 브린의 가장자리에 있는 ‘범죄자’를 겨냥하는 전략이다. 가격들이 ‘보안 구역’을 벗어나게 되면, 이 전략은 반발 기회를 잡을 수 있다!

의 핵심 논리는 매우 간단합니다.

이 전략의 핵심은 “반전 사고”입니다.

  • 가격 하락 = 과매매, 더 많이 할 준비!
  • 가격 폭격 = 과대 구매, 공백 준비! 스프링과 마찬가지로, 압력을 더 많이 가하면 반발이 더 강하다. 브린띠는 이 “스프링”의 시각적 도구이며, 20일 평균선은 중축이며, 상하 궤도는 한계이다. 위치

의 마법적 매력

“일단”이라는 전통적인 전략과는 달리, 이 전략은 현명한 상인들과 비슷합니다.

  • TP1에 도달하면 50%의 수익을 다.
  • 나머지 50%를 계속 보유합니다.
  • 만약 상황이 좋지 않다면, 5가지의 손해 방지 기능이 있습니다.

이것은 마치 현금 판매와 같습니다. 절반을 팔고 나머지는 더 좋은 가격에 팔죠!

실전 배치 제안

웅덩이 안내서가 왔어요!

  • 주기 선택20일: 고전적인 구성이지만 거래 유형에 따라 조정할 수 있습니다.
  • 배수 설정0.1배의 표준 차이는 대부분의 경우에 적합하며, 변동이 큰 품종은 1.5-2.0으로 조정할 수 있습니다.
  • 정지 손실3/5/5의 구성은 보수적이어서 조금 극단적이면 시도해 볼 수 있습니다. 5/8/10

기억하세요: 이 전략은 변동적인 상황에 가장 적합하며, 일방적인 추세에서는 “거짓 돌파구”에 빠지지 않도록 조심하세요!

: 왜 이런 전략을 택했나요?

이 전략은 당신을 하루아침에 부자가 만들지는 않지만, 시장의 변동 속에서 안정적으로 수익을 얻을 수 있습니다. 마치 레스토랑을 열고 매일 가득 채워지기를 바라지 않고 매일 안정적인 고객 유입을 보장하는 것과 같습니다!

전략 소스 코드
/*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)