RSIに基づく動的ポジション追加戦略


作成日: 2024-02-06 09:44:05 最終変更日: 2024-02-06 09:44:05
コピー: 1 クリック数: 727
1
フォロー
1617
フォロワー

RSIに基づく動的ポジション追加戦略

概要

この戦略は,相対的に強い指数 ((RSI) とマーティンゲル加仓原理を組み合わせている. RSIが超売り線を下回ったときに,最初の買い出しを展開し,その後,価格が下がり続けると,2の指数で加仓して利潤を止めてしまう.この戦略は,高市場価値の通貨の現金取引に適用され,長期にわたって安定した利益を得ることができる.

戦略原則

  1. RSI指数を使用して市場の超売りを判断し,RSIの間は14と設定し,超売り値は30と設定する.
  2. RSI < 30 の場合,口座の5%の利回りで最初のポジションを多めにします.
  3. 価格が最初の入場価格より0.5%下落した場合,2倍のポジションでさらにポジションを入れます.価格が下落し続けると,4倍のポジションで再びポジションを入れます.
  4. 利回りは0.5%で,利回りは0.5%で,利回りは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