AlphaTrend를 기반으로 한 교차 기간 전략


생성 날짜: 2023-09-28 11:05:27 마지막으로 수정됨: 2023-09-28 11:05:27
복사: 0 클릭수: 903
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

개요

이 전략은 RSI와 MFI의 두 가지 지표의 장점을 결합한 AlphaTrend 지표를 기반으로 하며, 다공간 트렌드 시장에서 더 나은 전략 효과를 얻을 수 있습니다. 이 전략은 주로 가격이 AlphaTrend 곡선을 돌파하는지 판단하여 트렌드의 방향을 캡처합니다.

전략 원칙

  1. 시장의 변동성을 측정하기 위한 ATR을 계산하는 방법
  2. 거래량 데이터가 없으면 RSI를 사용하여 시장의 빈도를 판단하고 거래량이 있다면 MFI를 사용하여 시장의 빈도를 판단합니다.
  3. ATR 및 다공간 판단에 따라 선로 상하 계산
  4. 위와 아래의 궤도 동적 조정과 결합된 AlphaTrend 곡선을 계산한다
  5. 알파트렌드 곡선을 가로질러 가격이 오르락 내리락할 때 구매 및 판매 신호가 발송됩니다.

이 전략은 주로 AlphaTrend 곡선으로 가격 트렌드 방향을 판단합니다. 이 전략은 ATR 시장의 변동 측정, RSI 및 MFI 포용 지표를 종합적으로 고려하여 가격 트렌드를 효과적으로 추적 할 수 있습니다. 가격이 곡선을 돌파 할 때, 트렌드가 변하는 것을 나타냅니다. 이 시점은 입문 시점입니다.

전략적 이점

  1. 알파트렌드 지표는 RSI와 MFI의 장점을 결합하여 공백 시장 상황에 동시에 적응할 수 있습니다.
  2. 동적인 상반기 및 하반기 설정은 시장의 변동에 따라 자동으로 조정할 수 있습니다
  3. 가격과 거래량 정보를 종합적으로 고려하여 잘못된 신호에 의해 오도되지 않습니다.
  4. 새로운 트렌드 방향에 대한 정보를 파악하기 위한 획기적인 방법
  5. 논리적으로 명확하고, 간단하고, 쉽게 이해할 수 있습니다.

종합적으로 볼 때, 이 전략은 다중 시장 상황에 적용되며, 시장 소음을 효과적으로 필터링하고, 트렌드를 식별하는 데는 더 정확하며, 정확한 효율적인 트렌드 추적 전략이다.

전략적 위험

  1. 알파트렌드 곡선이 잘못 뚫릴 수 있는 경우, 조합과 다른 지표의 검증이 필요합니다.
  2. 대시장 진동 시 여러 번 무효 신호가 나타날 수 있다.
  3. 지표 변수 설정이 잘못되면 정책 효과에도 영향을 미칠 수 있습니다.
  4. 태풍의 폭락으로 인해, 막부 손실이 뚫릴 수 있으므로, 큰 손실을 경계해야 합니다.

리스크에 맞게, 단독 손실을 제어하기 위해 스톱로스를 설정할 수 있다. 다른 지표 조합과 함께 사용된 파라미터 조합을 최적화하여 무효 신호를 줄일 수 있다. 다른 시장에 따라 파라미터 설정을 조정한다.

전략 최적화

  1. 다양한 변수 조합을 실험하여 최적의 변수를 찾아낼 수 있습니다.
  2. 다른 지표와 결합하여 판단을 돕는 보조 조건을 형성할 수 있습니다.
  3. 다이내믹 스톱을 설정하거나 스톱을 추적하여 위험을 제어할 수 있습니다.
  4. 시장 상황에 따라 다른 거래 주파수를 사용할 수 있습니다. (5분, 15분 등)
  5. 입학 시기를 최적화하여 더 정확한 입학 조건을 설정할 수 있습니다.

다양한 시장과 변수를 테스트하여 더 많은 유형의 상황에 맞게 전략을 계속 최적화 할 수 있습니다.

요약하다

