
この戦略は,相対的に強い弱い指数 ((RSI) に基づく動力戦略であり,手動でストップ ((TP) とストップ ((SL) を設定する機能と組み合わせている.戦略の主な構想は,RSI指標を使用して市場の過剰買いと過剰売り状態を捕捉し,近年の最高値と最低値の相対的な日線閉店価格の位置を考慮しながら,その場を判断するタイミングを判断する.戦略は,既定のストップまたはストップ損失レベルに達すると,自動的に平定する.
この戦略は,RSI動態指標に基づく取引枠組みを提供し,手動のストップ・ストップ・ロスの機能を導入し,トレーダーが自身のリスク好みと市場見解に基づいてポジションを管理できるようにする.しかし,戦略のパフォーマンスは,パラメータの選択と市場の状況に大きく依存する.したがって,トレーダーは,この戦略を慎重に使用し,充分に反測し,最適化し,他の形態の分析とリスク管理技術と組み合わせて,より安定した取引パフォーマンスを得るべきである.
//@version=5
strategy("RSI Strategy with Manual TP and SL", overlay=true)
// Strategy Parameters
length = input(14, title="RSI Length")
overSold = input(30, title="Oversold Level")
overBought = input(70, title="Overbought Level")
trail_profit_pct = input.float(20, title="Trailing Profit (%)")
// RSI Calculation
vrsi = ta.rsi(close, length)
// Entry Conditions for Long Position
rsi_crossed_below_30 = vrsi > overSold and ta.sma(vrsi, 2) <= overSold // RSI crossed above 30
daily_close_above_threshold = close > (ta.highest(close, 50) * 0.7) // Daily close above 70% of the highest close in the last 50 bars
// Entry Conditions for Short Position
rsi_crossed_above_70 = vrsi < overBought and ta.sma(vrsi, 2) >= overBought // RSI crossed below 70
daily_close_below_threshold = close < (ta.lowest(close, 50) * 1.3) // Daily close below 130% of the lowest close in the last 50 bars
// Entry Signals
if (rsi_crossed_below_30 and daily_close_above_threshold)
strategy.entry("RsiLE", strategy.long, comment="RsiLE")
if (rsi_crossed_above_70 and daily_close_below_threshold)
strategy.entry("RsiSE", strategy.short, comment="RsiSE")
// Manual Take Profit and Stop Loss
tp_percentage = input.float(1, title="Take Profit (%)")
sl_percentage = input.float(1, title="Stop Loss (%)")
long_tp = strategy.position_avg_price * (1 + tp_percentage / 100)
long_sl = strategy.position_avg_price * (1 - sl_percentage / 100)
short_tp = strategy.position_avg_price * (1 - tp_percentage / 100)
short_sl = strategy.position_avg_price * (1 + sl_percentage / 100)
strategy.exit("TP/SL Long", "RsiLE", limit=long_tp, stop=long_sl)
strategy.exit("TP/SL Short", "RsiSE", limit=short_tp, stop=short_sl)