
이 전략은 시장의 단기 트렌드와 오버 바이 오버 셀 상태를 식별하기 위해 두 가지 이동 평균 ((빠른 이동 평균과 느린 이동 평균) 과 상대적으로 강한 지수 ((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)