다중 이동 평균 모멘텀 추세 추종 전략

SMA RSI MA
생성 날짜: 2024-11-12 15:05:09 마지막으로 수정됨: 2024-11-12 15:05:09
복사: 0 클릭수: 476
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

다중 이동 평균 모멘텀 추세 추종 전략

개요

이 전략은 여러 평균선과 동적 지표에 기반한 트렌드 추적 거래 시스템이다. 이 전략은 주로 20일, 50일, 150일, 200일 간단한 이동 평균 (SMA) 의 동적 관계를 이용하고, 교차량과 RSI 지표를 결합하여 일선 수준에서 강한 상승 추세를 포착하고, 추세가 약해지면 적시에 평정한다. 이 전략은 여러 기술 지표의 조합을 통해 사용되며, 가짜 신호를 효과적으로 필터링하여 거래의 정확성을 향상시킨다.

전략 원칙

이 전략의 핵심 논리는 다음과 같은 핵심 부분들로 구성되어 있습니다.

  1. 평균선 시스템: 20/50/150/200일 평균선을 사용하여 트렌드 판단 시스템을 구축하고, 다중 평균선이 다중 머리 배열을 나타낼 것을 요구한다.
  2. 동력 확인: RSI 지표와 그것의 이동 평균을 사용하여 가격 동력을 판단하기 위해, RSI가 55보다 크거나 RSI SMA가 50보다 크며 RSI가 상승해야 합니다.
  3. 거래량 검증: 20일 거래량 평균선과 최근 거래량 비교를 통해 거래 신호의 유효성을 확인한다.
  4. 트렌드 지속성 검증: 50일 평균선이 지난 40일 거래 중 최소 25일 상승세를 유지한 것을 확인한다.
  5. 위치 확인: 가격이 150일 평균선 위에 최소 20개 거래일 동안 안정적으로 유지되어야 한다.

구매 조건은 다음과 같습니다:

  • 지난 10일 중 4일 이상 햇볕이 으며 최소 1일 이상 양을 다.
  • RSI 지표는 동력 조건을 충족합니다.
  • 평선 시스템은 다목적 배열을 나타내고 계속 상승한다
  • 150일 평균선 상에서 안정적으로 운영되고 있다.

판매 조건은 다음과 같습니다:

  • 150일 평균을 넘어섰습니다.
  • 계속되는 감소 현상
  • 50일 평균이 150일 평균을 넘어섰다.
  • 최근 음란이 주축이 되어 교역량이 증가

전략적 이점

  1. 여러 기술 지표의 교차 검증, 잘못된 판단을 효과적으로 감소
  2. 트렌드 지속성이 엄격하고 단기 변동성을 필터링할 수 있습니다.
  3. 교통량 분석을 결합하여 신호 신뢰성을 향상시킵니다.
  4. 명확한 정지 조건, 효율적인 위험 관리
  5. 중·장기 트렌드를 포착하고 거래 빈도를 줄이는 데 적합합니다.
  6. 전략 논리는 명확하고 이해하기 쉬우며 구현하기 쉽습니다.

전략적 위험

  1. 평균선 시스템은 지연성이 있으며, 트렌드의 초기 단계를 놓칠 수 있습니다.
  2. 엄격한 입시 조건으로 인해 일부 거래 기회를 놓칠 수 있습니다.
  3. 변동성이 큰 시장에서는 잘못된 신호가 자주 발생할 수 있습니다.
  4. 시장의 역동성을 인식하는 데는 다소 지연이 있습니다.
  5. 하지만, 이 경우, 그 규모가 더 커질 수 있습니다.

위험 관리 제안:

  • 합리적인 Stop Loss 위치를 설정합니다.
  • 자금 관리에 있어서는 온건이 필요합니다.
  • 트렌드 확인 지표를 추가하는 것을 고려하십시오.
  • 시장 환경에 따라 변수를 조정

전략 최적화 방향

  1. 적응 변수를 추가합니다
  • 시장의 변동에 따라 수평선 주기 조정
  • RSI 임계 설정을 최적화
  1. 손해제도 개선
  • 추적 손실을 추가
  • 정지 시간 설정
  1. 시장환경 분석을 소개합니다.
  • 동향 강도 지표
  • 변동성 지표에 대해 생각해보세요.
  1. 거래 규모를 최적화
  • 동적 포지션 관리를 설계
  • 신호 강도에 따라 조정

요약하다

이것은 여러 가지 기술 지표의 조화를 통해 강력한 트렌드 기회를 효과적으로 포착 할 수있는 엄격한 트렌드 추적 전략을 설계한 것입니다. 전략의 주요 장점은 완전한 신호 확인 장치와 엄격한 위험 제어 시스템입니다. 약간의 지연이 있음에도 불구하고 합리적인 매개 변수 최적화 및 위험 관리를 통해 전략은 장기간에 걸쳐 안정적인 성능을 유지할 수 있습니다.

