昨日の高脱出戦略

作者: リン・ハーンチャオチャン,日付: 2023年11月6日 10:49:57
タグ:

img

概要

昨日の高いブレイクストラテジーは,価格が昨日の高値を超えると,ブレイクが1日間に複数回発生しても,長引くトレンドフォローするシステムです.それはトレンド市場条件を追求することを目的としています.

原則

この戦略は,入口・出口信号に関するいくつかの技術指標を使用しています.

  • ROCフィルター - 戦略は,今日の閉店が前日の閉店と比較して値値値を超えた価格変化パーセントを持つ場合にのみ有効です.これは,トレンドではない不安定な市場をフィルターします.

  • トリガーポイント - 今日の高値,低値,オープン価格を記録する.価格が今日の高値を超えるとロングエントリーが起動します.

  • 入口および出口条件 - 入口後,ストップ・ロストとテイク・プロフィートの割合が設定されます. トレイリング・ストップは,利益をロックするために有効にすることができます. 価格が基準EMAを下回ると条件付き出口.

  • コンフィギュレーション - 入場を予想または遅延するためのギャップパーセント. ストップ損失,利益,トラッキングストップパーセントをカスタマイズできます.

具体的には,エントリーシグナルのために今日の高価格を追跡する.価格が今日の高値を超えるとロングエントリーする.その後,ストップ・ロストとテイク・プロフィート出口が設定され,トレーリング・ストップが有効にされている.価格が与えられたEMAを下回ると代替出口.ギャップパーセントを設定し,リスクを制御するためにストップ・ロストとテイク・プロフィート比を調整することで最適化,トレーリング・ストップが利益をロックできるようにする.

利点分析

この戦略の利点は

  • トレンドをフォローして,トレンドの動きから利益を得ます.

  • 脱出戦略は 明確な入口信号を提示する

  • 今日の高い価格を考慮して 連続したエントリを避けます

  • ストップ・ロスト・アンド・テイク・プロフィートは リスク管理に役立ちます

  • 利潤のロックを停止する

  • リスク制御のためにパラメータ最適化で入力タイミングを調整できます

  • シンプルで直感的で 分かりやすく実行できます

  • 長期・短期取引に適用される.

リスク分析

考慮すべきリスク:

  • ブレイク戦略は,ウイプソウに敏感です. 価格は,入場後すぐに逆転する可能性があります.

  • 動向市場でのみ効果があり 変動条件では劣悪です

  • 合理的なストップ損失パーセントが必要で,あまりにも広い損失を増やす可能性があります.

  • 合理的なギャップパーセントが必要で 攻撃的すぎると損失が増加します

  • 誤った脱出は不必要な損失を 引き起こします 調整が必要です

  • ボランスは突破後も 維持する必要がある

  • 時間枠間のパラメータ間の一貫性が必要

オプティマイゼーションの方向性

可能な最適化:

  • 市場変動の際に 変動を避けるため 取引量や変動などの指標を 追加します

  • 曲線フィッティングインジケーターを追加して 傾向の強さを評価し 誤った傾向を避ける

  • 市場変動に基づいて,エントリーギャップのダイナミック最適化

  • ストップ・ロスのダイナミックな最適化と 市場の条件に従って利益を取ること

  • 異なるシンボルと時間枠のための異なるパラメータセット

  • マシン学習からTESTパラメータへの戦略パフォーマンスへの影響

  • 設定を最適化するためにオプション機能を追加します.

  • 異なる市場条件下で研究に適用可能性

  • 時間枠や多資産戦略を拡大する

結論

この戦略は,昨日の高いコンセプトのブレイクに基づいてトレンド市場の間に適正なパフォーマンスを提供しています.しかし,ウィップソーとパラメータ最適化困難のリスクがあります.判断,ダイナミックパラメータチューニング,組み合わせた戦略への拡張などを追加することでさらなる最適化が可能です.全体的に,短期的なトレンドに従うのに適していますが,リスク制御とパラメータチューニングが必要です.


