昨日の最高価格戦略を突破


作成日: 2023-11-06 10:49:57 最終変更日: 2023-11-06 10:49:57
コピー: 0 クリック数: 709
1
フォロー
1617
フォロワー

昨日の最高価格戦略を突破

概要

昨日の最高値を突破する戦略は,昨日の最高値を突破したときに多頭ポジションを開くトレンド追跡戦略であり,当日複数の突破があったとしても,ポジションを開くことができます. それはトレンドを追跡する主な特徴であり,市場は明らかにトレンドの動きを示し,波動率が高い状況に適用されます.

原則

この戦略は,入場と出場のタイミングを特定するために,一連の指標を導入します.

  • ROC曲線フィルター - 策略に適合しない波動的な市場をフィルターするために使用される.

  • 突破点 - 当日の最高価格,最低価格,開場価格を記録する. 価格が当日の最高価格を破るときは入場信号である.

  • 入場・退場条件 - 入場後,ストップ・ロズとストップ・ストップの比率を設定し,トラッキング・ストップを有効にして利益をロックすることができる.特定のEMAに対して条件付きのストップも可能である.

  • 最適化配置 - 入場前の間隔の比率を設定して入場タイミングをカスタマイズし,偽突破を避ける. 止損,止止,止損を追跡するダイナミックパラメータを設定できる.

具体的には,戦略は,当日の最高価格を記録することによって入場を判断する. 当日の最高価格を超えると多頭入場する. その後,ストップとストップアウトを設定し,特定のEMAを下回ったときにストップオフを有効にすることができます. 最適化方法は,入場前の間隔比率を設定し,リスクを管理するためにストップオフ比率を調整し,トラッキングストップオフを有効にすることで利益をロックします.

優位分析

この戦略の利点は以下の通りです.

  • 流行を観察し,流行の利潤を掴むことができます.

  • 突破戦略,入場シグナルが明確.

  • チケットの価格を考慮して,連続入場を避けましょう.

  • リスク管理に役立つ 止損ブレーキの設定

  • ストップ・ロスの設定を追跡し,利益をロックします.

  • パラメータの最適化により入場時間を調整し,リスクを制御する.

  • シンプルで直感的で理解しやすい.

  • 多空双方向で利用できる.

リスク分析

この戦略には以下のリスクもあります.

  • 突破型の戦略は簡単に封じ込められる.入場後,価格はすぐに下がるかもしれない.

  • 動向的な状況では有効で,震動的な状況では不適切である.

  • 合理的なストップレスの設定が必要で,過度に緩和すると損失が増加する可能性があります.

  • 試合開始間隔は合理的に設定する必要がありますが,極端な場合は損失が増加する可能性があります.

  • 偽の突破は不必要な損失を招く可能性があり,調整・最適化が必要である.

  • 取引の規模が後続に支えるかどうか注目すべきだ.

  • 異なる時間周期のパラメータ設定の間の協調性に注意してください.

最適化の方向

この戦略は以下の点で最適化できます.

  • 取引量,震動指数など,他の技術指標の判断を追加し,震動の状況で被套を避ける.

  • 曲線適合指標を追加し,トレンドの質を判断し,偽のトレンドを避ける.

  • 入場間隔の設定を動的に最適化し,市場の変動率に応じて間隔を調整する.

  • ストップ・ストップの設定を動的に最適化し,市場の調整パラメータに従います.

  • 異なる品種に対して異なる周期で異なるパラメータを設定します.

  • 異なるパラメータが戦略に与える影響をMachine LearningのTRAININGを用いてテストする.

  • Optionsの機能の最適化設定を追加する.

  • 震災時の戦略を研究する.

  • タイムサイクルと品種を横断する組み合わせ戦略に拡張する.

要約する

この戦略は,昨日の最高値を突破したトレンド追跡のアイデアに基づいている.トレンドの状況ではよく機能している.しかし,リスクとパラメータの最適化の難点もある.より多くの判断指標,ダイナミックな最適化パラメータ設定,組み合わせ戦略に拡張するなどの手段を導入することによってさらに最適化することができる.全体的に,この戦略はショートラインのトレンドの状況を追跡するのに適しているが,リスク制御とパラメータの最適化に注意する必要がある.

ストラテジーソースコード
/*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)