
この戦略は,計算速度がより速いインデックス・ラインナリー・ウェイト・エーバーン ((EHMA)) と自適化チャネルを使用して,トレンドフォロー型の戦略を構築する. EHMA計算速度がより速いため,価格変化のトレンドを効果的に識別することができ,偽の突破が不要な取引シグナルを生成することを防ぐ. 同時に,自適化チャネルは,部分的な価格の揺れをフィルターすることができ,価格がチャネルを突破したときにのみ取引シグナルを発信し,非効率的な取引の確率を低減し,利益の確率を高める.
パラメータPeriodに基づいて計算された指数線形加重平均EHMA。EHMAの計算速度が速いため,価格変化のトレンドを効果的に追跡できる。
パラメータのRangeWidthに従って,EHMA上下それぞれに自律的なチャネルを拡張する.価格が上チャネルラインより上,下チャネルラインより下である場合にのみ,トレンドが変化したと考えられ,取引信号を発する.
価格と通路の関係を判断する。価格上は通路線を穿うとき多し,下は通路線を穿うとき空する。価格下は通路線を穿うとき平多仓,上は通路線を穿うとき平空仓。
通常の移動平均策には以下の利点があります.
EHMAアルゴリズムを使用して平均を計算する. EHMAは価格変化のトレンドに対する反応に敏感であり,トレンドの変化を効果的に識別し,偽の突破を避け,不必要な取引を避ける.
適応チャネルは,価格の変動を効果的にフィルターできます.価格がトレンド変化を決定するときにのみ取引シグナルが生成されます.不有効な取引の一部をフィルターして,収益の確率を向上させることができます.
チャンネル幅を柔軟に調整し,異なる市場環境に対応できます. 広いチャネルは,より多くの揺れをフィルターして取引頻度を低下させることができます. 狭いチャネルは,より早くトレンドの変化を認識して取引頻度を増加させることができます.
この戦略には以下のリスクもあります.
偽突破を完全に回避することはまだ不可能である。価格が断層し,直接上穿または下穿通道帯が発生する可能性がある。パラメータを適切に調整し,リスクを制御する必要がある。
チャンネルの幅が広すぎると,取引の機会の一部を逃す可能性があります. チャンネルの幅を適切に狭めると,敏感性が向上します.
通路が狭すぎると,無効取引の回数が増加する.通路の幅を適切に拡大して安定性を高める.
この戦略は以下の点で最適化できます.
最適化パラメータPeriod。平均計算周期を,異なる品種と周期図の特徴に合わせて調整する。
最適化パラメータRangeWidth. 市場の変動程度と個人のリスク好みに応じてチャネル範囲を調整する.
ストップ・ロスの策略を増やす. ポジション保持の過程で,合理的なストップ・ロスを設定し,単一取引の最大損失を効果的に制御する.
他の指標と組み合わせたEntryのフィルタリング.例えば,Entryの非効率性を減らすために,Entryの取引量を増やす判断.
多品種化アプリケーションとパラメータ最適化.より多くの品種と周期でテストし,一般的なパラメータを最適化.
この戦略は,EHMA指標と自己適応通路指標を統合し,トレンドフォロー型の戦略を形成する.市場トレンドを効果的に識別し,価格の揺れをフィルターし,不要な取引を避ける.一連のパラメータの最適化とリスク制御を経て,複数の品種と周期で安定した利益を得ることができる.
/*backtest
start: 2023-02-25 00:00:00
end: 2024-02-25 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
args: [["v_input_1",1]]
*/
// Credit is due where credit is due:
// Hull Moving Average: developed by Alan Hull
// EHMA: coded by Twitter @borserman
// I've built on their work in an attempt to create a strategy more robust to fake moves
// @0xLetoII
//@version=4
strategy(
title="EHMA Range Strategy",
process_orders_on_close=true,
explicit_plot_zorder=true,
overlay=true,
initial_capital=1500,
default_qty_type=strategy.percent_of_equity,
commission_type=strategy.commission.percent,
commission_value=0.085,
default_qty_value=100
)
// Position Type
pos_type = input(defval = "Long", title="Position Type", options=["Both", "Long", "Short"])
// Inputs
Period = input(defval=180, title="Length")
RangeWidth = input(defval=0.02, step=0.01, title="Range Width")
sqrtPeriod = sqrt(Period)
// Function for the Borserman EMA
borserman_ema(x, y) =>
alpha = 2 / (y + 1)
sum = 0.0
sum := alpha * x + (1 - alpha) * nz(sum[1])
// Calculate the Exponential Hull Moving Average
EHMA = borserman_ema(2 * borserman_ema(close, Period / 2) - borserman_ema(close, Period), sqrtPeriod)
// Create upper & lower bounds around the EHMA for broader entries & exits
upper = EHMA + (EHMA * RangeWidth)
lower = EHMA - (EHMA * RangeWidth)
// Plots
EHMAcolor = (close > EHMA ? color.green : color.red)
plot(EHMA, color=EHMAcolor, linewidth=2)
plot(lower, color=color.orange, linewidth=2)
plot(upper, color=color.blue, linewidth=2)
// Strategy
long = close > upper
exit_long = close < lower
short = close < lower
exit_short = close > upper
// Calculate start/end date and time condition
startDate = input(timestamp("2017-01-01T00:00:00"))
finishDate = input(timestamp("2029-01-01T00:00:00"))
time_cond = true
// Entries & Exits
if pos_type == "Both"
strategy.entry("Long", strategy.long, comment="Long", when=long and time_cond)
strategy.close("Long", comment="Exit Long", when=exit_long and time_cond)
strategy.entry("Short", strategy.short, comment="Short", when=short and time_cond)
strategy.close("Short", comment="Exit Short", when=exit_short and time_cond)
if pos_type == "Long"
strategy.entry("Long", strategy.long, comment="Long", when=long and time_cond)
strategy.close("Long", comment="Exit Long", when=exit_long and time_cond)
if pos_type == "Short"
strategy.entry("Short", strategy.short, comment="Short", when=short and time_cond)
strategy.close("Short", comment="Exit Short", when=exit_short and time_cond)