리소스 로딩... 로딩...

이중 슈퍼트렌드 다단계 추후 취득 전략

저자:차오장, 날짜: 2024-06-21 14:36:35
태그:ATRSTTP

img

전반적인 설명

이 전략은 두 개의 슈퍼트렌드 지표를 기반으로 한 다단계 후속 영업 전략이다. 이 전략은 다른 매개 변수를 가진 두 개의 슈퍼트렌드 지표를 사용하여 시장 트렌드를 결정하고 그에 따라 긴 또는 짧은 거래를 실행한다. 전략의 핵심은 다단계 후속 영업 메커니즘에 있다. 이 메커니즘은 더 큰 시장 움직임을 포착하기 위해 포지션의 일부를 개방하면서 수익을 점진적으로 차단하기 위해 여러 수익 목표를 설정합니다. 이 접근법은 수익 잠재력을 극대화하면서 위험을 줄이는 것을 목표로합니다.

전략 원칙

  1. 듀얼 슈퍼트렌드 지표: 전략은 트렌드를 식별하기 위해 다른 매개 변수 설정을 가진 두 개의 슈퍼트렌드 지표를 사용합니다. 두 지표 모두 상승 추세를 표시할 때 긴 신호가 유발되며 두 지표 모두 하락 추세를 나타낼 때 짧은 신호가 유발됩니다. 이 이중 확인 메커니즘은 잘못된 신호를 효과적으로 감소시킵니다.

  2. 다단계 후속 영업 (Multi-Step Trailing Take-Profit): 전략은 4개의 조정 가능한 영업 (take-profit) 목표를 설정한다. 각 목표에는 그에 상응하는 영업률과 포지션 종료 비율이 있다. 예를 들어, 첫 번째 목표가 6%의 이익으로 포지션의 12%를 닫을 수 있고, 두 번째는 12%의 이익으로 8%를 닫을 수 있다. 이 메커니즘은 지속적인 시장 움직임으로부터 이익을 얻기 위해 포지션의 일부를 개방하면서 점진적인 영업 (profit) 로킹을 허용한다.

  3. 유연한 거래 방향: 사용자들은 다른 시장 환경과 거래 선호도에 적응하여 단기, 단기 또는 두 방향으로만 거래할 수 있습니다.

  4. 동적 스톱 로스: 코드에 명시적인 스톱 로스 설정이 없지만, 전략은 슈퍼 트렌드 지표가 역전되면 자동으로 포지션을 닫아 동적 스톱 로스 역할을 합니다.

전략적 장점

  1. 최적화된 리스크 관리: 다단계 후속 수익 취득 메커니즘은 전략의 리스크/리워드 비율을 크게 향상시킵니다. 수익을 점차적으로 고정함으로써 전략은 상승 잠재력을 유지하면서 인출 위험을 줄일 수 있습니다.

  2. 가짜 신호 감소: 이중 슈퍼 트렌드 지표의 사용은 잘못된 신호의 영향을 크게 줄여 거래 정확성과 신뢰성을 향상시킵니다.

  3. 높은 적응력: 전략은 사용자 선호도와 시장 조건에 따라 거래 방향과 수익 매개 변수를 유연하게 조정할 수 있으며, 다양한 거래 도구와 시간 프레임에 적합합니다.

  4. 높은 자동화 수준: 전략은 입구부터 수익 취득 및 출구까지 완전히 자동화되어 있으며 감정과 운영 오류의 영향을 최소화합니다.

  5. 유연한 자본 관리: 다른 취득 비율을 설정함으로써 전략은 유연한 자본 관리를 달성하여 빠른 부분 수익 실현을 보장하면서 나머지 위치가 시장 변화로부터 계속 이익을 얻을 수 있습니다.

전략 위험

  1. 매개 변수 민감성: 전략의 성과는 슈퍼트렌드 지표 및 수익 매개 변수 설정에 크게 의존합니다. 부적절한 매개 변수는 과잉 거래 또는 중요한 기회를 놓칠 수 있습니다.

  2. 트렌드 의존성: 트렌드를 따르는 전략으로서, 종종 불안한 시장에 진입하고 출입하여 불필요한 거래 비용을 초래할 수 있습니다.

  3. 미끄러짐 위험: 빠르게 변화하는 시장에서, 여러 단계의 영업이익의 실행은 미끄러짐에 의해 영향을 받을 수 있으며, 결과적으로 실제 실행 가격은 기대에서 벗어날 수 있습니다.

  4. 과도한 최적화 위험: 여러 가지 조정 가능한 매개 변수로 전략은 과도한 최적화에 취약하여 백테스팅 결과와 라이브 거래 성과 사이의 상당한 차이를 초래할 수 있습니다.

