더블박스 트렌드 추적 시스템


생성 날짜: 2023-11-02 17:19:22 마지막으로 수정됨: 2023-11-02 17:19:22
복사: 0 클릭수: 647
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

더블박스 트렌드 추적 시스템

개요

트렌드 추적 시스템 (Trend Tracking System) 은 두 상자 체제를 기반으로 한 트렌드 추적 전략이다. 그것은 장기 주기 상자를 사용하여 전체 트렌드 방향을 판단하고, 단기 상자가 신호를 생성할 때, 장기 트렌드 방향과 일치하는 거래 신호를 선택한다. 이 전략은 트렌드를 추적하여 수익을 극대화하면서 위험을 제어한다.

전략 원칙

이 전략은 두 개의 상자체를 사용하여 추세를 판단한다. 장기 상자는 더 긴 주기를 사용하여 주요 추세 방향을 판단하고, 단기 상자는 더 짧은 주기를 사용하여 특정 거래 신호를 판단한다.

전략은 우선 장기 상자의 최고 가격과 최저 가격을 계산하여 주요 트렌드 방향을 판단한다. 트렌드 방향은 세 가지로 나다:

  • 최고 가격 위에 K 선의 최고 가격, 상승 추세로 정의, 1을 부여
  • 최저 가격 아래 K선으로 가장 낮은 가격, 하향 추세로 정의되어, -1을 부여합니다.
  • 다른 경우, 기존의 추세를 유지합니다.

주요 트렌드 방향을 판단한 후, 전략은 단기 상자에 따라 진입을 시작합니다. 구체적으로:

  • 주요 동향이 상승하고, 단기 상자의 최저가격이 상단의 K선 최저가격과 현재의 단기 상자의 최저가격보다 낮을 때 더 많이 한다.
  • 주요 추세가 하향이고, 단기 상자의 최고 가격은 상단의 K 선의 최고 가격과 현재의 단기 상자의 최고 가격보다 높을 때, 공백

이 전략은 또한 Stop Loss과 Stop Stop을 설정합니다.

  • 다중 단위 상쇄 손실은 장기 상자에 가장 낮은 가격이고, 빈 단위 상쇄 손실은 장기 상자에 가장 높은 가격입니다.
  • 다중 단일 스탠드 칸은 단기 박스 최고 가격, 빈 단일 스탠드 칸은 단기 박스 최저 가격

주요 트렌드가 변할 때, 모든 포지션을 매각한다.

우위 분석

이 전략은 다음과 같은 장점을 가지고 있습니다.

  1. 트렌드 방향을 효과적으로 식별할 수 있는 쌍체 판단 시스템을 사용하여 잘못된 거래의 가능성을 줄일 수 있다.
  2. 단기 시장 소음에 의해 오해받지 않도록 단기 역전 신호가 장기 추세 방향과 일치하는 경우에만 입시하십시오.
  3. 장기 및 단기간의 협력으로 주요 트렌드를 포착하는 능력과 적절한 포지션을 조정하는 유연성을 보장합니다.
  4. 스톱로스 스톱포인트 설정은 합리적이고, 트렌드 실행을 파악하면서 위험을 제어할 수 있습니다.
  5. 주요 트렌드 전환시 신속한 청산, 적자를 제지

위험 분석

이 전략에는 다음과 같은 위험도 있습니다.

  1. 거래 빈도나 놓친 기회를 초래할 수 있는 부적절한 긴 주기 설정
  2. 급격한 사건으로 인해 단기 트렌드 반전이 장기 트렌드 전환을 의미하지는 않습니다. 이 경우 손실 위험이 있습니다.
  3. 스톱포인트가 너무 가까워지면 시장에서 밀려날 수 있습니다.
  4. 하지만, 이 경우, 이 지표가 너무 느려서 수익을 극대화할 수 없습니다.
  5. 장기적 추세 판단에 오류가 발생하면 후속 거래 손실이 확장됩니다.
  6. 이러한 위험에 대응하는 방법은: 길고 짧은 주기 파라미터를 조정, 스톱 스톱 위치를 최적화, 필터링 조건을 증가하는 등이다.

최적화 방향

이 전략은 다음과 같은 부분에서 최적화될 수 있습니다.

  1. 단기 허위 돌파구에 의해 오도되는 신호를 방지하기 위해 필터링 조건을 추가합니다.
  2. 다양한 품종 특성에 맞게 길고 짧은 주기 변수를 최적화
  3. 손해 차단 위치를 동적으로 조정하여 손해 차단이 더 정확하고, 손해 차단이 더 충분합니다.
  4. 포지션 관리 전략을 추가하여 포지션 크기를 합리화합니다.
  5. 볼륨과 같은 지표와 결합하여 트렌드 전환을 판단하는 신뢰성
  6. 기계 학습 방법을 사용하여 매개 변수 및 필터링 조건을 자동으로 최적화합니다.

요약하다

트렌드 추적 시스템은 전체적으로 매우 실용적인 트렌드 추적 전략이다. 그것은 동시에 트렌드 판단과 단기 조정 능력을 겸비하고, 트렌드를 추적하는 동시에 위험을 제어할 수 있다. 지속적인 최적화를 통해, 이 전략은 강력한 자동화 트렌드 거래 시스템이 될 수 있다.

