세션 브레이크 아웃 스칼핑 전략

저자:차오장, 날짜: 2023-09-20 17:00:16
태그:

전반적인 설명

이 전략은 사용자 정의 세션 동안 단기 브레이크로 멀티 타임프레임 도냐를 결합합니다. 단기 스칼핑 전략에 속합니다.

전략 논리

  1. 하루와 단기 중간 지점을 계산해서 시간 프레임에 걸쳐서 분출 구역을 형성합니다.

  2. 사용자 정의 가능한 거래 세션 동안만 거래합니다. 세션 시작에서 입력, 세션 종료.

  3. 엔트리 가격으로 가격의 실시간 EMA를 사용하세요. 가격이 중간점을 초과하면 브레이크오웃입니다.

  4. 탈출구 바깥에 정지하고, 탈출이 실패하면 정지한다.

  5. 중간 지점 근처에 가격이 다시 떨어지면 포지션을 닫고 실패한 브레이크오프를 확인합니다.

장점

  1. 복수 시간 프레임 조합을 통해 가짜 유출을 효과적으로 필터링합니다.

  2. 중요한 뉴스 사건에 대한 위험을 피하기 위해 정해진 세션.

  3. EMA 추적은 동력에 따라 적시에 입력할 수 있습니다.

  4. 멈추는 것은 위험을 통제하는 데 도움이 됩니다.

  5. 강제 종료는 하루종일 위험을 피합니다.

위험성

  1. 단기적인 탈출은 윙사와 중단에 직면할 수 있습니다.

  2. 일부 브레이크는 세션이 끝나기 전에 완전히 수익을 얻지 못할 수도 있습니다.

  3. 열악한 세션 정의는 기회를 놓칠 수 있습니다.

  4. 매번의 탈락이 예상 수익에 도달할 수 있다는 보장은 없습니다.

  5. 최적화는 파라미터의 과도한 적합성을 위험합니다.

강화

  1. 최적의 조합을 찾기 위해 파업 매개 변수를 테스트합니다.

  2. 입력 정확도를 높이기 위해 추가 지표를 평가합니다.

  3. 수익 대 위험 균형을 위해 거래 세션 최적화.

  4. 연구 통합은 이익을 확보하기 위해 수익 전략을 취합니다.

  5. 다양한 기호에 대한 테스트 매개 변수 차이

  6. 동적 매개 변수 최적화를 위해 기계 학습을 사용하십시오.

결론

이 전략은 제한된 세션 브레이크에 대한 단기 스칼핑을 시도합니다. 거짓 브레이크와 위험 통제에 대한 최적화로 실용적이고 효율적인 단기 시스템으로 정제 될 수 있습니다.


