RSI ダイナミックポジション平均化戦略

作者: リン・ハーンチャオチャン開催日:2024-02-06 09:44:05
タグ:

img

概要

この戦略は,相対強度指数 (RSI) とマーティンゲールポジション平均化原理を組み合わせます.RSIが過売線を下回るとロングポジションを開始し,価格が引き続き下落した場合,ポジションを倍増します.小規模な目標で利益を得ることができます.この戦略は,安定した利益のためにスポット取引における高市場キャップコインに適しています.

戦略の論理

  1. RSI指標を使用して,RSI期間を14に設定し,過売値を30に設定し,市場の過売状態を特定します.
  2. RSI < 30 のとき,口座資本の 5% で最初のロングポジションを開始する.
  3. 価格が初期エントリー価格から0.5%下落すると,ポジションサイズを倍にして平均を下回る.価格がさらに下落すると,ポジションサイズを4倍にして再び平均を下回る.
  4. 毎回0.5%の増額で利益を得る
  5. サイクルを繰り返す

利点分析

  • 良いエントリーポイントのためのRSIで市場過剰販売状態を特定する.
  • マルティンゲールポジション平均値が 平均入場価格を下げます
  • 小規模な利益を取ることで 一貫した利益が得られます
  • 控えられたリスクのための高市場資本のコインのスポット取引に適しています.

リスク分析

  • 長期にわたる市場不況は,大きな損失をもたらす可能性があります.
  • ストップ・ロスは無制限のダウンサイドです
  • 平均値を下げすぎると 損失が増える
  • 長期方向のリスクは依然として固有です

オプティマイゼーションの方向性

  1. ストップ・ロスは最大損失を制限する.
  2. RSIのパラメータを最適化して 最適なオーバー買い/オーバーセール信号を見つけます
  3. 特定のコインの波動性に基づいて 合理的な利益の範囲を設定します
  4. 総資産またはポジションサイズ化規則に基づいて平均速度を決定する.

概要

この戦略は,RSI指標とマルティンゲールポジション平均を組み合わせて,適正なダウン平均値で過売り状況を利用し,安定した利益のために小利益を取ります.ストップ損失,パラメータ調整などによって軽減できるリスクがあります.


/*backtest
start: 2024-01-06 00:00:00
end: 2024-02-05 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Stavolt

//@version=5
strategy("RSI Martingale Strategy", overlay=true, default_qty_type=strategy.cash, currency=currency.USD)

// Inputs
rsiLength = input(14, title="RSI Length")
oversoldThreshold = input(30, title="Oversold Threshold") // Keeping RSI threshold
profitTargetPercent = input(0.5, title="Profit Target (%)") / 100
initialInvestmentPercent = input(5, title="Initial Investment % of Equity")

// Calculating RSI
rsiValue = ta.rsi(close, rsiLength)

// State variables for tracking the initial entry
var float initialEntryPrice = na
var int multiplier = 1

// Entry condition based on RSI
if (rsiValue < oversoldThreshold and na(initialEntryPrice))
    initialEntryPrice := close
    strategy.entry("Initial Buy", strategy.long, qty=(strategy.equity * initialInvestmentPercent / 100) / close)
    multiplier := 1

// Adjusting for errors and simplifying the Martingale logic
// Note: This section simplifies the aggressive position size adjustments without loops
if (not na(initialEntryPrice))
    if (close < initialEntryPrice * 0.995) // 0.5% drop from initial entry
        strategy.entry("Martingale Buy 1", strategy.long, qty=((strategy.equity * initialInvestmentPercent / 100) / close) * 2)
        multiplier := 2 // Adjusting multiplier for the next potential entry

    if (close < initialEntryPrice * 0.990) // Further drop
        strategy.entry("Martingale Buy 2", strategy.long, qty=((strategy.equity * initialInvestmentPercent / 100) / close) * 4)
        multiplier := 4

    // Additional conditional entries could follow the same pattern

// Checking for profit target to close positions
if (strategy.position_size > 0 and (close - strategy.position_avg_price) / strategy.position_avg_price >= profitTargetPercent)
    strategy.close_all(comment="Take Profit")
    initialEntryPrice := na // Reset for next cycle


もっと