||

Overview

The Trend Following System is a trend tracking strategy based on a double box system. It uses a long-term box to determine the overall trend direction and takes signals that align with the major trend when the short-term box triggers. This strategy follows trends while managing risks.

Strategy Logic

The strategy uses two boxes to determine the trend. The long-term box uses a longer period to judge the major trend direction, and the short-term box uses a shorter period to generate trading signals.

First, the strategy calculates the highest and lowest prices of the long-term box to determine the major trend direction. The trend direction can be:

  • If the highest price crosses above the highest price of the previous bar, it is defined as an uptrend, assigned a value of 1
  • If the lowest price crosses below the lowest price of the previous bar, it is defined as a downtrend, assigned a value of -1
  • Otherwise, maintain the original trend direction

After determining the major trend, the strategy starts taking positions based on the short-term box signals. Specifically:

  • When the major trend is up and the short-term box’s lowest price equals the previous bar’s lowest price and is lower than the current short-term box’s lowest price, go long.
  • When the major trend is down and the short-term box’s highest price equals the previous bar’s highest price and is higher than the current short-term box’s highest price, go short.

In addition, stop loss and take profit are configured:

  • Long stop loss is the lowest price of the long-term box, short stop loss is the highest price of the long-term box
  • Long take profit is the highest price of the short-term box, short take profit is the lowest price of the short-term box

When the major trend reverses, close all positions.

Advantage Analysis

The advantages of this strategy include:

  1. The double box system effectively identifies trend directions and reduces incorrect trades
  2. Only taking reversal signals that align with the major trend avoids being misled by short-term market noise
  3. The combination of long and short periods ensures capturing major trends while maintaining position adjustment flexibility
  4. Reasonable stop loss and take profit points control risk while following trends
  5. Quickly flattening all positions when the major trend reverses minimizes losses

Risk Analysis

The risks of this strategy include:

  1. Improper long and short period settings may cause overtrading or missing opportunities
  2. Short-term reversals may not represent long-term trend changes, still posing loss risks
  3. Stop loss too close may get stopped out prematurely
  4. Take profit too loose may not maximize profits
  5. Wrong judgment of the major trend leads to losses
  6. Solutions include adjusting periods, optimizing stops/targets, adding filters etc.

Optimization Directions

The strategy can be improved by:

  1. Adding filters to avoid false breakouts
  2. Optimizing long and short periods for different products
  3. Dynamically adjusting stop loss and take profit levels
  4. Incorporating position sizing rules
  5. Using volume etc. to judge reliability of trend changes
  6. Utilizing machine learning to auto-optimize parameters and filters

Summary

The Trend Following System is a practical trend trading strategy combining trend determination and short-term adjustments. With continuous optimizations, it can become a robust automated system that tracks trends while controlling risks. It contains the core philosophies of trend trading and is worth in-depth studying.

[/trans]

전략 소스 코드
/*backtest
start: 2023-10-25 00:00:00
end: 2023-10-26 07:00:00
period: 5m
basePeriod: 1m
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/
// © LonesomeTheBlue

//@version=4
strategy("Grab Trading System", overlay = true)
flb = input(defval = 80, title = "Longterm Period", minval = 1)
slb = input(defval = 21, title = "Shortterm Period", minval = 1)
showtarget = input(defval = true, title = "Show Target")
showtrend = input(defval = true, title = "Show Trend")

major_resistance = highest(flb)
major_support = lowest(flb)
minor_resistance = highest(slb)
minor_support = lowest(slb)

var int trend = 0
trend := high > major_resistance[1] ? 1 : low < major_support[1] ? -1 : trend
strategy.entry("Buy", true, when = trend == 1 and low[1] == minor_support[1] and low > minor_support)
strategy.entry("Sell", false, when = trend == -1 and high[1] == minor_resistance[1] and high < minor_resistance)

if strategy.position_size > 0
    strategy.exit("Buy", stop = major_support, comment = "Stop Buy")
    if high[1] == minor_resistance[1] and high < minor_resistance
        strategy.close("Buy", comment ="Close Buy")
    
if strategy.position_size < 0
    strategy.exit("Sell", stop = major_resistance, comment = "Stop Sell")
    if low[1] == minor_support[1] and low > minor_support
        strategy.close("Sell", comment ="Close Sell")

if strategy.position_size != 0 and change(trend)
    strategy.close_all()
    
majr = plot(major_resistance, color = showtrend and trend == -1 and trend[1] == -1 ? color.red : na)
majs = plot(major_support, color = showtrend and trend == 1 and trend[1] == 1 ? color.lime : na)
minr = plot(minor_resistance, color = showtarget and trend == 1 and strategy.position_size > 0 ? color.yellow : na, style = plot.style_circles)
mins = plot(minor_support, color = showtarget and trend == -1 and strategy.position_size < 0 ? color.yellow : na, style = plot.style_circles)

fill(majs, mins, color = showtrend and trend == 1 and trend[1] == 1 ? color.lime : na, transp = 85)
fill(majr, minr, color = showtrend and trend == -1 and trend[1] == -1 ? color.red : na, transp = 85)