전략 소스 코드
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-11 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("Micho's 150 (1D Time Frame Only)", overlay=true)

// Define the length for the SMAs and RSI
sma20Length = 20
sma50Length = 50
sma150Length = 150
sma200Length = 200
volumeMaLength = 20
rsiLength = 14
rsiSmaLength = 14
smaCheckLength = 40  // Check the last month of trading days (~20 days)
requiredRisingDays = 25  // Require SMA to rise in at least 16 of the past 20 days
sma150AboveSma200CheckDays = 1  // Require SMA150 > SMA200 for the last 10 days

// Calculate the SMAs for price
sma20 = ta.sma(close, sma20Length)
sma50 = ta.sma(close, sma50Length)
sma150 = ta.sma(close, sma150Length)
sma200 = ta.sma(close, sma200Length)

// Calculate the 20-period moving average of volume
volumeMA20 = ta.sma(volume, volumeMaLength)

// Calculate the 14-period RSI
rsi = ta.rsi(close, rsiLength)

// Calculate the 14-period SMA of RSI
rsiSMA = ta.sma(rsi, rsiSmaLength)

// Check if most of the last 5 days are buyer days (close > open)
buyerDays = 0
for i = 0 to 9
    if close[i] > open[i]
        buyerDays := buyerDays + 1

// Check if at least 1 day has volume higher than the 20-period volume MA
highVolumeDays = 0
for i = 0 to 9
    if close[i] > open[i] and volume[i] > volumeMA20
        highVolumeDays := highVolumeDays + 1

// Define the new RSI condition
rsiCondition = (rsi >= 55) or (rsiSMA > 50 and rsi > rsi[1])

// Check if the 50-day SMA has been rising on at least 16 of the last 20 trading days
risingDays = 0
for i = 1 to smaCheckLength
    if sma50[i] > sma50[i + 1]
        risingDays := risingDays + 1

// Check if the SMA has risen on at least 16 of the last 20 days
sma50Rising = risingDays >= requiredRisingDays

// Check if the price has been above the SMA150 for the last 20 trading days
priceAboveSma150 = true
for i = 1 to smaCheckLength
    if close[i] < sma150[i]
        priceAboveSma150 := false

// Check if the SMA150 has been above the SMA200 for the last 10 days
sma150AboveSma200 = true
for i = 1 to sma150AboveSma200CheckDays
    if sma150[i] < sma200[i]
        sma150AboveSma200 := false

// Define the conditions for the 150-day and 200-day SMAs being rising
sma150Rising = sma150 > sma150[1]
sma200Rising = sma200 > sma200[1]

// Check if most of the last 5 days are seller days (close < open)
sellerDays = 0
for i = 0 to 9
    if close[i] < open[i]
        sellerDays := sellerDays + 1

// Check if at least 1 day has seller volume higher than the 20-period volume MA
highSellerVolumeDays = 0
for i = 0 to 9
    if close[i] < open[i] and volume[i] > volumeMA20
        highSellerVolumeDays := highSellerVolumeDays + 1

// Check in the last N days the price below 150
priceBelowSma150 = true
for i = 0 to 0
    if close[i] > sma150[i]
        priceBelowSma150 := false

// Restrict the strategy to 1D time frame
if timeframe.isdaily
    // Buy condition:
    // - Most of the last 5 days are buyer days (buyerDays > 2)
    // - At least 1 of those days has high buyer volume (highVolumeDays >= 1)
    // - RSI SMA (14-period) between 45 and 50 with RSI >= 55, or RSI SMA > 50 and RSI rising
    // - 50-day SMA > 150-day SMA and 150-day SMA > 200-day SMA
    // - 50-day SMA has been rising on at least 16 of the last 20 trading days
    // - The price hasn't been below the 150-day SMA in the last 20 days
    // - 150-day SMA has been above the 200-day SMA for the last 10 days
    // - 150-day and 200-day SMAs are rising
    buyCondition = (close > sma150 and buyerDays > 4 and highVolumeDays >= 1 and rsiCondition  and sma50 > sma150 and sma50Rising and sma150Rising and sma200Rising and priceAboveSma150)

    // Sell condition:
    // - Price crossing below SMA 150
    // - Seller volume (current volume > volume MA 20)
    // - 150-day SMA crosses below 200-day SMA
    // - Most of the last 5 days are seller days (sellerDays > 2) and at least 1 day of higher seller volume (highSellerVolumeDays >= 1)
    sellCondition = (priceBelowSma150 and (sma50 < sma150 or (sellerDays >5 and highSellerVolumeDays >= 5)))

    // Execute buy when all conditions are met
    if (buyCondition)
        strategy.entry("Buy", strategy.long)

    // Execute sell when all conditions are met
    if (sellCondition)
        strategy.close("Buy")