オシレーティングストップロスの収束価格ブレイクストラテジー

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

img

概要

この戦略はリスク管理のために価格ブレイクシグナルと振動ストップ・ロスのメカニズムを利用する.価格がレジスタンスを破ると長行し,価格がサポートを破ると短行する.同時に,リスク管理のために振動ストップ・ロストと利益採取ストップが適用される.

戦略の論理

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

  1. 傾向の方向を決定するためにMAを使用する.高速および遅いMAはグラフ化され,遅いMAの上を高速MAが横断すると牛傾向を示し,下を低迷傾向を示します.

  2. 価格が急上昇し,最近のスイング高を突破すると,レジスタンスレベルを突破すると考えられます.

  3. サポートブレイクショートシグナルです.価格が下がり,最近のスイングローを突破すると,サポートレベルを突破してショートになると考えられます.

  4. 振動ストップ損失. 入力後,ストップ損失線が設定され,価格変動に基づいて調整し続け,振動ストップ損失メカニズムを形成します.

  5. ストップ・ロスはリスクをコントロールし 利益は利益に閉じ込めます

低価格と高価格の平均値を基準として利用し,トレンドを決定するために高速EMAと遅いEMAをプロットする.高速EMAがスローEMAを超え,レジスタンスブレイクアウト信号が現れると,ロングになります.高速EMAがスローEMAを下回り,サポートブレイクアウトが現れると,ショートになります.エントリー後,特定の期間の最低価格がストップ・ロストラインとして設定され,価格上昇に合わせて調整し続けます.収益をロックするためにテイク・プロフィートラインがプロットされています.戦略は,トレンドからの利益のリスクを効果的に制御します.

利点分析

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

  1. 安定した収益性 長期的傾向から安定した利益を得ることができます

  2. リスク管理が優れている 振動停止と保護停止は 損失を迅速に削減する

  3. 正確な信号 抵抗突破の長さと サポート突破の短さは 信頼できる信号を提供します

  4. シンプルなルールです 指示や信号は シンプルで 簡単です

  5. 市場適応性 異なる製品と市場条件に合わせてうまく機能します

リスク分析

この戦略に注意すべきリスクは:

  1. ブレイク失敗リスク 初期ブレイク後に価格が反転または引き下げられ,ストップロスは引き起こす可能性があります

  2. パラメータ最適化リスク. パラメータの調節が悪ければ,信号が多すぎたり少すぎたりします. 最適化には慎重さが必要です.

  3. 極端な状況では EMA が動作を停止したり,価格に遅れることもあります.

  4. トレンド逆転リスク トレンド逆転のポジションを保持すると,トレンド逆転時に累積的損失をもたらす.

適切なパラメータ調節,大きなストップ損失,厳格にルールに従うことは 上記のリスクを大幅に軽減することができます.

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

この戦略は,次の側面からさらに改善できます.

  1. タイムフレームの最適化 MAと価格パターンの計算期間を調整し 最適な組み合わせを見つけます

  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)


もっと