スーパートレンドダブルトリガーマルチステップムービング利益獲得戦略

ATR ST TP
作成日: 2024-06-21 14:36:35 最終変更日: 2024-06-21 14:36:35
コピー: 1 クリック数: 698
1
フォロー
1617
フォロワー

スーパートレンドダブルトリガーマルチステップムービング利益獲得戦略

概要

これは,二重のスーパートレンド指標に基づく多段階の移動ストップ戦略である.この戦略は,二つのパラメータが異なるスーパートレンド指標を使用して,市場の傾向を判断し,傾向の方向に応じて多空取引を行う.この戦略の核心は,多段階の移動ストップ機構を採用し,複数のストップ目標を設定して,利益を徐々にロックし,より大きな動きを把握するために部分的なポジションを保持する.この方法は,リスクを低減し,利益の潜在能力を最大化します.

戦略原則

  1. 二重スーパートレンド指数:戦略は,2つのパラメータ設定の異なるスーパートレンド指数を使用してトレンドを判断する. 2つの指標が同時に上昇傾向を示している場合は,多信号を触発し, 2つの指標が同時に下降傾向を示している場合は,空き信号を触発する. この二重確認機構は,偽信号を効果的に減らすことができます.

  2. 多段階の移動ストップ:戦略は4つの調整可能なストップ目標を設定している.各目標は,対応するストップパーセンテージと平和ポジション比率を持っている.例えば,最初のストップ目標は,6%の利益で12%のポジションを平らにするように設定され,第二の目標は,12%の利益で8%のポジションを平らにするように設定されることがあります.このメカニズムは,利益を徐々にロックするだけでなく,一部のポジションを継続して楽しむことができます.

  3. 柔軟な取引方向: 戦略は,異なる市場環境と取引好みに合わせて,多額の取引,空白取引,双方向取引の選択をユーザーに許可します.

  4. ダイナミックストップ:コードに明示的なストップ設定はありませんが,Supertrend指標が逆転すると,戦略は自動的に平準化され,これは実際にダイナミックストップの役割を果たします.

戦略的優位性

  1. リスク管理の最適化:多段階の移動停止メカニズムは,戦略のリスク/利益の比率を大幅に改善した. 利潤を段階的にロックすることで,戦略は,上の余地を維持しながら,撤回リスクを低減することができる.

  2. 偽信号の減少:双重スーパートレンド指標の使用は,偽信号の影響を大幅に軽減し,取引の正確性と信頼性を向上させる.

  3. 適応性: 戦略は,ユーザーの好みや市場状況に応じて取引方向とストップパラメータを柔軟に調整し,様々な取引品種と時間周期に適用できます.

  4. 高度な自動化:戦略は完全に自動化され,入場,停止,出場までの人間の介入を必要としません.これは感情的な影響と操作の誤りの可能性を大幅に減少させます.

  5. 資金管理の柔軟性: 戦略は,異なる止まり率を設定することにより,資金管理の柔軟性を実現し,利益の一部を迅速にロックすることを保証し,残存ポジションを利益に留めることができます.

戦略リスク

  1. パラメータの感受性:戦略の性能は,スーパートレンド指標とストップパラメータの設定に大きく依存しています.不適切なパラメータは,過度取引や重要な機会を逃す可能性があります.

  2. トレンド依存: トレンド追跡策として,波動的な市場では,不必要な取引コストを伴う頻繁な出入が起こり得る.

  3. スライドポイントリスク:急速な状況では,多ステップストップの実行はスライドポイントの影響を受け,実際の実行価格が予想から偏っている可能性があります.

  4. 過度最適化のリスク:戦略には複数の調整可能なパラメータがあり,過度最適化の罠に陥りやすいため,実盤と大きな差異が生じます.

