閉じ込められたサイクル間のモメント戦略

作者: リン・ハーンチャオチャン, 日付: 2023-09-20 14:59:37
タグ:

概要

この戦略の主な考え方は,周期間ののパターンを用いてトレンド方向を決定し,それをエントリー信号として使用することです. 前回のを含む周期間のが表示されると,これはトレンドが逆転するポイントであると推測できます.この時点で,前回の高値を超えるブレイクでロングまたは前回の低値以下のブレイクでショートで,適切なストップ・ロストと利益のセットアップで走ることができます.

戦略の論理

  1. 特定の論理は:現在のキャンドルの高度は前のキャンドルの高値よりも低く,現在のキャンドルの低値は前のキャンドルの低値よりも高くなります.

  2. 前回のキャンドルが上昇しているか下落しているか判断します.閉じる方がオープンよりも高くなった場合,それは上昇していました.閉じる方がオープンよりも低くなった場合,それは下落していました.

  3. 前回のキャンドルが上昇し,そのパターンが表示された場合,前回のキャンドルの高値+その範囲の10%で買いストップオーダーをします.

  4. 前回のキャンドルが下落し,そのパターンが表示された場合,前回のキャンドルの低値マイナス10%の範囲でセールストップオーダーをします.

  5. ストップオーダーが起動し,ポジションが開かれたら,ストップ・ロスを設定し,利益を得ます.ストップ・ロストと利益を得ることの距離は,以前のキャンドルの範囲の一定パーセントです.

  6. 別の内部バーパターンが形成された場合,既存のポジションを最初に閉じて,新しい待機注文をします.

利点分析

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

  1. このパターンは,キャンドルスタイルの固有の論理を利用し,正確なエントリータイミングを提供します. 含まれているパターンは,しばしば,来年のトレンドの逆転または加速を暗示します.

  2. 実際の取引では ルールがシンプルで 簡単です

  3. 過去のキャンドルの範囲に基づいて ストップ・ロストとテイク・プロフィートを設定することで リスクをコントロールできます

  4. 新しい待機注文は 合格パターンが現れるたびに 配置され 新しい傾向を追跡できます

リスク分析

リスクもあります:

  1. このパターンは常にトレンドの逆転や加速をもたらさない.いくつかの誤った信号がある.

  2. ストップロスの距離は,市場の大きな変動に耐えられないほど小さい場合もあります.

  3. 利得目標があまりにも広いので タイミングで利益を得られないかもしれません

  4. 戦略は市場動向に より依存している. konsolidiation のときの利益の可能性は限られている.

  5. 取引頻度が高いため 取引コストが高くなります

解決策:

  1. 信号を確認し,誤った信号を減らすために他の指標を追加します.

  2. ストップ・ロスを少し広げても,前回のキャンドルの範囲の50%を超えないようにする.

  3. 前回のキャンドルの範囲の50%に 引き下げます

  4. 資本の管理を最適化し 市場規模を絞る

  5. 取引頻度を減らすために 入場基準を緩和する.

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

戦略を最適化する方法:

  1. MACDのようなトレンドインジケーターを追加してトレンド方向を決定し 統合中にウィップソウを避けます

  2. 遅延停止や利益保護ストップ損失などの より高度なストップ損失技術を使用します.

  3. 最適なパラメータを見つけるために 異なるストップ・ロスをテストし 利益率を取ります

  4. ストップロスの後に再びトレンドを把握するために再エントリーロジックを追加します.

  5. 市場変動に基づいてポジションサイズを最適化する.

  6. 資本管理を最適化し,固定分数のポジションサイズなど

  7. 戦略を異なる製品と時間枠でテストします

結論

概要すると,これはトレンドターニングポイントを決定し,トレンド逆転を捕捉するために,トレンドターニングポイントを決定し,トレンド逆転を捕捉するために待機中のオーダーを配置するために,周期間のパターンを利用する戦略である.明確なエントリー信号,単純なルール,制御可能なリスクの利点があるが,いくつかの誤った信号リスクと最適化余地もある.トレンドフィルター,ストップの最適化,ポジションサイズの調整などを組み合わせることで,その安定性と収益性をさらに向上させることができる.それはトレンド市場により適しており,実際の使用前にさまざまな市場条件に最適化され,テストする必要があります.