/*backtest
start: 2023-10-06 00:00:00
end: 2023-11-05 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// Author: © tumiza 999 
// © TheSocialCryptoClub

//@version=5

strategy("Yesterday's High v.17.07", overlay=true, pyramiding = 1,
         initial_capital=10000, 
         default_qty_type=strategy.percent_of_equity, default_qty_value=10,
         slippage=1, backtest_fill_limits_assumption=1, use_bar_magnifier=true,
         commission_type=strategy.commission.percent, commission_value=0.075
         )

// -----------------------------------------------------------------------------
// ROC Filter
// -----------------------------------------------------------------------------

// f_security function by LucF for PineCoders available here: https://www.tradingview.com/script/cyPWY96u-How-to-avoid-repainting-when-using-security-PineCoders-FAQ/
f_security(_sym, _res, _src, _rep) => request.security(_sym, _res, _src[not _rep and barstate.isrealtime ? 1 : 0])[_rep or barstate.isrealtime ? 0 : 1]
high_daily = f_security(syminfo.tickerid, "D", high, false)

roc_enable = input.bool(false, "", group="ROC Filter from CloseD", inline="roc")
roc_threshold = input.float(1, "Treshold", step=0.5, group="ROC Filter from CloseD", inline="roc")

closed = f_security(syminfo.tickerid,"1D",close, false)
roc_filter= roc_enable ? (close-closed)/closed*100  > roc_threshold  : true


// -----------------------------------------------------------------------------
// Trigger Point 
// -----------------------------------------------------------------------------

open_session = ta.change(time('D'))
price_session = ta.valuewhen(open_session, open, 0)
tf_session = timeframe.multiplier <= 60

bgcolor(open_session and tf_session ?color.new(color.blue,80):na, title = "Session")

first_bar = 0
if open_session
    first_bar := bar_index

var max_today = 0.0
var min_today = 0.0
var high_daily1 = 0.0
var low_daily1 = 0.0
var today_open = 0.0

if first_bar
    high_daily1 := max_today
    low_daily1 := min_today
    today_open := open
    max_today := high
    min_today := low


if high >= max_today
    max_today := high

if low < min_today
    min_today := low


same_day  = today_open == today_open[1]

plot( timeframe.multiplier <= 240 and same_day ? high_daily1 : na, color= color.yellow , style=plot.style_linebr, linewidth=1, title='High line')
plot( timeframe.multiplier <= 240 and same_day ? low_daily1 : na, color= #E8000D , style=plot.style_linebr, linewidth=1, title='Low line')

// -----------------------------------------------------------------------------
// Strategy settings 
// -----------------------------------------------------------------------------

Gap = input.float(1,"Gap%", step=0.5, tooltip="Gap di entrata su entry_price -n anticipa entrata, con +n posticipa entrata", group = "Entry")
Gap2 = (high_daily1 * Gap)/100

sl  = input.float(3, "Stop-loss", step= 0.5,  group = "Entry")
tp  = input.float(9, "Take-profit", step= 0.5, group = "Entry")
stop_loss_price = strategy.position_avg_price * (1-sl/100)
take_price = strategy.position_avg_price * (1+tp/100)

sl_trl = input.float(2, "Trailing-stop", step = 0.5, tooltip = "Attiva trailing stop dopo che ha raggiunto...",group = "Trailing Stop Settings")//group = "Trailing Stop Settings")
Atrl= input.float(1, "Offset Trailing", step=0.5,tooltip = "Distanza dal prezzo", group = "Trailing Stop Settings")
stop_trl_price_cond = sl_trl * high/syminfo.mintick/100
stop_trl_price_offset_cond = Atrl * high/syminfo.mintick/100

stop_tick = sl * high/syminfo.mintick/100
profit_tick = tp * high/syminfo.mintick/100

mess_buy = "buy"
mess_sell = "sell"

// -----------------------------------------------------------------------------
// Entry - Exit - Close
// -----------------------------------------------------------------------------

if close < high_daily1 and roc_filter
    strategy.entry("Entry", strategy.long, stop = high_daily1 + (Gap2), alert_message = mess_buy)

ts_n  = input.bool(true, "Trailing-stop", tooltip = "Attiva o disattiva trailing-stop", group = "Trailing Stop Settings")
close_ema = input.bool(false, "Close EMA", tooltip = "Attiva o disattiva chiusura su EMA", group = "Trailing Stop Settings")
len1 = input.int(10, "EMA length", step=1, group = "Trailing Stop Settings")
ma1 = ta.ema(close, len1)

plot(ma1, title='EMA', color=color.new(color.yellow, 0))

if ts_n == true
    strategy.exit("Trailing-Stop","Entry",loss= stop_tick, stop= stop_loss_price, limit= take_price, trail_points = stop_trl_price_cond, trail_offset = stop_trl_price_offset_cond, comment_loss="Stop-Loss!!",comment_profit ="CASH!!", comment_trailing = "TRL-Stop!!", alert_message = mess_sell)
else
    strategy.exit("TP-SL", "Entry",loss= stop_tick, stop=stop_loss_price, limit= take_price, comment_loss= "Stop-loss!!!", comment_profit = "CASH!!", alert_message = mess_sell)

if close_ema == true and ta.crossunder(close,ma1)
    strategy.close("Entry",comment = "Close" , alert_message = mess_sell)



もっと