セッション・ブレイク・スカルピング戦略

作者: リン・ハーンチャオチャン, 日付: 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)
// -------------------------------------------------------------------------------------------------

もっと