전략 최적화 방향

  1. 변동성 필터링을 도입하십시오: 낮은 변동성 기간 동안 거래 빈도를 줄이기 위해 ATR 또는 다른 변동성 지표를 통합하는 것을 고려하여 다른 시장 조건에 대한 전략의 적응력을 향상시킵니다.

  2. 동적 매개 변수 조정: 적응 알고리즘을 사용하여 슈퍼 트렌드 매개 변수 및 수익 목표를 동적으로 조정하여 시장 변화에 더 잘 적응하도록 탐구합니다.

  3. 스톱 로스 메커니즘을 강화합니다. 슈퍼 트렌드 반전은 일부 스톱 로스 기능을 제공하지만 더 나은 위험 통제를 위해 트레일 스톱과 같은 더 유연한 스톱 로스 메커니즘을 추가하는 것을 고려하십시오.

  4. 추가 기술 지표 통합: 멀티 지표 합동으로 입출 정확성을 향상시키기 위해 RSI 또는 MACD와 같은 다른 기술 지표를 통합하는 것을 고려하십시오.

  5. 자본 관리 최적화: 더 정교한 자본 관리 전략을 탐구합니다. 예를 들어 계좌 성과에 따라 지점 크기를 동적으로 조정하여 위험과 수익을 더 잘 균형을 맞추기 위해.

  6. 백테스팅 최적화: 전략의 최적의 응용 시나리오와 매개 변수 설정을 식별하기 위해 다른 시간 프레임 및 시장 조건에 대한 성능 분석을 포함하여 더 포괄적인 백테스팅을 수행합니다.

결론

이 다단계 후속 수익 전략은 이중 슈퍼트렌드 지표에 기반하여 유연한 다단계 수익 메커니즘을 통해 위험과 보상 사이의 균형을 달성합니다. 전략의 주요 장점은 뛰어난 위험 관리 기능과 트렌드에 대한 민감함입니다. 그러나 사용자는 이를 적용할 때 매개 변수 설정 및 시장 환경 영향에주의를 기울여야합니다. 추가 최적화 및 정교화를 통해이 전략은 견고하고 신뢰할 수있는 자동화 거래 시스템으로 변할 가능성이 있습니다. 실제 응용에서는 거래자가 철저한 백테스팅과 종이 거래를 수행하고 특정 거래 도구 및 시장 조건에 따라 적절한 매개 변수 조정을 수행하는 것이 좋습니다.


