
この戦略は,市場の短期的な傾向と超買い超売状態を識別するために,2つの移動平均 ((快速移動平均と遅い移動平均) と相対的に強い指数 ((RSI) を使用します. 急速移動平均がゆっくり移動平均を下から上へと横切って,RSIが超売りレベルを下回るとき,戦略は多頭ポジションを開きます. 急速移動平均がゆっくり移動平均を上から下へと横切って,RSIが超買いレベルを下回るとき,戦略は空頭ポジションを開きます.
この戦略は,二重移動平均とRSI指標を組み合わせて,短期間に価格トレンドを捕捉し,波動的な市場でのショートライン取引に適しています.戦略の論理は明確で,パラメータは柔軟で,実行し,最適化することが容易です.しかし,揺れ動いている市場では,取引信号が過剰に発生し,長期のトレンドの把握能力は弱です.したがって,実際のアプリケーションでは,戦略の安定性と収益性を高めるために,他の指標の導入,パラメータの最適化選択,リスク管理措置の追加などの方法を考慮することができます.
/*backtest
start: 2024-03-24 00:00:00
end: 2024-03-25 05:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Short-Term Scalp Trading Strategy", overlay=true)
// Define strategy parameters
fastMA_length = input(5, title="Fast MA Length")
slowMA_length = input(10, title="Slow MA Length")
rsi_length = input(7, title="RSI Length")
rsi_oversold = input(20, title="RSI Oversold Level")
rsi_overbought = input(80, title="RSI Overbought Level")
// Calculate Moving Averages
fastMA = ta.sma(close, fastMA_length)
slowMA = ta.sma(close, slowMA_length)
// Calculate RSI
rsi = ta.rsi(close, rsi_length)
// Define entry conditions
longCondition = ta.crossunder(fastMA, slowMA) and rsi < rsi_oversold
shortCondition = ta.crossover(fastMA, slowMA) and rsi > rsi_overbought
// Enter long position
strategy.entry("Long", strategy.long, when=longCondition)
// Enter short position
strategy.entry("Short", strategy.short, when=shortCondition)
// Define exit conditions
longExitCondition = ta.crossunder(fastMA, slowMA) or ta.crossover(rsi, rsi_overbought)
shortExitCondition = ta.crossover(fastMA, slowMA) or ta.crossunder(rsi, rsi_oversold)
// Exit long position
if (longExitCondition)
strategy.close("Exit Long", "Long")
// Exit short position
if (shortExitCondition)
strategy.close("Exit Short", "Short")
// Plot buy and sell signals
plotshape(series=longCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)
plotshape(series=shortCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)