
이 전략은 이동 평균 금 叉 및死 叉를 기반으로 장기간 다중 코오킹을 실현하고, 오전기 승률의 통계에 따라 오후에만 폐폐 손실 및 정지, 아침의 높은 변동률에 의해 좌우되는 것을 피한다.
이 전략은 3개의 다른 변수의 이동 평균을 사용한다: 14일선, 28일선 및 56일선. 14일선에서 56일선을 통과할 때 더 하고, 14일선 아래 56일선을 통과할 때 공백을 한다. 이것은 긴 선의 트렌드를 추적하는 기본적인 방법이다. 일부 잡음을 필터링하기 위해, 전략은 28일선을 참고로 추가하고, 14일선이 동시에 28일선보다 높거나 낮을 때만 거래 신호를 낸다.
이 전략의 핵심 혁신은 오후 4시에서 5시 사이에만 스톱 스톱을 하는 것이다. 통계에 따르면, 하루의 최고 가격과 최저 가격의 70%의 확률이 상장 첫 시간 내에 발생한다. 상장 시기의 높은 변동이 전략에 대한 충격을 회피하기 위해, 오후 거래 시간 동안만 스톱 스톱을 한다.
이 전략에는 다음과 같은 장점이 있습니다.
이 전략에는 다음과 같은 위험도 있습니다.
이 전략은 다음의 몇 가지 측면에서 더 개선될 수 있습니다.
이 전략의 전체적인 아이디어는 명확하고 이해하기 쉽고, 오픈 특성을 설계한 스톱 로직을 효과적으로 활용하여, 이른 시기의 높은 변동성을 피할 수 있는 봉쇄구역은 추가 테스트와 최적화를 할 가치가 있다. 그러나, 맞춤 및 놓친 기회의 위험이 있으며, 개별 주식에 대한 파라미터를 조정할 필요가 있다.
/*backtest
start: 2023-11-23 00:00:00
end: 2023-11-30 00:00:00
period: 10m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
strategy("MAC 1st Trading Hour Walkover", overlay=true)
// Setting up timeperiod for testing
startPeriodYear = input(2014, "Backtest Start Year")
startPeriodMonth = input(1, "Backtest Start Month")
startPeriodDay = input(2, "Backtest Start Day")
testPeriodStart = timestamp(startPeriodYear, startPeriodMonth, startPeriodDay, 0, 0)
stopPeriodYear = input(2025, "Backtest Stop Year")
stopPeriodMonth = input(12, "Backtest Stop Month")
stopPeriodDay = input(30, "Backtest Stop Day")
testPeriodStop = timestamp(stopPeriodYear, stopPeriodMonth, stopPeriodDay, 0, 0)
// Moving Averages
ema14 = ema(close, 14)
ema28 = ema(close, 28)
sma56 = sma(close, 56)
// Plot
plot(ema14, title="ema14", linewidth=2, color=green)
plot(ema28, title="ema28", linewidth=2, color=red)
plot(sma56, title="sma56", linewidth=3, color=blue)
// Strategy
goLong = cross(ema14, sma56) and ema14 > ema28
goShort = cross(ema14, sma56) and ema14 < ema28
// Strategy.When to enter
if time >= testPeriodStart
if time <= testPeriodStop
strategy.entry("Go Long", strategy.long, 1.0, when=goLong)
strategy.entry("Go Short", strategy.short, 1.0, when=goShort)
// Strategy.When to take profit
if time >= testPeriodStart
if time <= testPeriodStop
strategy.exit("Close Long", "Go Long", profit=2000)
strategy.exit("Close Short", "Go Short", profit=2000)
// Strategy.When to stop out
// Some studies show that 70% of the days high low happen in the first hour
// of trading. To avoid having that volatility fire our loss stop we
// ignore price action in the morning, but allow stops to fire in the afternoon.
if time("60", "1000-1600")
strategy.exit("Close Long", "Go Long", loss=500)
strategy.exit("Close Short", "Go Short", loss=500)