힘의 돌파구 전략

저자:차오장, 날짜: 2024-01-24 11:25:01
태그:

img

전반적인 설명

포스 브레이크로우 전략 (Force Breakthrough Strategy) 은 이동 평균과 상대적 강도 지수 (RSI) 를 기반으로 하는 양적 거래 전략이다. 주요 이동 평균의 가격 돌파구를 모니터링하여 시장 트렌드 방향을 감지하고 RSI 지표를 사용하여 엔트리 신호를 결정한다. 핵심 아이디어는 가격이 이동 평균을 침투할 때 거래 신호를 발행하는 것이며, RSI 지표의 과잉 구매/ 과잉 판매 신호와 결합된다.

전략 논리

포스 브레이크루스 전략은 두 개의 이동 평균을 사용합니다. 첫 번째는 빠른 이동 평균으로 10 기간 EMA입니다. 두 번째는 느린 이동 평균으로 200 기간 EMA입니다. 빠른 선은 현재 가격 추세를 나타내고 느린 선은 장기 가격 추세를 나타냅니다. 가격이 상승하고 10 일선 이상으로 침투하면 상승 신호입니다. 가격이 떨어지고 10 일선 아래에 침투하면 하향 신호입니다.

이 전략은 또한 특정 입점 순간을 결정하기 위해 RSI 지표를 포함합니다. 가격이 상승 추세에 있고 RSI 낮은 지점이 빠른 이동 평균 이하로 나타나면 (RSI는 5 이하로 떨어집니다), 긴 신호가 유발됩니다. 가격이 하락 추세에 있고 RSI 높은 지점이 빠른 이동 평균 이상으로 나타나면 (RSI는 95를 초과합니다), 짧은 신호가 유발됩니다.

스톱 로즈 원칙은 긴 포지션과 짧은 포지션을 취한 후 가격이 10일 이동 평균을 다시 깨는 경우 포지션을 종료하는 것입니다.

이점 분석

이 전략의 가장 큰 장점은 강한 트렌드를 따르는 능력이다. 이동 평균 자체는 우수한 트렌드 판단 기능을 가지고 있다. 이 전략은 빠른 라인이 단기 트렌드를 판단하고 느린 라인이 장기 트렌드를 판단하는 빠른 라인의 강점을 최대한 활용한다. 빠른 라인이 느린 라인의 상향 침투를 갖는 경우 단기 및 장기 상승 추세를 나타냅니다. 이는 강력한 구매 신호입니다.

또한 RSI 지표의 추가는 전략의 이점을 강화합니다. RSI의 높은-저하점을 결합하면 과잉 구매 또는 과잉 판매 조건이 발생할 때 효과적으로 거래 신호를 발산 할 수 있으며, 잠재적 인 반전 지점에 참여하여 실제 성과를 향상시킬 수 있습니다.

위험 분석

비록 전략은 상대적으로 강한 트렌드 추적 능력을 가지고 있지만 기술 지표 전략은 손실을 완전히 피할 수 없습니다.

  1. 가격이 급격히 변동할 때, 이동 평균에 의해 생성되는 거래 신호는 지연될 수 있습니다.

  2. RSI 인디케이터는 오차가 발생하기 때문에 트레이드 신호 판단이 잘못될 수 있습니다.

  3. 장기적인 운영에 대한 부적절한 매개 변수들은 과잉 거래로 이어질 수 있습니다.

위험을 완화하기 위해, 이동 평균과 RSI와 같은 매개 변수는 조정되고 최적화 될 수 있으며, 중지 손실 범위는 합리적으로 느슨하게 할 수 있으며, 포지션 크기는 적절하게 제어 될 수 있습니다. 최적화된 매개 변수 조합은 검증을 위해 철저하게 백테스트되어야합니다.

최적화 방향

전략의 더 많은 최적화를 위한 여지가 있으며, 주로 다음에 초점을 맞추고 있습니다.

  1. 유연성을 높이기 위해 시장 변동성에 기반한 매개 변수를 자동으로 조정하기 위해 적응 가능한 이동 평균을 추가합니다.

  2. 볼링거 밴드 같은 변동성 지표를 포함해서 시장 가격 변동에 대응해야 합니다.

  3. 더 나은 매개 변수 콤보와 자동화를 개선하기 위한 거래 규칙을 위한 인공지능 훈련을 통해 기계 학습 알고리즘을 증가시킵니다.

  4. 여러 시장 포트폴리오를 통해 테스트 샘플을 확장하여 시장 간 효과를 검증합니다.

  5. 거시 정책, 주요 사건 등에 기반한 근본 분석 모듈을 도입하여 전략 결정 지원을 제공해야 합니다.

요약

포스 브레이크로우 전략 (Force Breakthrough Strategy) 은 실용적인 이동 평균 기반 전략이다. 빠른 이동 평균과 느린 이동 평균의 가격 침투를 통해 추세를 판단하고 RSI 지표의 도움으로 정확하게 시장에 진입한다. 이 조합은 이동 평균과 과잉 구매/ 과잉 판매 지표의 장점을 완전히 활용한다. 전략은 안정적인 수익과 제어 가능한 위험에 따라 다양한 시장에서 검증된다. 그것은 권장되는 양적 거래 전략이다. 추가 최적화는 전략 성과를 향상시킬 수 있다.


