다중 취득 전략의 이동 평균 크로스오버

저자:차오장, 날짜: 2024-04-26 15:16:12
태그:SMAMA

img

전반적인 설명

이 전략은 시장 트렌드를 결정하기 위해 두 개의 이동 평균의 교차를 이용한다. 단기 이동 평균이 장기 이동 평균을 넘을 때, 긴 포지션을 열고, 짧은 포지션에는 역으로 열린다. 동시에, 이 전략은 여러 가지 수익 수준을 사용하며, 가격이 미리 설정된 수익 수준에 도달하면 부분적으로 포지션을 닫아 수익을 극대화하고 위험을 제어한다.

전략 원칙

이 전략의 핵심은 시장 추세를 파악하기 위해 다양한 기간의 이동 평균을 사용하는 것입니다. 단기 이동 평균이 장기 이동 평균을 넘어서면 시장이 상승 추세로 진입하고 장기 포지션이 열릴 수 있음을 암시합니다. 반대로 단기 이동 평균이 장기 이동 평균을 넘어서면 잠재적인 하락 추세를 암시하고 짧은 포지션이 열립니다. 한편, 전략은 여러 수익 수준을 설정하고 가격이 이러한 수준에 도달하면 미리 설정된 포지션 비율에 따라 포지션을 팩으로 닫습니다. 이것은 트렌드가 지속되는 동안 위험을 관리하면서 더 큰 이익을 얻을 수 있습니다.

전략적 장점

  1. 단순하고 효과적: 이 전략은 단순하고 이해하기 쉬운 고전적인 이동 평균 크로스오버 원리에 기반하고 있으며 실제로 효과적이라는 것을 입증했습니다.
  2. 다중 수익: 다중 수익 수준을 설정하고 가격이 이 수준에 도달하면 부분적으로 포지션을 닫음으로써 수익을 극대화 할 수 있으며 동시에 위험을 제어 할 수 있습니다.
  3. 유연한 매개 변수: 이 전략의 매개 변수 설정은 매우 유연합니다. 사용자는 최적의 결과를 달성하기 위해 자신의 필요와 시장 특성에 따라 이동 평균 기간과 수익 수준을 조정할 수 있습니다.

전략 위험

  1. 시장 변동성 위험: 시장이 심한 변동을 경험할 때, 빈번한 크로스오버 신호는 빈번한 거래, 거래 비용 증가 및 유출 위험으로 이어질 수 있습니다.
  2. 위험 설정 매개 변수: 적절하지 않은 매개 변수 설정은 이동 평균 기간의 잘못된 선택 또는 부적절한 이익 수준 설정과 같은 전략 성과가 좋지 않을 수 있습니다.
  3. 트렌드 인식 위험: 이 전략 은 주로 트렌드에 의존 합니다. 불안 한 시장 이나 트렌드가 불분명 한 경우, 더 많은 잘못된 신호 가 발생 하여 손실 이 발생할 수 있습니다.

전략 최적화 방향

  1. 다른 지표와 결합: 추세 인식의 정확성과 신뢰성을 향상시키기 위해 RSI, MACD 등과 같은 다른 기술적 지표와 결합하는 것을 고려하십시오.
  2. 매개 변수를 최적화: 백테스팅과 최적화를 통해, 다른 시장 조건에 적응하기 위해 최고의 이동 평균 기간과 수익 수준 매개 변수를 찾습니다.
  3. 스톱 로스 추가: ATR에 기반한 동적 스톱 로스 설정과 같은 위험 통제를 위해 스톱 로스 메커니즘을 추가하는 것을 고려하십시오.
  4. 진입 및 출구를 개선: 전략의 견고성을 높이기 위해 거래량, 지원 및 저항 수준 등을 고려하는 것과 같은 더 많은 진입 및 출구 조건을 탐구하십시오.

결론

다중 수익을 취하는 이동 평균 크로스오버 전략은 다단계 수익을 취함으로써 위험을 관리하는 동안 트렌드에 더 많은 수익을 얻을 수있는 간단하고 효과적인 트렌드를 따르는 전략입니다. 그러나이 전략에는 일부 제한과 위험이 있으며 특정 시장 조건과 사용자 요구에 따라 최적화 및 개선되어야합니다. 전반적으로이 전략은 효과적인 거래 도구로 사용될 수 있지만 완전히 의존 할 수 없으며 최적의 결과를 위해 다른 분석 방법과 위험 관리 조치와 결합해야합니다.


