レジスタンスブレイクアウトサーキュラーストップロス戦略


作成日: 2023-12-11 11:44:49 最終変更日: 2023-12-11 11:44:49
コピー: 1 クリック数: 573
1
フォロー
1621
フォロワー

レジスタンスブレイクアウトサーキュラーストップロス戦略

概要

この戦略は,レジスタンス突破の価格形状信号と環状の停止のリスク制御機構を活用する.それは,抵抗位突破の後にポジションを多く作る,サポート位突破の後にポジションを空にする.同時に環状の停止と停止を設定し,リスクを効果的に制御する.

戦略原則

この戦略は,主に以下のポイントに基づいています.

  1. 平均線を使ってトレンドの方向を判断する.戦略で快慢平均線を設定し,快線で慢線を貫くことは長線を上向きに表示し,下向きは長線を下向きに表示する.

  2. 抵抗を突破する多入場する. 価格上昇が近年の高点を破ったとき,抵抗を突破する信号として,多入場する.

  3. サポートを突破する空調信号。 価格が下落して最近の低値を突破すると,サポートを突破する信号とみなされ,空調入場する。

  4. ループストップを設定する. 入場後にストップラインを設定し,価格の変動に合わせて調整し,ストップラインの周りの価格を動作させる.

  5. 止損と止止退 止損退出はリスクを効果的に制御し,止止退出は利益をロックする.

具体的には,この戦略は,高低価格の平均値を価格の源として使用し,トレンドの方向を判断する速速EMAを計算する.速速ラインで緩慢ラインを貫通して抵抗突破シグナルが発生すると多行し,速速ラインの下で緩慢ラインを貫通してサポート突破シグナルが発生すると空きする.入場後,一定の周期内の最低価格をストップ・ロスの位置として,価格上昇に調整し,ストップ・ロックのラインを設定して利益をロックする.リスクを効果的に制御しながらトレンド中の利益を獲得する.

優位分析

この戦略には以下の利点があります.

  1. 利益の安定 傾向操作で,指数レベルの長線傾向で利益を得ることができる

  2. リスク管理が良好 環状の止損と止損を設定し,間に合った止損退出をすることができる

  3. 信号は正確である。抵抗位突破は多し,支位突破は空き,信号は正確である。

  4. 操作が簡単 指示器と信号の規則はシンプルで明快で,パラメータの設定は複雑ではありません

  5. 市場に適応する. 異なる品種とあらゆる市場条件で動作する.

リスク分析

この戦略にはいくつかのリスクがあります.

  1. 突破失敗のリスク. 抵抗支位突破後,再調整と再試行が発生し,止損を引き起こす可能性がある.

  2. パラメータ最適化のリスク。パラメータ設定が不適切である場合,信号が頻繁または不足する可能性があります。最適化の過程は慎重にする必要があります。

  3. 指標の失効リスク 特殊な市場状況でEMA指標は失効または遅れる可能性があります.

  4. トレンド反転リスク.空調方向が市場から外れている場合,損失が増加する可能性があります.

これらのリスクは,パラメータ最適化,適正な緩解,信号の厳格な遵守などの方法によって,大きく制御および緩和することができます.

最適化の方向

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

  1. タイムサイクル最適化. 平均線と価格形状のタイムサイクルパラメータを調整し,最適な組み合わせを探します.

  2. 品種適応性最適化 異なる品種の特徴に応じてパラメータの設定を調整する

  3. 止損戦略の最適化. 移動止損,振動止損などのより安定で正確な止損方法を適用する.

  4. ストップ戦略の最適化. 移動ストップまたは指数型ストップを設定して,利益を増やすことができます.

  5. フィルタリング条件を追加する.取引量,波動率などのフィルタリング条件を追加し,偽ブレークを排除する.

  6. 入場信号の強化 〜入場信号の確認として,より多くの指標や形状を追加する.

要約する

この戦略は,全体的に流暢に動作し,核心思想が明確で,安定性や収益性がある.リスク制御と指標の適用も適している.これは,使用に値する突破的な分類戦略である.パラメータとモジュールの最適化により,戦略をさらに完善化し,より多くの品種と複雑な市場環境に適応させることができる.