戦略最適化の方向性

  1. 波動性フィルターの導入:ATRまたは他の波動性指標との組み合わせを考慮し,低波動性期間の取引頻度を削減し,異なる市場環境における戦略の適応性を向上させる.

  2. ダイナミックパラメータ調整: 市場変化に適うように,自己適応アルゴリズムを使用してSupertrendパラメータとストップ目標のダイナミック調整を探索できます.

  3. ストップメカニズムの追加: スーパートレンドは逆向きに一定のストップ機能を提供していますが,ストップを追跡し,リスクをさらに制御するなど,より柔軟なストップメカニズムの追加を検討することができます.

  4. 他の技術指標と組み合わせる:RSI,MACDなどの他の技術指標を導入することを検討し,複数の指標の共振により入場と出場の正確性を向上させることができる.

  5. 資金管理の最適化:より複雑な資金管理戦略を探索できます. 例えば,リスクと利益のバランスをより良くするために,口座の収益性に応じてポジションサイズを動的に調整します.

  6. 回帰最適化:戦略の最適な適用シナリオとパラメータ設定を特定するために,異なる時間周期,異なる市場条件下でのパフォーマンスの分析を含むより全面的な回帰を行う.

要約する

この多段階のモバイルストップ戦略は,二重のスーパートレンド指標に基づいており,柔軟な多段階のストップメカニズムによってリスクと利益のバランスを取っています.この戦略の主な優点は,その優れたリスク管理能力とトレンドへの感受性にあります.しかし,ユーザーは,パラメータ設定と市場環境の影響に注意する必要があります.さらに最適化および改善することにより,この戦略は,堅牢で信頼性の高い自動取引システムになる可能性があります.実際のアプリケーションでは,トレーダーは十分な反測と模擬取引を行い,特定の取引品種と市場状況に応じて適切なパラメータ調整を行うことをお勧めします.

