動向平均値に基づく戦略をフォローする傾向

作者: リン・ハーンチャオチャン,日付: 2024-01-18 12: 23:59
タグ:

img

概要

この戦略は,移動平均値に基づいたトレンドフォロー戦略である.トレンド追跡のための複数のセットの取引信号を構築するために,異なる期間のEMA線を使用する.価格がより長い期間の移動平均値を下回ると,戦略は平均コストを下げるために徐々にロングポジションを構築する.戦略は,短期間の移動平均値のターンに基づいてストップ損失条件を設定し,利益を確保する.

戦略の論理

この戦略は,10日,20日,50日,100日および200日EMAの5つの異なる期間のEMAラインを使用し,ピラミッド取引を実施するためにこれらのEMAラインとの価格関係に基づいて4つの購入条件を定義します.

価格が20日間のEMAを下回り,50日間のEMAを超えると,最初のバイシグナルが起動する.50日間のEMAを下回り,100日間のEMAを超えると,第2のバイシグナルが起動する.価格がそれぞれ100日間のEMAと200日間のEMAを下回ったとき,第3と第4のバイシグナルが起動する.ポジションサイズもqt1からqt4に徐々に拡大する.

販売側では,ストップ・ロスの条件は2つのグループがあります.最初のものは,価格が10日間のEMAを上回り,10日間のEMAが他のEMA線よりも上にあるときにストップ・ロスを行うことです.第二は類似しますが,価格が10日間のEMAの前の終了を下回ると終了します.これらの2つの条件は,トレンド中に短期的な利益を確保することです.

利点分析

この戦略の最大の利点は,長期保有の市場動向を自動的に追跡する能力である.複数のエントリー条件とプログレッシブなポジション構築を利用することによって,過剰なリターンを生み出すためにコストベースを絶えず削減する.また,単一のエントリー価格レベルに関連した価格設定リスクを分散させる.

ストップ損失側では,戦略は短期間の移動平均のターニングポイントを追跡し,迅速に利益を得てさらなる損失を回避します.これは下落リスクを最小限に抑えます.

リスク分析

この戦略が直面する最大のリスクは,長期間の統合または下落傾向に引っかかることである.市場全体が範囲または下落チャネルに入ると,移動平均シグナルが信頼性が低下する.これは,継続的な長期ビルドによる持続的な損失につながる可能性があります.

また,移動平均値は常にターンを正確に特定することができないというリスクもあります.価格格差や爆発的な動きは,誤った信号を引き起こす可能性があります.これは検証と最適化のために追加の技術指標を必要とします.

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

輸入の精度をさらに向上させるために,ボリッジャーバンドやボリュームなどの他の技術指標も購入条件に組み込める可能性がある.

ボリンジャー上部帯または主要なサポートエリアに基づくストップロスの第2層も追加することができる.これは不必要な小さなストップを避けるのに役立ちます.トレイル価格に適応的なストップロスを実装することは,利益をよりよく保護するためのもう一つの強化領域です.

結論

この戦略は,移動平均システムを通じてトレンドをフォローして取引を実施する.ピラミッドポジション構築を通じて,ダブルストップ損失メカニズムで資本の保存を確保しながら持続するトレンドからのリターンを最大化することを目指している.これはさらなる追跡とライブテストに値する戦略である.パラメータとモデルは実用的なパフォーマンスに基づいて漸進的に最適化することができる.


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

//@version=5
strategy("EMA_zorba1", shorttitle="zorba_ema", overlay=true)

// Input parameters
qt1 = input.int(5, title="Quantity 1", minval=1)
qt2 = input.int(10, title="Quantity 2", minval=1)
qt3 = input.int(15, title="Quantity 3", minval=1)
qt4 = input.int(20, title="Quantity 4", minval=1)
ema10 = ta.ema(close, 10)
ema20 = ta.ema(close, 20)
ema50 = ta.ema(close, 50)
ema100 = ta.ema(close, 100)
ema200 = ta.ema(close, 200)

// Date range filter
start_date = timestamp(year=2021, month=1, day=1)
end_date = timestamp(year=2024, month=10, day=27)
in_date_range = true

// Profit condition
profit_percentage = input(1, title="Profit Percentage")  // Adjust this value as needed

// Pyramiding setting
pyramiding = input.int(2, title="Pyramiding", minval=1, maxval=10)

// Buy conditions
buy_condition_1 = in_date_range and close < ema20 and close > ema50 and close < open and close < low[1]
buy_condition_2 = in_date_range and close < ema50 and close > ema100 and close < open and close < low[1]
buy_condition_3 = in_date_range and close < ema100 and close > ema200 and close < open and close < low[1]
buy_condition_4 = in_date_range and close < ema200 and close < open and close < low[1]

// Exit conditions
profit_condition = strategy.position_avg_price * (1 + profit_percentage / 100) <= close
exit_condition_1 = in_date_range and (close > ema10 and ema10 > ema20 and ema10 > ema50 and ema10 > ema100 and ema10 > ema200 and close < open) and profit_condition and close < low[1] and close < low[2]
exit_condition_2 = in_date_range and (close < ema10 and close[1] > ema10 and close < close[1] and ema10 > ema20 and ema10 > ema50 and ema10 > ema100 and ema10 > ema200 and close < open) and profit_condition and close < low[1] and close < low[2]

// Exit condition for when today's close is less than the previous day's low
//exit_condition_3 = close < low[1]

// Strategy logic
strategy.entry("Buy1", strategy.long, qty=qt1 * pyramiding, when=buy_condition_1)
strategy.entry("Buy2", strategy.long, qty=qt2 * pyramiding, when=buy_condition_2)
strategy.entry("Buy3", strategy.long, qty=qt3 * pyramiding, when=buy_condition_3)
strategy.entry("Buy4", strategy.long, qty=qt4 * pyramiding, when=buy_condition_4)

strategy.close("Buy1", when=exit_condition_1 or exit_condition_2)
strategy.close("Buy2", when=exit_condition_1 or exit_condition_2)
strategy.close("Buy3", when=exit_condition_1 or exit_condition_2)
strategy.close("Buy4", when=exit_condition_1 or exit_condition_2)

もっと