ストラテジーソースコード
/*backtest
start: 2023-12-03 00:00:00
end: 2023-12-10 00:00:00
period: 30m
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/
// © EduardoMattje

//@version=4
strategy("Reversal closing price", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10, initial_capital=10000)

src = input(hl2, "Price source")
order_direction = input("Both", "Order direction", options=["Both", "Long", "Short"])

// EMA calculation and plot

ema_long_period = input(80, "EMA long period")
ema_short_period = input(8, "EMA short period")
ema_long = ema(src, ema_long_period)
ema_short = ema(src, ema_short_period)
ema_bull = ema_short > ema_long
ema_bear = ema_short < ema_long
plot(ema_long, "EMA long", ema_bull ? color.green : color.red, 3)
plot(ema_short, "EMA short", ema_bull ? color.green : color.red, 3)

// Settings

risk_reward_ratio = input(2.0, "Risk to reward ratio", minval=1.0, step=0.1)
stop_lookback = input(3, "Stoploss candle lookback", minval=1)
ema_cross_stop = input(true, "Close if EMA crosses in oposite direction")
allow_retracing = input(true, "Allow price retracing")

// RCP calculation

rcp_bull = low[0] < low[1] and low[0] < low[2] and close[0] > close[1]
rcp_bear = high[0] > high[1] and high[0] > high[2] and close[0] < close[1]

// Order placement

in_market = strategy.position_size != 0

long_condition = rcp_bull and ema_bull and not in_market and order_direction != "Short"
short_condition = rcp_bear and ema_bear and not in_market and order_direction != "Long"

bought = strategy.position_size[0] > strategy.position_size[1] and strategy.position_size[1] == 0
sold = strategy.position_size[0] < strategy.position_size[1] and strategy.position_size[1] == 0
closed = not in_market and in_market[1]

long_position = strategy.position_size > 0
short_position = strategy.position_size < 0

buy_price = high + syminfo.mintick
sell_price = low - syminfo.mintick

if long_condition
    strategy.entry("Long", true, stop=buy_price)
if short_condition
    strategy.entry("Short", false, stop=sell_price)
    
if allow_retracing
    better_price_long = barssince(closed) > barssince(long_condition) and barssince(long_condition) >= 1 and not in_market and ema_bull and buy_price < valuewhen(long_condition, buy_price, 0) and buy_price[0] < buy_price[1]
    if better_price_long
        strategy.cancel("Long")
        strategy.entry("Long", true, stop=buy_price)
    
    better_price_short = barssince(closed) > barssince(short_condition) and barssince(short_condition) >= 1 and not in_market and ema_bear and sell_price > valuewhen(short_condition, sell_price, 0) and sell_price[0] > sell_price[1]
    if better_price_short
        strategy.cancel("Short")
        strategy.entry("Short", false, stop=sell_price)

// Stoploss orders

stop_price = long_position ? valuewhen(bought, lowest(stop_lookback)[1] - syminfo.mintick, 0) : short_position ? valuewhen(sold, highest(3)[1] + syminfo.mintick, 0) : na
stop_comment = "Stoploss triggered"
strategy.close("Long", low <= stop_price, stop_comment)
strategy.close("Short", high >= stop_price, stop_comment)
plot(stop_price, "Stop price", color.red, 2, plot.style_linebr)

// EMA cross close orders

if ema_cross_stop
    if long_position and ema_bear
        strategy.close("Long", comment=stop_comment)
    if short_position and ema_bull
        strategy.close("Short", comment=stop_comment)

// Take profit orders

stop_ticks = abs(strategy.position_avg_price - stop_price)
take_profit_price = long_position ? valuewhen(bought, strategy.position_avg_price + stop_ticks * risk_reward_ratio, 0) : short_position ? valuewhen(sold, strategy.position_avg_price  - (stop_ticks * risk_reward_ratio), 0) : na
target_comment = "Take profit"
strategy.close("Long", high >= take_profit_price, target_comment)
strategy.close("Short", low <= take_profit_price, target_comment)
plot(take_profit_price, "Target price", color.green, 2, plot.style_linebr)