
この戦略は,相対的に強い指数 ((RSI) の指標を使用して,市場の超売り状況を判断し,RSIが30未満のときにポジションを多く開設し,同時に,開設価格の98.5%をストップ・ロスの価格に設定する.この戦略の主な考え方は,市場が超売りシグナルが発生したときに入場し,同時に,リスクを厳格に制御し,価格がストップ・ロスの価格を下回るとすぐに,ポジションを停止する.
RSIストップトラッキング取引戦略は,RSI指標によって超売り状況を判断し,同時に固定ストップ割合を設定し,リスクを厳格に制御し,全体的な考え方は簡単で分かりやすい.初心者の学習に使用に適しています.しかし,この戦略には,遅滞性,ストップメカニズムがシンプル,利益レベルが高くない問題があり,実用的な応用で継続的に最適化改善,戦略の安定性および収益性を向上させる必要があります.
/*backtest
start: 2024-02-01 00:00:00
end: 2024-02-29 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy('RSI Trading Bot', overlay=true)
// RSI threshold value and stop loss percentage
rsiThreshold = 30
stopLossPercentage = 1.5
// Calculate RSI
rsiLength = 14
rsiValue = ta.rsi(close, rsiLength)
// Initialize variables
var bool positionOpen = false
var float entryPrice = na
var float stopLossPrice = na
// Enter position when RSI crosses below threshold
if ta.crossunder(rsiValue, rsiThreshold)
strategy.entry('Long', strategy.long)
positionOpen := true
entryPrice := close
stopLossPrice := entryPrice * (1 - stopLossPercentage / 100)
stopLossPrice
// Exit position on stop loss
if positionOpen and close < stopLossPrice
strategy.close('Long')
positionOpen := false
entryPrice := na
stopLossPrice := na
stopLossPrice
// Plot entry and stop loss prices
plot(entryPrice, title='Entry Price', color=color.new(color.green, 0), linewidth=2)
plot(stopLossPrice, title='Stop Loss Price', color=color.new(color.red, 0), linewidth=2)