
この戦略は,ブリン帯 (Bollinger Bands) と相対的に強い指標 (RSI) を用いて取引信号を識別する.価格がブリン帯を突破して軌道上または下,同時にRSIがオーバーバイレベルより高くまたはオーバーセールレベルより低い場合に,買入または出荷信号を生成する.この戦略は,価格の極端な変動を捕捉し,RSIを使用してトレンドの強さを確認する.
ブリン帯RSI取引戦略は,価格と動力の指標を組み合わせて,価格が極端に変動するときに取引信号を生成する.この戦略の優点は,論理的に明確で,実行しやすく,最適化である.しかし,戦略の性能はパラメータ選択に依存し,特定の市場環境下で偽信号を多く発生させる可能性があります.パラメータを最適化し,他の指標を導入し,実際の取引コストを考慮するなどの方法を使用して,戦略の安定性と収益の可能性をさらに向上させることができます.
/*backtest
start: 2024-04-23 00:00:00
end: 2024-05-23 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Bollinger Bands + RSI Strategy", overlay=true)
// Bollinger Bands settings
length = input.int(20, title="BB Length")
src = close
mult = input.float(2.0, title="BB Multiplier")
basis = ta.sma(src, length)
dev = mult * ta.stdev(src, length)
upper = basis + dev
lower = basis - dev
// Plot Bollinger Bands
plot(basis, color=color.blue, title="Basis")
p1 = plot(upper, color=color.red, title="Upper Band")
p2 = plot(lower, color=color.green, title="Lower Band")
fill(p1, p2, color=color.gray, transp=90)
// RSI settings
rsiLength = input.int(14, title="RSI Length")
rsiOverbought = input.int(70, title="RSI Overbought Level")
rsiOversold = input.int(30, title="RSI Oversold Level")
rsi = ta.rsi(close, rsiLength)
// Buy and sell conditions
buyCondition = (close < lower) and (rsi < rsiOversold)
sellCondition = (close > upper) and (rsi > rsiOverbought)
// Execute buy and sell orders
if (buyCondition)
strategy.entry("Buy", strategy.long)
if (sellCondition)
strategy.close("Buy")