
이 전략은 양평선 시스템을 기반으로 한 동적 트렌드 추적 전략으로, 빠른 평균선과 느린 평균선의 교차 신호를 결합하고, 필터링 된 평균선을 도입하여 진입 시기를 최적화하고, 자금 관리 및 위험 통제를 통해 안정적인 거래 효과를 달성합니다.
전략은 11주기 및 31주기 간단한 이동 평균 ((SMA) 을 주요 신호 시스템으로 채택하고, 5주기 평균선을 필터로 사용한다. 빠른 선 ((SMA11) 에 느린 선 ((SMA31)) 을 통과하고 가격이 필터 평균선 위에 있을 때, 시스템은 여러 신호를 생성한다. 빠른 선 아래에 느린 선을 통과할 때, 시스템은 평소한다. 전략은 고정된 자본량을 설정하여 각 거래의 규모를 제어하여, 위험 관리를 실현한다.
이 전략은 다중 평평선 시스템을 통해 비교적 안정적인 트렌드 추적 시스템을 구축한다. 일부 고유 한 한계가 있지만, 합리적인 최적화 및 개선으로 전략의 안정성과 수익성을 더욱 향상시킬 수 있다. 상인은 실장 적용 시 시장의 특정 상황에 따라 파라미터를 타겟 조정하는 것이 좋습니다.
/*backtest
start: 2024-10-01 00:00:00
end: 2024-10-31 23:59:59
period: 3h
basePeriod: 3h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy('Nifty 30m SMA Crossover Long', overlay=true)
start = timestamp(2020, 1, 1, 0, 0)
end = timestamp(2024, 12, 31, 0, 0)
SlowSma = ta.sma(close, 31)
FastSma = ta.sma(close, 11)
FilterSma = ta.sma(close, 5)
plot(SlowSma, title='Sma 31', color=color.new(color.green, 0))
plot(FastSma, title='Sma 11', color=color.new(color.red, 0))
plot(FilterSma, title='Filter Sma 5', color=color.new(color.black, 0))
// strategy
LongEntry = FastSma > SlowSma and close > FilterSma
LongExit = FastSma < SlowSma
MyQty = 10000000 / close
// // Plot signals to chart
// plotshape(not LongExit and strategy.position_size > 0 and bIndicator, title='Hold', location=location.abovebar, color=color.new(color.blue, 0), style=shape.square, text='Hold', textcolor=color.new(color.blue, 0))
// plotshape(LongExit and bIndicator and strategy.position_size > 0, title='Exit', location=location.belowbar, color=color.new(color.red, 0), style=shape.triangledown, text='Sell', textcolor=color.new(color.red, 0))
// plotshape(LongEntry and strategy.position_size == 0 and bIndicator, '', shape.arrowup, location.abovebar, color.new(color.green, 0), text='Buy', textcolor=color.new(color.green, 0))
// plotshape(not LongEntry and strategy.position_size == 0 and bIndicator, '', shape.circle, location.belowbar, color.new(color.yellow, 0), text='Wait', textcolor=color.new(color.black, 0))
if time >= start and time < end
strategy.entry('Enter Long', strategy.long, qty=1, when=LongEntry)
strategy.close('Enter Long', when=LongExit)