
この戦略は,RSI指数と2つのEMA線の交差信号に基づいて,買出点を判断する. 閉盘価格がEMA100とEMA20を下回り,RSI値が30を下回ったときに買入シグナルを生成する. 閉盘価格がEMA100とEMA20を破り,RSI値が70を超えたときに売り出しシグナルを生成する. この戦略の主な考え方は,RSI指数を使用して,超超買出状況を判断し,EMA線のトレンド判断と組み合わせて,市場の波動的な低点と高点を捕捉するために,低値と高値のポーリング操作を行う.
RSIと双EMAの交差信号の量化戦略は,RSI指標とEMA均線を組み合わせることで,波動的な状況の高低点をよりうまく捕捉して差差分レバレッジを行う簡単な実用的な量化取引戦略である.しかし,この戦略には,トレンドの状況下での失敗,ポジション管理とリスク管理の欠如などのいくつかの制限とリスクがあります.したがって,実際のアプリケーションでは,戦略の安定性と収益性を高めるために,市場の特徴と個人の好みに応じて適切な最適化と改善が必要になります.この戦略は,量化取引の入門戦略として学び,使用できます.しかし,慎重に,厳格なリスク管理が必要です.
/*backtest
start: 2024-03-01 00:00:00
end: 2024-03-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("RSI-EMA100&20 Buy/Sell Signal", overlay=true)
// Input parameters
rsiLength = input.int(14, "RSI Length")
emaCloseLength = input.int(100, "EMA Length (Closing Price)")
emaLowLength = input.int(20, "EMA Length (Low Price)")
oversoldLevel = input.int(30, "Oversold Level")
overboughtLevel = input.int(70, "Overbought Level")
// Calculate RSI
rsi = ta.rsi(close, rsiLength)
// Calculate EMA of closing price
emaClose = ta.ema(close, emaCloseLength)
// Calculate EMA of low price
emaLow = ta.ema(low, emaLowLength)
// Determine overbought and oversold conditions
isOversold = rsi <= oversoldLevel
isOverbought = rsi >= overboughtLevel
// Plot RSI and its EMAs
plot(rsi, color=color.blue, title="RSI")
plot(emaClose, color=color.green, title="EMA 100 (Closing Price)")
plot(emaLow, color=color.orange, title="EMA 20 (Low Price)")
// Strategy entry condition: Closing price is below both EMAs and RSI is less than or equal to oversold level
buySignal = close < emaClose and close < emaLow and isOversold
// Plot buy signals
plotshape(series=buySignal, style=shape.triangleup, location=location.abovebar, color=color.green, size=size.small)
// Strategy entry
if (buySignal)
strategy.entry("Buy", strategy.long)
// Strategy exit condition: Price crosses above both EMAs and RSI is greater than or equal to overbought level
sellSignal = close > emaClose and close > emaLow and isOverbought
// Plot sell signals
plotshape(series=sellSignal, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)
// Strategy exit
if (sellSignal)
strategy.entry("Sell", strategy.short)
// Plot sell signals
plotshape(series=sellSignal, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)
// Strategy exit
if (sellSignal)
strategy.entry("Sell", strategy.short)