/*backtest
start: 2024-05-21 00:00:00
end: 2024-06-20 00:00:00
period: 4h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("Strategic Multi-Step Supertrend Trader - Strategy [presentTrading]", overlay=true )

// this strategy utilizes a double Supertrend indicator to determine entry and exit conditions for both long and short trades, with user-configurable take profit levels and trade direction settings. 
// The strategy dynamically updates highest and lowest prices during trades and exits positions based on multi-step profit targets or opposing Supertrend signals.


// User inputs for take profit settings
// Grouping Take Profit settings
useTakeProfit = input.bool(true, title="Use Take Profit", group="Take Profit Settings")
takeProfitPercent1 = input.float(6.0, title="Take Profit % Step 1", group="Take Profit Settings")
takeProfitPercent2 = input.float(12.0, title="Take Profit % Step 2", group="Take Profit Settings")
takeProfitPercent3 = input.float(18.0, title="Take Profit % Step 3", group="Take Profit Settings")
takeProfitPercent4 = input.float(50.0, title="Take Profit % Step 4", group="Take Profit Settings")

takeProfitAmount1 = input.float(12, title="Take Profit Amount % Step 1", group="Take Profit Settings")
takeProfitAmount2 = input.float(8, title="Take Profit Amount % Step 2", group="Take Profit Settings")
takeProfitAmount3 = input.float(4, title="Take Profit Amount % Step 3", group="Take Profit Settings")
takeProfitAmount4 = input.float(0, title="Take Profit Amount % Step 4", group="Take Profit Settings")

numberOfSteps = input.int(3, title="Number of Take Profit Steps", minval=1, maxval=4, group="Take Profit Settings")

// Grouping Trade Direction
tradeDirection = input.string("Both", title="Trade Direction", options=["Long", "Short", "Both"], group="Trade Direction")

// Grouping Supertrend settings
atrPeriod1 = input(10, title="ATR Length for Supertrend 1", group="Supertrend Settings")
factor1 = input.float(3.0, title="Factor for Supertrend 1", step=0.01, group="Supertrend Settings")

atrPeriod2 = input(5, title="ATR Length for Supertrend 2", group="Supertrend Settings")
factor2 = input.float(4.0, title="Factor for Supertrend 2", step=0.01, group="Supertrend Settings")


// Function to calculate Supertrend
supertrend(factor, atrPeriod) =>
    [a, direction] = ta.supertrend(factor, atrPeriod)
    direction

// Calculate Double Supertrend
supertrend1 = supertrend(factor1, atrPeriod1)
supertrend2 = supertrend(factor2, atrPeriod2)

// Entry conditions
longCondition = (supertrend1 < 0 and supertrend2 < 0) and (tradeDirection == "Long" or tradeDirection == "Both")
shortCondition = (supertrend1 > 0 and supertrend2 > 0) and (tradeDirection == "Short" or tradeDirection == "Both")

// Exit conditions
longExitCondition = (supertrend1 > 0 and supertrend2 > 0) and (tradeDirection == "Long" or tradeDirection == "Both")
shortExitCondition = (supertrend1 < 0 and supertrend2 < 0) and (tradeDirection == "Short" or tradeDirection == "Both")

// Variables to store the highest and lowest prices during the trade
var float highestPrice = na
var float lowestPrice = na

// Get the entry price from open trades
entryPrice = strategy.opentrades.entry_price(strategy.opentrades - 1)

// Reset highestPrice or lowestPrice when entering new trades
if (longCondition and strategy.position_size <= 0)
    highestPrice := na // Reset the highest price
    strategy.entry("My Long Entry Id", strategy.long) // Enter long position
    strategy.close("My Short Entry Id", "Short Exit") // Close short position if any

if (shortCondition and strategy.position_size >= 0)
    lowestPrice := na // Reset the lowest price
    strategy.entry("My Short Entry Id", strategy.short) // Enter short position
    strategy.close("My Long Entry Id", "Long Exit") // Close long position if any

// Exit trades based on conditions
if (longExitCondition and strategy.position_size > 0)
    strategy.close("My Long Entry Id", "Long Exit") // Exit long position

if (shortExitCondition and strategy.position_size < 0)
    strategy.close("My Short Entry Id", "Short Exit") // Exit short position

if (strategy.position_size > 0)
    // Update the highest price for long positions
    highestPrice := na(highestPrice) ? high : math.max(highestPrice, high)

    // Step 1
    if (useTakeProfit and numberOfSteps >= 1)
        strategy.exit("Take Profit 1", from_entry="My Long Entry Id", qty_percent=takeProfitAmount1, limit=entryPrice * (1 + takeProfitPercent1 / 100))
    // Step 2
    if (useTakeProfit and numberOfSteps >= 2)
        strategy.exit("Take Profit 2", from_entry="My Long Entry Id", qty_percent=takeProfitAmount2, limit=entryPrice * (1 + takeProfitPercent2 / 100))
    // Step 3
    if (useTakeProfit and numberOfSteps >= 3)
        strategy.exit("Take Profit 3", from_entry="My Long Entry Id", qty_percent=takeProfitAmount3, limit=entryPrice * (1 + takeProfitPercent3 / 100))
    // Step 4
    if (useTakeProfit and numberOfSteps == 4)
        strategy.exit("Take Profit 4", from_entry="My Long Entry Id", qty_percent=takeProfitAmount4, limit=entryPrice * (1 + takeProfitPercent4 / 100))

if (strategy.position_size < 0)
    // Update the lowest price for short positions
    lowestPrice := na(lowestPrice) ? low : math.min(lowestPrice, low)

    // Step 1
    if (useTakeProfit and numberOfSteps >= 1)
        strategy.exit("Take Profit 1", from_entry="My Short Entry Id", qty_percent=takeProfitAmount1, limit=entryPrice * (1 - takeProfitPercent1 / 100))
    // Step 2
    if (useTakeProfit and numberOfSteps >= 2)
        strategy.exit("Take Profit 2", from_entry="My Short Entry Id", qty_percent=takeProfitAmount2, limit=entryPrice * (1 - takeProfitPercent2 / 100))
    // Step 3
    if (useTakeProfit and numberOfSteps >= 3)
        strategy.exit("Take Profit 3", from_entry="My Short Entry Id", qty_percent=takeProfitAmount3, limit=entryPrice * (1 - takeProfitPercent3 / 100))
    // Step 4
    if (useTakeProfit and numberOfSteps == 4)
        strategy.exit("Take Profit 4", from_entry="My Short Entry Id", qty_percent=takeProfitAmount4, limit=entryPrice * (1 - takeProfitPercent4 / 100))


관련

더 많은