
これは,RSI指標とパラパラ線転換指標 ((PSAR) を組み合わせた取引戦略であり,ダイナミックな超買超売区間を設定し,価格とPSARの交差信号と連携して市場動向を捉えるためのものです. 同時に,この戦略は,より安定した取引パフォーマンスを実現するために,停止停止損失機構とポジション管理を含む完善したリスク管理システムを統合しています.
戦略は主に以下のコアロジックに基づいています.
この戦略は,PSARとRSIの指標を組み合わせて,完全な取引システムを構築する.その優点は,信号の明確性,リスクの制御であるが,依然として市場環境の適応性に注意する必要がある.継続的な最適化とパラメータの調整により,戦略は,より良い取引効果を達成する見込みがある.実物取引の前に十分な反省を検証し,特定の市場の特徴に応じてパラメータの設定を調整することをお勧めする.
/*backtest
start: 2024-02-25 00:00:00
end: 2025-02-22 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"SOL_USDT"}]
*/
//@version=5
strategy("PSAR & RSI Strategy with Risk Management", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// User Inputs
psar_start = input.float(0.02, title="PSAR Start")
psar_increment = input.float(0.02, title="PSAR Increment")
psar_max = input.float(0.2, title="PSAR Max")
rsi_length = input.int(14, title="RSI Length")
rsi_overbought = input.int(70, title="RSI Overbought Level")
rsi_oversold = input.int(30, title="RSI Oversold Level")
tp_percent = input.float(5, title="Take Profit %") / 100 // Take Profit Level
sl_percent = input.float(3, title="Stop Loss %") / 100 // Stop Loss Level
// PSAR Calculation
psar = ta.sar(psar_start, psar_increment, psar_max)
// RSI Calculation
rsi = ta.rsi(close, rsi_length)
// Buy & Sell Conditions
buy_signal = ta.crossover(close, psar) and rsi < rsi_oversold
sell_signal = ta.crossunder(close, psar) and rsi > rsi_overbought
// Plot PSAR on Chart
plot(psar, style=plot.style_cross, color=color.blue, title="PSAR")
// Buy & Sell Signals on Chart
plotshape(series=buy_signal, location=location.belowbar, color=color.green, style=shape.labelup, title="BUY Signal")
plotshape(series=sell_signal, location=location.abovebar, color=color.red, style=shape.labeldown, title="SELL Signal")
// RSI Visualization (Dynamic Colors)
rsi_color = rsi > rsi_overbought ? color.red : rsi < rsi_oversold ? color.green : color.blue
plot(rsi, title="RSI", color=rsi_color, linewidth=2)
hline(rsi_overbought, "Overbought", color=color.red)
hline(rsi_oversold, "Oversold", color=color.green)
// Alerts for Buy & Sell
alertcondition(buy_signal, title="BUY Alert", message="Buy Signal Triggered!")
alertcondition(sell_signal, title="SELL Alert", message="Sell Signal Triggered!")
// Strategy Execution with Take Profit & Stop Loss
if buy_signal
strategy.entry("Buy", strategy.long)
strategy.exit("Take Profit / Stop Loss", from_entry="Buy", limit=close * (1 + tp_percent), stop=close * (1 - sl_percent))
if sell_signal
strategy.close("Buy")