ストラテジーソースコード
/*backtest
start: 2024-05-21 00:00:00
end: 2024-06-20 00:00:00
period: 4h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("Strategic Multi-Step Supertrend Trader - Strategy [presentTrading]", overlay=true )

// this strategy utilizes a double Supertrend indicator to determine entry and exit conditions for both long and short trades, with user-configurable take profit levels and trade direction settings. 
// The strategy dynamically updates highest and lowest prices during trades and exits positions based on multi-step profit targets or opposing Supertrend signals.


// User inputs for take profit settings
// Grouping Take Profit settings
useTakeProfit = input.bool(true, title="Use Take Profit", group="Take Profit Settings")
takeProfitPercent1 = input.float(6.0, title="Take Profit % Step 1", group="Take Profit Settings")
takeProfitPercent2 = input.float(12.0, title="Take Profit % Step 2", group="Take Profit Settings")
takeProfitPercent3 = input.float(18.0, title="Take Profit % Step 3", group="Take Profit Settings")
takeProfitPercent4 = input.float(50.0, title="Take Profit % Step 4", group="Take Profit Settings")

takeProfitAmount1 = input.float(12, title="Take Profit Amount % Step 1", group="Take Profit Settings")
takeProfitAmount2 = input.float(8, title="Take Profit Amount % Step 2", group="Take Profit Settings")
takeProfitAmount3 = input.float(4, title="Take Profit Amount % Step 3", group="Take Profit Settings")
takeProfitAmount4 = input.float(0, title="Take Profit Amount % Step 4", group="Take Profit Settings")

numberOfSteps = input.int(3, title="Number of Take Profit Steps", minval=1, maxval=4, group="Take Profit Settings")

// Grouping Trade Direction
tradeDirection = input.string("Both", title="Trade Direction", options=["Long", "Short", "Both"], group="Trade Direction")

// Grouping Supertrend settings
atrPeriod1 = input(10, title="ATR Length for Supertrend 1", group="Supertrend Settings")
factor1 = input.float(3.0, title="Factor for Supertrend 1", step=0.01, group="Supertrend Settings")

atrPeriod2 = input(5, title="ATR Length for Supertrend 2", group="Supertrend Settings")
factor2 = input.float(4.0, title="Factor for Supertrend 2", step=0.01, group="Supertrend Settings")


// Function to calculate Supertrend
supertrend(factor, atrPeriod) =>
    [a, direction] = ta.supertrend(factor, atrPeriod)
    direction

// Calculate Double Supertrend
supertrend1 = supertrend(factor1, atrPeriod1)
supertrend2 = supertrend(factor2, atrPeriod2)

// Entry conditions
longCondition = (supertrend1 < 0 and supertrend2 < 0) and (tradeDirection == "Long" or tradeDirection == "Both")
shortCondition = (supertrend1 > 0 and supertrend2 > 0) and (tradeDirection == "Short" or tradeDirection == "Both")

// Exit conditions
longExitCondition = (supertrend1 > 0 and supertrend2 > 0) and (tradeDirection == "Long" or tradeDirection == "Both")
shortExitCondition = (supertrend1 < 0 and supertrend2 < 0) and (tradeDirection == "Short" or tradeDirection == "Both")

// Variables to store the highest and lowest prices during the trade
var float highestPrice = na
var float lowestPrice = na

// Get the entry price from open trades
entryPrice = strategy.opentrades.entry_price(strategy.opentrades - 1)

// Reset highestPrice or lowestPrice when entering new trades
if (longCondition and strategy.position_size <= 0)
    highestPrice := na // Reset the highest price
    strategy.entry("My Long Entry Id", strategy.long) // Enter long position
    strategy.close("My Short Entry Id", "Short Exit") // Close short position if any

if (shortCondition and strategy.position_size >= 0)
    lowestPrice := na // Reset the lowest price
    strategy.entry("My Short Entry Id", strategy.short) // Enter short position
    strategy.close("My Long Entry Id", "Long Exit") // Close long position if any

// Exit trades based on conditions
if (longExitCondition and strategy.position_size > 0)
    strategy.close("My Long Entry Id", "Long Exit") // Exit long position

if (shortExitCondition and strategy.position_size < 0)
    strategy.close("My Short Entry Id", "Short Exit") // Exit short position

if (strategy.position_size > 0)
    // Update the highest price for long positions
    highestPrice := na(highestPrice) ? high : math.max(highestPrice, high)

    // Step 1
    if (useTakeProfit and numberOfSteps >= 1)
        strategy.exit("Take Profit 1", from_entry="My Long Entry Id", qty_percent=takeProfitAmount1, limit=entryPrice * (1 + takeProfitPercent1 / 100))
    // Step 2
    if (useTakeProfit and numberOfSteps >= 2)
        strategy.exit("Take Profit 2", from_entry="My Long Entry Id", qty_percent=takeProfitAmount2, limit=entryPrice * (1 + takeProfitPercent2 / 100))
    // Step 3
    if (useTakeProfit and numberOfSteps >= 3)
        strategy.exit("Take Profit 3", from_entry="My Long Entry Id", qty_percent=takeProfitAmount3, limit=entryPrice * (1 + takeProfitPercent3 / 100))
    // Step 4
    if (useTakeProfit and numberOfSteps == 4)
        strategy.exit("Take Profit 4", from_entry="My Long Entry Id", qty_percent=takeProfitAmount4, limit=entryPrice * (1 + takeProfitPercent4 / 100))

if (strategy.position_size < 0)
    // Update the lowest price for short positions
    lowestPrice := na(lowestPrice) ? low : math.min(lowestPrice, low)

    // Step 1
    if (useTakeProfit and numberOfSteps >= 1)
        strategy.exit("Take Profit 1", from_entry="My Short Entry Id", qty_percent=takeProfitAmount1, limit=entryPrice * (1 - takeProfitPercent1 / 100))
    // Step 2
    if (useTakeProfit and numberOfSteps >= 2)
        strategy.exit("Take Profit 2", from_entry="My Short Entry Id", qty_percent=takeProfitAmount2, limit=entryPrice * (1 - takeProfitPercent2 / 100))
    // Step 3
    if (useTakeProfit and numberOfSteps >= 3)
        strategy.exit("Take Profit 3", from_entry="My Short Entry Id", qty_percent=takeProfitAmount3, limit=entryPrice * (1 - takeProfitPercent3 / 100))
    // Step 4
    if (useTakeProfit and numberOfSteps == 4)
        strategy.exit("Take Profit 4", from_entry="My Short Entry Id", qty_percent=takeProfitAmount4, limit=entryPrice * (1 - takeProfitPercent4 / 100))