波のトレンドに基づいた取引戦略


作成日: 2023-12-19 12:07:14 最終変更日: 2023-12-19 12:07:14
コピー: 0 クリック数: 1121
1
フォロー
1621
フォロワー

波のトレンドに基づいた取引戦略

概要

これは,LazyBearの波動トレンド指数に基づく取引戦略である.この戦略は,価格変動の波動トレンドを計算して,市場の過剰買いや過剰売り状況を判断し,ロングとショートリングを行う.

戦略原則

この戦略は主にLazyBearの波動トレンド指数に基づいています. まず価格の平均価格 (AP) を計算し,次にAPの指数移動平均 (ESA) と絶対価格変化の指数移動平均 (D) を計算します. その基礎で波動指数 (CI) を計算し,次にCIの指数移動平均を計算し,波動トレンドライン (WT) を得ます. WTは,次に,単純な移動平均でWT1とWT2を生成します.

優位分析

これは非常にシンプルで実用的なトレンド追跡戦略で,以下の利点があります.

  1. 価格の動向と市場の情勢を,波動のトレンド指標に基づいて明確に識別できます.
  2. WTの黄金交差点と死交差点から判断して,操作は簡単です.
  3. 異なる周期に対応するために,カスタマイズ可能なパラメータでWT線の感度を調整
  4. 取引時間ウィンドウを制限するなど,さらに条件のフィルタリング信号を追加できます.

リスク分析

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

  1. トレンド追跡策として,市場を整理する際に多くの誤信号を生じやすい.
  2. WT線自体は遅滞性があり,価格の急激な転換点を逃している可能性がある.
  3. デフォルトのパラメータは,すべての品種と周期に適していない可能性があり,最適化が必要です
  4. 投資家は,投資先の利益に悪影響を及ぼす可能性が高い.

解決策は以下の通りです.

  1. WT線の感性を調整する最適化パラメータ
  2. 誤信号を避けるために,他の指標を追加します.
  3. 停止と停止を設定する
  4. 取引数やポジションを1日に制限する

最適化の方向

この戦略はさらに改善できる余地があります.

  1. WTのパラメータを最適化して,より敏感またはより安定化
  2. 周期によって異なるパラメータの組み合わせ
  3. 量値指標,波動率指標などを追加し,確認信号として
  4. ストップ・ロズとストップ・ロジックを追加
  5. ピラミッド加仓,格子取引など,富裕な保有方法
  6. 機械学習などの手法と組み合わせて,より良い特性と取引規則を掘り出す.

要約する

この戦略は,非常にシンプルで実用的な波動トレンド追跡戦略である。価格の変動トレンドを計算し,市場の超買超売状態を識別し,WT線の金交差と死交差を利用して取引信号を発信する。戦略の操作はシンプルで,実行しやすい。しかし,トレンド戦略として,株価の感度と安定性をさらに最適化する必要があり,同時に,誤信号を避けるために他の指標と論理と連携する必要があります。全体的に言えば,これは非常に実用的な戦略のテンプレートであり,大きな最適化余地があります。

ストラテジーソースコード
/*backtest
start: 2023-11-18 00:00:00
end: 2023-12-18 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//
// @author LazyBear
//
// If you use this code in its original/modified form, do drop me a note. 
//
//@version=4
     
// === INPUT BACKTEST RANGE ===
fromMonth = input(defval = 1,    title = "From Month",      type = input.integer, minval = 1, maxval = 12)
fromDay   = input(defval = 1,    title = "From Day",        type = input.integer, minval = 1, maxval = 31)
fromYear  = input(defval = 2021, title = "From Year",       type = input.integer, minval = 1970)
thruMonth = input(defval = 1,    title = "Thru Month",      type = input.integer, minval = 1, maxval = 12)
thruDay   = input(defval = 1,    title = "Thru Day",        type = input.integer, minval = 1, maxval = 31)
thruYear  = input(defval = 2112, title = "Thru Year",       type = input.integer, minval = 1970)

// === INPUT SHOW PLOT ===
showDate  = input(defval = true, title = "Show Date Range", type = input.bool)

// === FUNCTION EXAMPLE ===
start     = timestamp(fromYear, fromMonth, fromDay, 00, 00)        // backtest start window
finish    = timestamp(thruYear, thruMonth, thruDay, 23, 59)        // backtest finish window
window()  => true       // create function "within window of time"

n1 = input(10, "Channel Length")
n2 = input(21, "Average Length")
obLevel1 = input(60, "Over Bought Level 1")
obLevel2 = input(53, "Over Bought Level 2")
osLevel1 = input(-60, "Over Sold Level 1")
osLevel2 = input(-53, "Over Sold Level 2")
 
ap = hlc3 
esa = ema(ap, n1)
d = ema(abs(ap - esa), n1)
ci = (ap - esa) / (0.015 * d)
tci = ema(ci, n2)
 
wt1 = tci
wt2 = sma(wt1,4)

plot(0, color=color.gray)
plot(obLevel1, color=color.red)
plot(osLevel1, color=color.green)
plot(obLevel2, color=color.red, style=3)
plot(osLevel2, color=color.green, style=3)

plot(wt1, color=color.white)
plot(wt2, color=color.fuchsia)
plot(wt1-wt2, color=color.new(color.blue, 80), style=plot.style_area)

//Strategy
strategy(title="T!M - Wave Trend Strategy", overlay = false, precision = 8, max_bars_back = 200, pyramiding = 0, initial_capital = 1000, currency = currency.NONE, default_qty_type = strategy.cash, default_qty_value = 1000, commission_type = "percent", commission_value = 0.1, calc_on_every_tick=false, process_orders_on_close=true)
    
longCondition  = crossover(wt1, wt2)
shortCondition = crossunder(wt1, wt2)

strategy.entry(id="Long Entry", comment="buy", long=true, when=longCondition and window())
strategy.close("Long Entry", comment="sell", when=shortCondition and window())      

//strategy.entry(id="Short Entry", long=false, when=shortCondition)