/*backtest
start: 2024-01-16 00:00:00
end: 2024-01-23 00:00:00
period: 30m
basePeriod: 15m
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/
// © JoseMetal
//@version=5

//== Constantes
c_blanco              = color.rgb(255, 255, 255, 0)
c_negro               = color.rgb(0, 0, 0, 0)
c_amarillo_radiactivo = color.rgb(255, 255, 0, 0)
c_cian_radiactivo     = color.rgb(0, 255, 255, 0)
c_verde_radiactivo    = color.rgb(0, 255, 0, 0)
c_verde               = color.rgb(0, 128, 0, 0)
c_verde_oscuro        = color.rgb(0, 80, 0, 0)
c_rojo_radiactivo     = color.rgb(255, 0, 0, 0)
c_rojo                = color.rgb(128, 0, 0, 0)
c_rojo_oscuro         = color.rgb(80, 0, 0, 0) 
c_naranja_oscuro      = color.rgb(200, 120, 0, 0)
noneColor             = color.new(color.white, 100)
max_float             = 10000000000.0



//== Funciones

//== Declarar estrategia y período de testeo
strategy("Estrategia Larry Connors", shorttitle="Estrategia Larry Connors", overlay=true)
fecha_inicio     = input(timestamp("1 Jan 2000"), title="• Fecha de inicio", group="Período de pruebas", inline="periodo_de_pruebas")
vela_en_fecha    = true
posicion_abierta = strategy.position_size != 0
LONG_abierto     = strategy.position_size > 0
SHORT_abierto    = strategy.position_size < 0

GRUPO_P           = "Posiciones"
P_permitir_LONGS  = input.bool(title="LONGS", group=GRUPO_P, defval=true, inline="posiciones")
P_permitir_SHORTS = input.bool(title="SHORTS", group=GRUPO_P, defval=true, inline="posiciones")

GRUPO_general = "General"
mostrar_color_velas = input.bool(title="Colorear velas", defval=true, group=GRUPO_general)



//== Inputs de indicadores
// Medias móviles simples
GRUPO_SMAs = "SMAs"
SMA_1_fuente = input.source(title="• (Media de salida) Fuente / Long.", group=GRUPO_SMAs, defval=close, inline="sma_1")
SMA_1_length = input.int(title="", group=GRUPO_SMAs, defval=10, minval=1, inline="sma_1")
SMA_2_fuente = input.source(title="• (Media tendencial) Fuente / Long.", group=GRUPO_SMAs, defval=close, inline="sma_2")
SMA_2_length = input.int(title="", group=GRUPO_SMAs, defval=200, minval=1, inline="sma_2")
SMA_1        = ta.ema(SMA_1_fuente, SMA_1_length)
SMA_2        = ta.ema(SMA_2_fuente, SMA_2_length)

// RSI
GRUPO_RSI    = "RSI"
RSI_src      = input.source(title="• Fuente / Longitud", group=GRUPO_RSI, defval=close, inline="rsi_calc")
RSI_length   = input.int(title="", group=GRUPO_RSI, defval=2, minval=1, inline="rsi_calc")
RSI          = ta.rsi(RSI_src, RSI_length)
RSI_nivel_os = input.int(title="• Sobreventa / Sobrecompra", group=GRUPO_RSI, defval=5, minval=0, maxval=99, inline="rsi_niveles")
RSI_nivel_ob = input.int(title="", group=GRUPO_RSI, defval=95, minval=1, maxval=100, inline="rsi_niveles")


//== Cálculo de condiciones
cierre_sobre_SMA_1 = close > SMA_1
tendencia_alcista  = close > SMA_2
RSI_en_sobreventa  = RSI < RSI_nivel_os
RSI_en_sobrecompra = RSI > RSI_nivel_ob



//== Entrada (deben cumplirse todas para entrar)
LONG_condition_1    = tendencia_alcista
LONG_condition_2    = not cierre_sobre_SMA_1 // Vela con cierre bajo la media rápida
LONG_condition_3    = RSI_en_sobreventa[1] and not RSI_en_sobreventa // Sobreventa en la vela anterior y ya no en la actual
all_LONG_conditions = LONG_condition_1 and LONG_condition_2 and LONG_condition_3
entrar_en_LONG      = P_permitir_LONGS and all_LONG_conditions and vela_en_fecha and not LONG_abierto

SHORT_condition_1    = not tendencia_alcista
SHORT_condition_2    = cierre_sobre_SMA_1 // Vela con cierre sobre la media rápida
SHORT_condition_3    = RSI_en_sobrecompra[1] and not RSI_en_sobrecompra // Sobrecompra en la vela anterior y ya no en la actual
all_SHORT_conditions = SHORT_condition_1 and SHORT_condition_2 and SHORT_condition_3
entrar_en_SHORT      = P_permitir_SHORTS and all_SHORT_conditions and vela_en_fecha and not SHORT_abierto

if (entrar_en_LONG)
    strategy.entry("Abrir Long", strategy.long)

if (entrar_en_SHORT)
    strategy.entry("Abrir Short", strategy.short)



//== Salida
exit_LONG_conditions  = cierre_sobre_SMA_1
exit_SHORT_conditions = not cierre_sobre_SMA_1


if (LONG_abierto and exit_LONG_conditions)
    strategy.close("Abrir Long")

if (SHORT_abierto and exit_SHORT_conditions)
    strategy.close("Abrir Short")


//== Ploteo en pantalla
// SMAs
plot(SMA_1, "Media de salida", color=color.aqua, linewidth=2)
plot(SMA_2, "Media tendencial", color=tendencia_alcista ? color.green : color.red, linewidth=4)

// Color de fondo
bgcolor = entrar_en_LONG ? color.new(color.green, 85) : entrar_en_SHORT ? color.new(color.red, 85) : color.new(color.black, 100)
bgcolor(bgcolor)

// Color de las velas según sobrecompra/sobreventa del RSI
color_velas = mostrar_color_velas ? (RSI_en_sobreventa ? #00a800 : RSI_en_sobrecompra ? #ca0000 : na) : na
barcolor(color_velas)


더 많은