/*backtest
start: 2023-04-20 00:00:00
end: 2024-04-25 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © ValdesTradingBots

//Follow Us for More Insights and Updates!

//Join our community and be the first to know about our new releases and trading tips

//Facebook Group: Join our vibrant community at https://www.facebook.com/groups/707469081464839/
//Twitter: Follow us for quick updates and insights at https://twitter.com/ValdesBots

//We're excited to have you with us!

//@version=5
strategy("Valdes Trading Bots MA Cross with Multiple Take Profits", overlay=true)

shortPeriod = input(18, title="Short MA Period")
longPeriod = input(32, title="Long MA Period")

// Take Profit Settings
tp1Enabled = input(true, title="Enable Take Profit 1")
tp1Perc = input(15, title="Take Profit 1 (%)") / 100
tp1QtyPerc = input(25, title="Take Profit 1 Qty (%)") / 100

tp2Enabled = input(true, title="Enable Take Profit 2")
tp2Perc = input(30, title="Take Profit 2 (%)") / 100
tp2QtyPerc = input(25, title="Take Profit 2 Qty (%)") / 100

tp3Enabled = input(true, title="Enable Take Profit 3")
tp3Perc = input(45, title="Take Profit 3 (%)") / 100
tp3QtyPerc = input(25, title="Take Profit 3 Qty (%)") / 100

tp4Enabled = input(true, title="Enable Take Profit 4")
tp4Perc = input(60, title="Take Profit 4 (%)") / 100
tp4QtyPerc = input(25, title="Take Profit 4 Qty (%)") / 100

shortMA = ta.sma(close, shortPeriod)
longMA = ta.sma(close, longPeriod)

// Determine the trend
uptrend = shortMA > longMA
downtrend = shortMA < longMA

// Assign candle colors based on the trend
candleColor = uptrend ? color.rgb(9, 112, 0) : downtrend ? color.rgb(255, 0, 0) : color.new(color.blue, 0)

plot(shortMA, title="Short MA", color=color.rgb(9, 112, 0))
plot(longMA, title="Long MA", color=color.rgb(255, 0, 0))

// Create a cross signal
longCross = ta.crossover(shortMA, longMA)
shortCross = ta.crossunder(shortMA, longMA)

// Strategy entry
if (longCross)
    strategy.entry("Long", strategy.long)
if (shortCross)
    strategy.entry("Short", strategy.short)

// Strategy take profit
if (tp1Enabled and strategy.position_size > 0)
    strategy.exit("TP1 Long", "Long", qty_percent=tp1QtyPerc, limit=strategy.position_avg_price * (1 + tp1Perc))
if (tp1Enabled and strategy.position_size < 0)
    strategy.exit("TP1 Short", "Short", qty_percent=tp1QtyPerc, limit=strategy.position_avg_price * (1 - tp1Perc))

if (tp2Enabled and strategy.position_size > 0)
    strategy.exit("TP2 Long", "Long", qty_percent=tp2QtyPerc, limit=strategy.position_avg_price * (1 + tp2Perc))
if (tp2Enabled and strategy.position_size < 0)
    strategy.exit("TP2 Short", "Short", qty_percent=tp2QtyPerc, limit=strategy.position_avg_price * (1 - tp2Perc))

if (tp3Enabled and strategy.position_size > 0)
    strategy.exit("TP3 Long", "Long", qty_percent=tp3QtyPerc, limit=strategy.position_avg_price * (1 + tp3Perc))
if (tp3Enabled and strategy.position_size < 0)
    strategy.exit("TP3 Short", "Short", qty_percent=tp3QtyPerc, limit=strategy.position_avg_price * (1 - tp3Perc))

if (tp4Enabled and strategy.position_size > 0)
    strategy.exit("TP4 Long", "Long", qty_percent=tp4QtyPerc, limit=strategy.position_avg_price * (1 + tp4Perc))
if (tp4Enabled and strategy.position_size < 0)
    strategy.exit("TP4 Short", "Short", qty_percent=tp4QtyPerc, limit=strategy.position_avg_price * (1 - tp4Perc))

// Plotting the signals on the chart
plotshape(series=longCross, title="Long Cross", location=location.belowbar, color=color.rgb(9, 112, 0), style=shape.triangleup, size=size.small)
plotshape(series=shortCross, title="Short Cross", location=location.abovebar, color=color.rgb(255, 0, 0), style=shape.triangledown, size=size.small)

// Apply candle color
barcolor(candleColor)


관련

더 많은