섀도리스 평균 K-라인 및 거래량 가중 평균 가격 거래 시스템의 고급 버전

VWAP HA SL TP IST ATR
생성 날짜: 2025-02-21 14:49:07 마지막으로 수정됨: 2025-02-21 14:49:07
복사: 0 클릭수: 423
avatar of ianzeng123 ianzeng123
2
집중하다
319
수행원

섀도리스 평균 K-라인 및 거래량 가중 평균 가격 거래 시스템의 고급 버전 섀도리스 평균 K-라인 및 거래량 가중 평균 가격 거래 시스템의 고급 버전

개요

이것은 무선 평균 K선 ((Heikin-Ashi) 과 거래량 가중 평균 가격 ((VWAP) 에 기반한 자동 거래 시스템이다. 이 전략은 특정 K선 형태를 식별하여 VWAP를 동적인 지지/저항 지점으로 결합하여 설정된 거래 시간 내에 매매를 실행한다. 시스템은 고정된 스톱포드 손실 지점 관리 위험을 채택하고 매일 특정 시간에 포지션을 평정하도록 강제한다.

전략 원칙

전략의 핵심 논리는 다음과 같은 핵심 요소에 기초합니다.

  1. 기존의 K선 대신 Heikin-Ashi K선을 사용하여, 오픈 가격, 최고 가격, 최저 가격 및 종료 가격의 평균값을 계산하여 시장 추세를 더 잘 식별할 수 있다.
  2. 구매 조건: 녹색의 Heikin-Ashi K 라인이 형성되고 가격은 VWAP 위에 있다.
  3. 판매 조건: 빨간색 Heikin-Ashi K 라인이 형성되고 가격은 VWAP 이하이다.
  4. 고정된 50점의 정지 목표를 적용하고, 비용 가격에 도달하면 평행한다.
  5. 15:01에 모든 미완성 포지션을 필수적으로 평정한다.

전략적 이점

  1. 두 가지 강력한 기술 지표인 Heikin-Ashi와 VWAP를 결합하여 거래 신호의 신뢰도를 높였습니다.
  2. 무사선 요구는 더 강한 트렌드 확인 신호를 보장한다.
  3. 고정 스톱 스톱 손실 지점은 엄격한 위험 통제에 도움이 됩니다.
  4. 하루 거래 전략은 하룻밤의 위험을 피할 수 있습니다.
  5. 이 시스템은 완전히 자동화되어 인간의 감정적 간섭을 줄여줍니다.

전략적 위험

  1. 고정 스톱 스톱 지점은 모든 시장 조건에 적합하지 않을 수 있으며, 특히 변동성이 변할 때 그렇습니다.
  2. 강제적인 평정시간은 연속성을 놓치게 할 수 있다.
  3. 무선 통신의 엄격한 요구는 일부 효과적인 거래 기회를 놓치게 할 수 있습니다.
  4. 상반시장에서는 잘못된 신호가 자주 발생할 수 있습니다.
  5. VWAP의 기준값은 거래량이 낮은 기간 동안 낮아질 수 있다.

전략 최적화 방향

  1. ATR의 동적 조정 스톱 스톱 손실 지점을 도입하여 전략이 시장의 변동성에 더 잘 적응 할 수 있습니다.
  2. 트렌드 필터를 추가하여 수평 시장에서 잘못된 신호를 줄여줍니다.
  3. 시장 특성에 따라 조정할 수 있는 평점 시간을 최적화한다.
  4. 거래량 필터를 추가하여 VWAP 지표의 신뢰성을 향상시킵니다.
  5. 이 모든 것은 이윤을 더 잘 보호할 수 있는 Stop Loss Tracking 기능을 구현하기 위한 것이다.

요약하다

이 전략은 Heikin-Ashi와 VWAP 지표를 결합하여 안정적인 일일 거래 시스템을 구축한다. 일부 최적화 공간이 있지만 기본 프레임 워크는 좋은 실용성을 가지고 있다. 제안된 최적화 방향에 의해, 전략은 다양한 시장 조건에서 더 나은 성능을 얻을 것으로 보인다.

전략 소스 코드
/*backtest
start: 2024-07-16 00:00:00
end: 2025-02-19 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/

//@version=5
strategy("Buy and Sell Signal with VWAP and Timed Exit", overlay=true)

// VWAP Calculation
vwap = ta.vwap(close)

// Heikin-Ashi Formula
var float heikin_open = na
var float heikin_close = na

heikin_open := na(heikin_open[1]) ? (open + close) / 2 : (heikin_open[1] + heikin_close[1]) / 2
heikin_close := (open + high + low + close) / 4
heikin_high = math.max(high, math.max(heikin_open, heikin_close))
heikin_low = math.min(low, math.min(heikin_open, heikin_close))

// Conditions for Sell (Red Heikin-Ashi with no upper shadow) and Buy (Green Heikin-Ashi with no lower shadow)
no_upper_shadow = heikin_high == math.max(heikin_open, heikin_close)
no_lower_shadow = heikin_low == math.min(heikin_open, heikin_close)

// Condition for red (sell) and green (buy) Heikin-Ashi candles
is_red_candle = heikin_close < heikin_open
is_green_candle = heikin_close > heikin_open

// Buy and Sell Signal Conditions
sell_signal = is_red_candle and no_upper_shadow and close < vwap
buy_signal = is_green_candle and no_lower_shadow and close > vwap

// Check current time (for 15:01 IST)
is_after_1501 = (hour == 15 and minute > 1) or (hour > 15)

// Check for open positions
open_sell_position = strategy.position_size < 0
open_buy_position = strategy.position_size > 0

// Trigger Sell order only if no open sell position exists and time is before 15:01, and price is below VWAP
if sell_signal and not open_sell_position and not is_after_1501
    strategy.entry("Sell", strategy.short)

// Trigger Buy order only if no open buy position exists and time is before 15:01, and price is above VWAP
if buy_signal and not open_buy_position and not is_after_1501
    strategy.entry("Buy", strategy.long)

// Define exit condition for Sell (opposite of Buy conditions)
exit_sell_condition = false

if open_sell_position
    entry_price = strategy.position_avg_price  // Get the average entry price for Sell
    current_price = close  // Current market price for Sell

    // Exit conditions for Sell
    exit_sell_condition := current_price > entry_price or entry_price - current_price >= 50

    // Exit if conditions are met
    if exit_sell_condition
        strategy.close("Sell")

// Define exit condition for Buy (opposite of Sell conditions)
exit_buy_condition = false

if open_buy_position
    entry_price = strategy.position_avg_price  // Get the average entry price for Buy
    current_price = close  // Current market price for Buy

    // Exit conditions for Buy
    exit_buy_condition := current_price < entry_price or current_price - entry_price >= 50

    // Exit if conditions are met
    if exit_buy_condition
        strategy.close("Buy")

// Exit at 15:01 IST for both Buy and Sell if not already exited
if (open_sell_position or open_buy_position) and (hour == 15 and minute == 1)
    strategy.close("Sell")
    strategy.close("Buy")

// Plot VWAP
plot(vwap, color=color.blue, linewidth=2, title="VWAP")

// Plot Heikin-Ashi Candles
plotcandle(heikin_open, heikin_high, heikin_low, heikin_close, color = is_red_candle ? color.red : (is_green_candle ? color.green : color.gray))

// Plot Sell signal on the chart
plotshape(sell_signal and not open_sell_position and not is_after_1501, style=shape.labeldown, location=location.abovebar, color=color.red, text="SELL", size=size.small)

// Plot Buy signal on the chart
plotshape(buy_signal and not open_buy_position and not is_after_1501, style=shape.labelup, location=location.belowbar, color=color.green, text="BUY", size=size.small)

// Plot Exit signals on the chart
plotshape(exit_sell_condition and open_sell_position, style=shape.labelup, location=location.belowbar, color=color.blue, text="EXIT SELL", size=size.small)
plotshape(exit_buy_condition and open_buy_position, style=shape.labeldown, location=location.abovebar, color=color.blue, text="EXIT BUY", size=size.small)