/*backtest
start: 2023-08-20 00:00:00
end: 2023-09-19 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=3
strategy("Breakout Scalper", overlay=true)

// -------------------------------------------------------------------------------------------------
// INPUTS
// -------------------------------------------------------------------------------------------------
// Period of the "fast" donchian channel
fast_window = input(title="Fast Window",  defval=13, minval=1)
// Used for the volatility (atr) period
slow_window = input(title="Slow Window",  defval=52, minval=1)
// Period of EMA used as the current price
instant_period = input(title="Instant Period",  defval=3, minval=1)
// Minimum ratio of cloud width to ATR in order for trade to be active
cloud_min_percent = input(title="Minimum Cloud ATR Multiplier", type=float, defval=1.0, minval=0)
// Session where we allow trades to be active
trading_sesh = input(title="Trading Session",  defval='1000-1500')
// -------------------------------------------------------------------------------------------------

// -------------------------------------------------------------------------------------------------
// SESSION TIMING
// -------------------------------------------------------------------------------------------------
is_newbar(t) =>
    na(t[1]) and not na(t) or t[1] < t

day_time = time("D")
sess_time = time(timeframe.period, trading_sesh)
day_open_bar = is_newbar(day_time)
sess_open_bar = is_newbar(sess_time)
sess_close_bar = na(sess_time) and not na(sess_time[1])
sess_is_open = false
sess_is_open := sess_open_bar ? true : (sess_close_bar ? false : sess_is_open[1])
// -------------------------------------------------------------------------------------------------

// -------------------------------------------------------------------------------------------------
// DONCHIANS
// -------------------------------------------------------------------------------------------------
slow_high = na
slow_high := day_open_bar ? high : (high > slow_high[1] ? high : slow_high[1])
slow_low = na
slow_low := day_open_bar ? low : (low < slow_low[1] ? low : slow_low[1])
slow_mid = (slow_high + slow_low) / 2

fast_low = max(slow_low, lowest(fast_window))
fast_high = min(slow_high, highest(fast_window))
fast_mid = (fast_low + fast_high) / 2
// -------------------------------------------------------------------------------------------------


// -------------------------------------------------------------------------------------------------
// TREND CLOUD
// -------------------------------------------------------------------------------------------------
cloud_width = fast_mid - slow_mid
slow_atr = atr(slow_window)
cloud_percent = cloud_width / slow_atr
cloud_color = cloud_percent > cloud_min_percent ? green : (cloud_percent < -cloud_min_percent ? red : gray)

fp = plot(fast_mid, title="Fast MidR", color=green)
sp = plot(slow_mid, title="Slow MidR", color=red)
fill(fp, sp, color=cloud_color)
// -------------------------------------------------------------------------------------------------


// -------------------------------------------------------------------------------------------------
// INSTANT PRICE
// -------------------------------------------------------------------------------------------------
instant_price = ema(close, instant_period)
plot(instant_price, title="Instant Price", color=black, transp=50)
// -------------------------------------------------------------------------------------------------


// -------------------------------------------------------------------------------------------------
// ENTRY SIGNALS & STOPS
// -------------------------------------------------------------------------------------------------
buy_entry_signal = sess_is_open and (instant_price > fast_mid) and (cloud_percent > cloud_min_percent)
sell_entry_signal = sess_is_open and (instant_price < fast_mid) and (cloud_percent < -cloud_min_percent)
buy_close_signal = sess_close_bar or (cloud_percent < 0)
sell_close_signal = sess_close_bar or (cloud_percent > 0)

entry_buy_stop = slow_high
entry_sell_stop = slow_low
exit_buy_stop = max(slow_low, fast_low)
exit_sell_stop = min(slow_high, fast_high)

entry_buy_stop_color = (strategy.position_size == 0) ? (buy_entry_signal ? green : na) : na
plotshape(entry_buy_stop, location=location.absolute, color=entry_buy_stop_color, style=shape.circle)
entry_sell_stop_color = (strategy.position_size == 0) ? (sell_entry_signal ? red : na) : na
plotshape(entry_sell_stop, location=location.absolute, color=entry_sell_stop_color, style=shape.circle)
exit_buy_stop_color = (strategy.position_size > 0) ? red : na
plotshape(exit_buy_stop, location=location.absolute, color=exit_buy_stop_color, style=shape.xcross)
exit_sell_stop_color = (strategy.position_size < 0) ? green : na
plotshape(exit_sell_stop, location=location.absolute, color=exit_sell_stop_color, style=shape.xcross)
// -------------------------------------------------------------------------------------------------


// -------------------------------------------------------------------------------------------------
// STRATEGY EXECUTION
// -------------------------------------------------------------------------------------------------
strategy.entry("long", strategy.long, stop=entry_buy_stop, when=buy_entry_signal)
strategy.cancel("long", when=not buy_entry_signal)
strategy.exit("stop", "long", stop=exit_buy_stop)
strategy.entry("short", strategy.short, stop=entry_sell_stop, when=sell_entry_signal)
strategy.cancel("short", when=not sell_entry_signal)
strategy.exit("stop", "short", stop=exit_sell_stop)
strategy.close("long", when=buy_close_signal)
strategy.close("short", when=sell_close_signal)
// -------------------------------------------------------------------------------------------------

더 많은