알파 트렌드 전략은 전체적으로 간단하고 효율적인 트렌드 따라가는 전략이다. 가격과 거래량을 결합하여 빈 시장 상황에 적응할 수 있다. 돌파구 운영 방식으로 명확한 진입 시점을 확보한다. 위험을 잘 통제하는 전제 조건에서 좋은 전략 효과를 얻을 수 있다. 더 많은 시장에서 안정적인 수익을 낼 수 있도록 추가 테스트 및 최적화를 할 가치가 있다.

전략 소스 코드
/*backtest
start: 2023-09-20 00:00:00
end: 2023-09-26 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/
// author © KivancOzbilgic
// developer © KivancOzbilgic
// pv additions, simplification and strategy conversion @ treigen
//@version=5
strategy('AlphaTrend For ProfitView', overlay=true, calc_on_every_tick=true, process_orders_on_close=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.1, initial_capital=1000)
coeff = input.float(1.5, 'Multiplier', step=0.1)
AP = input(15, 'Common Period')
ATR = ta.sma(ta.tr, AP)
novolumedata = input(title='Change calculation (no volume data)?', defval=false)

i_startTime = input(defval = timestamp("01 Jan 2014 00:00 +0000"), title = "Backtesting Start Time", inline="timestart", group='Backtesting')
i_endTime = input(defval = timestamp("01 Jan 2100 23:59 +0000"), title = "Backtesting End Time", inline="timeend", group='Backtesting')
timeCond = true

pv_ex = input.string('', title='Exchange', tooltip='Leave empty to use the chart ticker instead (Warning: May differ from actual market name in some instances)', group='PV Settings')
pv_sym = input.string('', title='Symbol', tooltip='Leave empty to use the chart ticker instead (Warning: May differ from actual market name in some instances)', group='PV Settings')
pv_acc = input.string("", title="Account", group='PV Settings')
pv_alert_long = input.string("", title="PV Alert Name Longs", group='PV Settings')
pv_alert_short = input.string("", title="PV Alert Name Shorts", group='PV Settings')
pv_alert_test = input.bool(false, title="Test Alerts", tooltip="Will immediately execute the alerts, so you may see what it sends. The first line on these test alerts will be excluded from any real alert triggers" ,group='PV Settings')

upT = low - ATR * coeff
downT = high + ATR * coeff
AlphaTrend = 0.0
AlphaTrend := (novolumedata ? ta.rsi(close, AP) >= 50 : ta.mfi(hlc3, AP) >= 50) ? upT < nz(AlphaTrend[1]) ? nz(AlphaTrend[1]) : upT : downT > nz(AlphaTrend[1]) ? nz(AlphaTrend[1]) : downT


k1 = plot(AlphaTrend, color=color.new(#0022FC, 0), linewidth=3)
k2 = plot(AlphaTrend[2], color=color.new(#FC0400, 0), linewidth=3)

buySignalk = ta.crossover(AlphaTrend, AlphaTrend[2])
sellSignalk = ta.crossunder(AlphaTrend, AlphaTrend[2])

var exsym = ""
if barstate.isfirst
    exsym := pv_ex == "" ? "" : "ex=" + pv_ex + ","
    exsym := pv_sym == "" ? exsym : exsym + "sym=" + pv_sym + ","


if barstate.isconfirmed and timeCond 
    if strategy.position_size <= 0 and buySignalk
        strategy.entry("Buy", strategy.long)
        alert(pv_alert_long + "(" + exsym + "acc=" + pv_acc + ")", alert.freq_once_per_bar_close)
    if strategy.position_size >= 0 and sellSignalk
        strategy.entry("Sell", strategy.short)
        alert(pv_alert_short + "(" + exsym + "acc=" + pv_acc + ")", alert.freq_once_per_bar_close)


//  Only used for testing/debugging alert messages
if pv_alert_test
    alert("<![Alert Test]!>\n" + pv_alert_long + "(" + exsym + "acc=" + pv_acc + ")", alert.freq_once_per_bar)
    alert("<![Alert Test]!>\n" + pv_alert_short + "(" + exsym + "acc=" + pv_acc + ")", alert.freq_once_per_bar)