影なし平均Kラインと出来高加重平均価格取引システムの高度なバージョン

VWAP HA SL TP IST ATR
作成日: 2025-02-21 14:49:07 最終変更日: 2025-02-21 14:49:07
コピー: 0 クリック数: 423
2
フォロー
319
フォロワー

影なし平均Kラインと出来高加重平均価格取引システムの高度なバージョン 影なし平均Kラインと出来高加重平均価格取引システムの高度なバージョン

概要

これは,無線平均のK線 ((Heikin-Ashi) と取引量重み平均価格 ((VWAP) に基づく自動取引システムである.この戦略は,特定のK線形状を識別し,VWAPを動的サポート/レジスタンス位として組み合わせ,設定された取引時間内に買取操作を実行する.システムは,固定ストップ・ストップ・損失の位管理リスクを採用し,一日の特定の時間にポジションを平らにするように強制する.

戦略原則

戦略の中核となるロジックは、次の主要な要素に基づいています。

  1. Heikin-Ashi K線を従来のK線の代わりに使用することで,開場価格,最高価格,最低価格,閉場価格の平均値を計算することによって,市場動向をよりよく識別することができる.
  2. 購入条件:緑のHeikin-Ashi K線 (下影のない線) が形成され,価格はVWAPの上にあります。
  3. 販売条件:赤いヘイキン・アシ・K線 ((無上影線) が形成され,価格はVWAP以下である。
  4. 固定50ポイントのストップ目標を設定し,コスト価格に触ると平仓する.
  5. 15:01にすべての未定ポジションを強制的に平定する.

戦略的優位性

  1. Heikin-AshiとVWAPの2つの強力な技術指標を組み合わせることで,取引信号の信頼性が向上しました.
  2. シャドレスの要求により,より強いトレンド確認信号が保証されます.
  3. 固定ストップ・ストップ・ポイントは,厳格なリスク管理に役立ちます.
  4. 昼間の取引戦略は,夜間のリスクを回避する.
  5. システムも完全に自動化され,感情的な干渉は少なくなります.

戦略リスク

  1. 固定ストップ・ストップ・ポイントは,特に波動性変化の際には,すべての市場条件に適さない場合があります.
  2. 強制的な平定期間は,継続性を逃す可能性があります.
  3. 無線通信の厳格な要求は,有効な取引機会のいくつかを逃す可能性があります.
  4. 横軸市場では誤信号が頻繁に発生する可能性があります.
  5. 低取引量期間のVWAPの基準値は低下する可能性があります.

戦略最適化の方向性

  1. ATRの動的調整ストップ・ストップ・ポイントの導入により,戦略は市場の波動に適した状態に改善されます.
  2. トレンドフィルターを追加し,横軸市場における偽信号を減らす.
  3. 市場特有の動向に応じて調整することができる.
  4. VWAP指標の信頼性を高めるために,取引量フィルターを追加しました.
  5. ストップ・ロスの追跡機能を実現し,利益の保護を向上させる.

要約する

この戦略は,ヘイキン・アシと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)