전략에 따른 VWAP 트렌드

저자:차오장, 날짜: 2024-02-29 15:26:56
태그:

img

전반적인 설명

이 전략은 트렌드 방향을 결정하기 위해 VWAP와 EMA를 지표로 사용합니다. 가격이 VWAP와 EMA200 이상일 때 길게 이동하고 가격이 VWAP와 EMA200 이하일 때 짧게 이동합니다. 이것은 전형적인 트렌드 다음 전략입니다.

전략 논리

전략의 핵심 논리는 가격 추세를 판단하기 위해 VWAP와 EMA를 사용하는 것입니다.

  • VWAP는 전형적인 가격을 나타내고 시장 참여자의 평균 비용을 반영합니다. 가격이 VWAP보다 높으면 구매력이 증가하고 길어야한다는 것을 의미합니다. 가격이 VWAP보다 낮으면 판매력이 강화되고 짧아야한다는 것을 의미합니다.

  • EMA200는 가격의 중장기 트렌드를 나타냅니다. 가격이 EMA200보다 높을 때, 중장기 전망이 상승하고 길게 가야한다는 것을 의미합니다. 가격이 EMA200보다 낮을 때, 중장기 전망이 하락하고 짧게 가야한다는 것을 의미합니다.

따라서 이 전략은 먼저 가격이 VWAP와 EMA200을 모두 넘어서고, 만약 네라면, 장거리, 만약 가격이 VWAP와 EMA200을 모두 넘어서면, 단위로 가도록 판단합니다. 이 전략은 주로 VWAP와 EMA를 기반으로 거래 결정을 내리는 것을 볼 수 있습니다.

또한, 전략은 또한 수익을 취하고 손실을 멈추는 지점을 설정합니다. 긴 후에 TP는 입시 가격의 3.5%로 설정되고 SL는 입시 가격의 1.4%로 설정됩니다. 짧은 후에 TP는 입시 가격의 2.5%이며 SL는 입시 가격의 0.9%입니다. 이것은 큰 손실을 피합니다.

장점

이 전략의 가장 큰 장점은 트렌드를 결정하기 위해 VWAP와 EMA를 사용하는 것이 매우 신뢰할 수 있다는 것입니다.

  • VWAP는 시장 참여자의 평균 비용을 정확하게 반영할 수 있으며, 동향을 판단하는 매우 좋은 지표입니다.
  • EMA200는 중장기 동향을 명확하게 반영하고 주요 동향의 방향을 매우 정확하게 결정할 수 있습니다.

따라서 트렌드를 판단하기 위해 VWAP와 EMA를 결합하는 것은 매우 신뢰할 수 있습니다. 두 지표가 일관된 신호를 제공하면 거래 성공률이 매우 높습니다.

또한 TP/SL를 설정하면 거래당 과도한 손실을 피할 수 있습니다.

위험성

이 전략의 주요 위험은 VWAP와 EMA가 잘못된 신호를 줄 수 있다는 것입니다.

  • 급격한 시장 변동이 있을 때, 가격은 단기적으로 VWAP에서 벗어나 잘못된 신호를 줄 수 있습니다.
  • 새로운 트렌드가 시작될 때, EMA는 가격 변화를 늦추고 가장 좋은 출입 시기를 놓칠 수 있습니다.

또한, 잘못된 TP/SL 설정은 여전히 거래당 과도한 손실의 위험을 야기합니다.

위의 문제를 해결하기 위해, 우리는 새로운 트렌드의 시작을 감지하는 데 더 나은 그들을 만들기 위해 VWAP와 EMA의 매개 변수를 최적화 할 수 있습니다. 또한 우리는 가격 변동에 따라 조정하도록 적응적 TP / SL를 설정 할 수 있습니다.

강화

이 전략을 강화하는 주요 측면:

  • 트렌드를 결정하는 데 더 안정적인 설정을 찾기 위해 VWAP 매개 변수를 최적화하십시오.
  • EMA 기간을 최적화하여 추세를 판단하는 데 더 정확한 설정을 찾습니다.
  • 볼링거 밴드, KDJ 등과 같은 다른 트렌드 지표를 추가하여 VWAP와 EMA와 결합하여 정확성을 향상시킵니다.
  • 특정 규칙에 따라 적응적 인 수익을 취하고 손실을 중지하여 가격 변동에 따라 동적으로 조정합니다.
  • 전체 리스크를 제어하기 위해 마감, 연속 손실 등에 기초한 포지션 크기를 포함합니다.

결론