/*backtest
start: 2023-01-01 00:00:00
end: 2023-03-10 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=3

// Inside Bar Momentum Strategy
// As defined on Babypips.com
// https://www.babypips.com/trading/forex-inside-bar-20170113

// strategy("Babypips: Inside Bar Momentum Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=5)

From_Year  = input(defval = 2018, title = "From Year")
From_Month = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
From_Day   = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
To_Year    = input(defval = 9999, title = "To Year")
To_Month   = input(defval = 1, title = "To Month", minval = 1, maxval = 12)
To_Day     = input(defval = 1, title = "To Day", minval = 1, maxval = 31)
Start  = timestamp(From_Year, From_Month, From_Day, 00, 00)  // backtest start window
Finish = timestamp(To_Year, To_Month, To_Day, 23, 59)        // backtest finish window
Window = true

Stop_Buy_Perc  = input(10, "Stop Buy Order Percentage From Previous Candle's Range")/100
Stop_Loss_Perc = input(20, "Stop Loss Distance from High/Low of Previous Candle")/100
Take_Prof_Perc = input(80, "Take Profit Distance from High/Low of Previous Candle")/100

Risk = input(2, "Percentage Of EQUITY to risk per trade", step=0.1, minval=0, maxval=100)/100

Inside_Bar = high[1] > high[0] and low[1] < low[0]
Prev_Range = high[1] - low[1]
Bullish = open[1] < close[1]
Bearish = open[1] > close[1]

// Get Key Levels 
Long_Stop_Buy_Level   = high[1] + (Prev_Range * Stop_Buy_Perc)
Short_Stop_Buy_Level  = low[1]  - (Prev_Range * Stop_Buy_Perc)
Long_Stop_Loss_Level  = high[1] - (Prev_Range * Stop_Loss_Perc)
Short_Stop_Loss_Level = low[1]  + (Prev_Range * Stop_Loss_Perc)
Long_Take_Prof_Level  = high[1] + (Prev_Range * Take_Prof_Perc)
Short_Take_Prof_Level = low[1]  - (Prev_Range * Take_Prof_Perc)

// Position Sizing
long_qty = floor((strategy.equity * Risk) / (Long_Stop_Buy_Level - Long_Stop_Loss_Level))
short_qty = floor((strategy.equity * Risk) / (Short_Stop_Loss_Level - Short_Stop_Buy_Level))

// -------------------------- LONG CONDITIONS --------------------------------//
// The first candlestick must be bullish (green or white) and if the second 
// candlestick is completely contained by the first, set a buy stop order at 
// the first candle’s high plus 10% of its range (high minus low).

// Place the stop loss at the first candle’s high minus 20% of its range 
// and set the target at the first candle’s high plus 80% of its range

// If another inside bar pattern forms, the current position should be closed 
// or the pending buy/sell order must be canceled and entry orders must be 
// updated to the latest candles.

Long_Condition = Window and Inside_Bar and Bullish
if (Long_Condition)
    // Incase we still have a buy stop order in the market
    strategy.cancel_all()
    // Close any existing positions according to the rules
    strategy.close_all()
    strategy.entry("Bullish IB", strategy.long, stop=Long_Stop_Buy_Level)
    strategy.exit("Bullish Exit","Bullish IB", stop=Long_Stop_Loss_Level, limit=Long_Take_Prof_Level)
    
// -------------------------- SHORT CONDITIONS -------------------------------//
// The first candlestick must be bearish (red or black) and if the second 
// candlestick is completely contained by the first, set a sell stop order at 
// the first candle’s low minus 10% of its range (high minus low).

// Place the stop loss at the first candle’s low plus 20% of its range and 
// set the target at the first candle’s low minus 80% of its range.

// If another inside bar pattern forms, the current position should be closed 
// or the pending buy/sell order must be canceled and entry orders must be 
// updated to the latest candles.

Short_Condition = Window and Inside_Bar and Bearish
if (Short_Condition)
    // Incase we still have a buy stop order in the market
    strategy.cancel_all()
    // Close any existing positions according to the rules
    strategy.close_all()
    strategy.entry("Bearish IB", strategy.short, stop=Short_Stop_Buy_Level)
    strategy.exit("Bearish Exit","Bearish IB", stop=Short_Stop_Loss_Level, limit=Short_Take_Prof_Level)
    
// ----------------------------- PLOTTING ------------------------------------//
plotshape(Inside_Bar, style=shape.arrowdown, location=location.abovebar, color=purple)


もっと