유연한 MA/VWAP 크로스오버 전략 (Stop Loss/Take Profit)

저자:차오장, 날짜: 2023-12-20 14:06:18
태그:

img

전반적인 설명

이 전략은 잠재적 인 가격 움직임을 포착하기 위해 빠른 이동 평균, 느린 이동 평균 및 볼륨 가중 평균 가격 (VWAP) 사이의 교차점을 식별합니다. 빠른 MA가 VWAP와 느린 MA를 넘을 때 구매 신호를 유발하고 빠른 MA가 VWAP와 느린 MA를 넘을 때 판매 신호를 유발합니다.

전략 논리

이 전략은 움직이는 평균과 VWAP의 강점을 결합합니다. 움직이는 평균은 시장 소음을 효과적으로 필터링하고 트렌드 방향을 결정할 수 있습니다. VWAP는 큰 돈의 의도를 더 정확하게 반영합니다. 빠른 MA는 단기 트렌드를 캡처하고 느린 MA는 잘못된 신호를 필터링합니다. 빠른 MA가 느린 MA와 VWAP를 넘을 때 상승 단기 트렌드를 나타내고 구매 신호를 유발합니다. 크로스오버 트리거 아래에 판매 신호가 발생합니다.

이점 분석

  • 이중 MA 필터는 잘못된 신호를 줄여줍니다.
  • VWAP는 큰 돈의 의도를 정확하게 판단합니다.
  • 유연한 MA 매개 변수
  • 스톱 로스/프로프트 취득으로 효과적인 리스크 관리

위험 분석

  • 윙사 시장은 여러 가지 잘못된 신호를 생성 할 수 있습니다.
  • 부적절한 VWAP 매개 변수는 기금 의도를 판단하지 못합니다.
  • 손실 중지 너무 긴 추세를 추적 할 수 없습니다, 너무 느슨한 위험 과잉

최적화 방향

  • 다른 시장 조건에 맞게 MA와 VWAP 매개 변수를 최적화
  • RSI와 함께 추가 필터 신호
  • 동적 스톱 손실/이익 취득 비율

결론

이 전략은 이동 평균과 VWAP의 강점을 통합하고, 이중 필터링을 통해 크로스오버 신호를 식별하고, 유연한 스톱 손실/이익 취득 메커니즘으로 위험을 효과적으로 제어합니다. 이것은 추세를 따르는 전략입니다.


/*backtest
start: 2023-11-19 00:00:00
end: 2023-12-19 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
strategy("Flexible MA VWAP Crossover Strategy with SL/TP", shorttitle="MA VWAP Crossover", overlay=true)

// Input parameters
fast_length = input(9, title="Fast MA Length", minval=1)
slow_length = input(21, title="Slow MA Length", minval=1)
vwap_length = input(14, title="VWAP Length", minval=1)

// Stop Loss and Take Profit inputs
stop_loss_percent = input(1.0, title="Stop Loss (%)", minval=0.1, maxval=5.0, step=0.1)
take_profit_percent = input(2.0, title="Take Profit (%)", minval=1.0, maxval=10.0, step=0.1)

// Calculate moving averages
fast_ma = sma(close, fast_length)
slow_ma = sma(close, slow_length)
vwap = sma(close * volume, vwap_length) / sma(volume, vwap_length)

// Buy and sell conditions
buy_condition = crossover(fast_ma, vwap) and crossover(fast_ma, slow_ma)
sell_condition = crossunder(fast_ma, vwap) and crossunder(fast_ma, slow_ma)

// Plot the moving averages
plot(fast_ma, title="Fast MA", color=color.blue)
plot(slow_ma, title="Slow MA", color=color.red)
plot(vwap, title="VWAP", color=color.purple)

// Plot buy and sell signals
plotshape(buy_condition, style=shape.triangleup, location=location.belowbar, color=color.green, title="Buy Signal")
plotshape(sell_condition, style=shape.triangledown, location=location.abovebar, color=color.red, title="Sell Signal")

// Define stop loss and take profit levels
var float stop_loss_price = na
var float take_profit_price = na

if (buy_condition)
    stop_loss_price := close * (1 - stop_loss_percent / 100)
    take_profit_price := close * (1 + take_profit_percent / 100)

// Strategy entry and exit with flexible SL/TP
strategy.entry("Buy", strategy.long, when = buy_condition)

if (sell_condition)
    strategy.exit("SL/TP", from_entry = "Buy", stop = stop_loss_price, limit = take_profit_price)


더 많은