결론적으로, 이것은 매우 신뢰할 수있는 트렌드 다음 전략입니다. 트렌드 방향을 결정하기 위해 VWAP와 EMA의 간단한 논리를 사용합니다. 두 지표가 일관된 신호를 제공하면 성공률이 매우 높습니다. 적절한 TP / SL를 설정함으로써 위험을 제어 할 수 있습니다. 이 전략을 더욱 개선하고 성능을 더욱 향상시키기 위해 여전히 많은 방법 (패라미터 최적화, 지표 추가, 적응 TP / SL, 포지션 사이징 등) 이 있습니다.


/*backtest
start: 2024-01-01 00:00:00
end: 2024-01-31 23:59:59
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//26m Binance BTCUSDTPERP
//@version=4
strategy("VWAP Trend Follower", initial_capital=100, overlay=true, commission_type=strategy.commission.percent, commission_value=0.04, default_qty_type = strategy.percent_of_equity, default_qty_value = 90, currency = currency.USD )

/// INITIALISE STRATEGY ///
price=close[1]
vprice=vwap(price)
trend=ema(price, 200)

/// RISK MANAGEMENT ///
long_tp_inp = input(3.5, title='Long Take Profit %',step=0.1)/100
long_sl_inp = input(1.4, title='Long Stop Loss %',step=0.1)/100
short_tp_inp = input(2.5, title='Short Take Profit %',step=0.1)/100
short_sl_inp = input(0.9, title='Short Stop Loss %',step=0.1)/100
long_take_level = strategy.position_avg_price * (1 + long_tp_inp)
long_stop_level = strategy.position_avg_price * (1 - long_sl_inp)
short_take_level = strategy.position_avg_price * (1 - short_tp_inp)
short_stop_level = strategy.position_avg_price * (1 + short_sl_inp)
//long_trailing = input(5, title='Trailing Stop Long',step=0.1) / 100
//short_trailing = input(5, title='Trailing Stop short',step=0.1) / 100

/// STRATEGY CONDITIONS ///
aLong= price > trend and price > vprice
entry_long = aLong and aLong[2] and aLong[1]
aShort= price < trend and price < vprice 
entry_short = aShort and aShort[2] and aShort[1]
//exit_long = 
//exit_short =
//entry_price_long=valuewhen(entry_long,close,0)
//entry_price_short=valuewhen(entry_short,close,0)

/// PLOTTING ///
plot(vprice,                color=#5875E1, linewidth=2)
plot(trend,                 color=#D965E1, linewidth=1)
plotshape(series=aLong,     color=#71E181,style=shape.labelup)
plotshape(series=aShort,    color=#E18BA5,style=shape.labeldown)
//plot(long_take_level,     color=#00E676, linewidth=2)
//plot(long_stop_level,     color=#FF5252, linewidth=1)
//plot(short_take_level,    color=#4CAF50, linewidth=2)
//plot(short_stop_level,    color=#FF5252, linewidth=1)

/// PERIOD ///
testStartYear   = input(2019, "Backtest Start Year")
testStartMonth  = input(1, "Backtest Start Month")
testStartDay    = input(1, "Backtest Start Day")
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,0,0)
testStopYear    = input(2020, "Backtest Stop Year")
testStopMonth   = input(12, "Backtest Stop Month")
testStopDay     = input(31, "Backtest Stop Day")
testPeriodStop  = timestamp(testStopYear,testStopMonth,testStopDay,0,0)
testPeriod() => true

//// STRATEGY EXECUTION ////

if testPeriod()
    if strategy.position_size == 0 or strategy.position_size > 0
        strategy.entry(id="Long", long=true, when=entry_long, comment="Long")
        strategy.exit("Take Profit/ Stop Loss","Long", limit=long_take_level, stop=long_stop_level,comment="Exit Long")//,trail_points=entry_price_long * long_trailing / syminfo.mintick, trail_offset=entry_price_long * long_trailing / syminfo.mintick)
//        strategy.close(id="Long", when=exit_long, comment = "Exit Long")

    if strategy.position_size == 0 or strategy.position_size < 0
        strategy.entry(id="Short", long=false, when=entry_short, comment = "Short")
        strategy.exit("Take Profit/ Stop Loss","Short", limit=short_take_level , stop=short_stop_level,comment = "Exit Short")//, trail_points=entry_price_short * short_trailing / syminfo.mintick, trail_offset=entry_price_short * short_trailing / syminfo.mintick)
//        strategy.close(id="Short", when=exit_short, comment = "Exit Short")

더 많은