移動平均をベースにした平均逆転逆転戦略

作者: リン・ハーンチャオチャン開催日:2023年12月21日 15:45:23
タグ:

img

この戦略は"移動平均に基づいた平均逆転戦略"と呼ばれる.主なアイデアは,価格が主要な移動平均を突破すると購入し,事前に設定された目標に達すると利益を得ることです.

この戦略の主な原則は,短期の移動平均の逆転を使用して範囲限定市場におけるリバウンド機会を把握することである.特に,価格がより長いサイクル移動平均を突破し (20日および50日MAsなど) 強い過剰販売の兆候を示したときに,価格は市場の変動の平均逆転特性により一定程度に反転する傾向がある.この時点で,短周期移動平均 (10日MAなどの) が上向き逆転信号を示した場合,購入するタイミングが良い.この戦略では,閉じる価格が20日MA以下で50日MA以上であるとき,短期MA逆転でリバウンドを捕捉するために購入する.

特定のエントリーロジックは:価格が20日MASを突破すると1ロットを購入し,50日MASを突破すると1ロットを追加し,100日MASを突破すると1ロットを追加し,最大4ロットで200日MASを突破すると1ロットを追加する.事前に設定された目標に達した後,利益を得ます.時間とストップ損失条件も設定します.

利点分析

  1. 移動平均値の逆転特性を利用して短期的なリバウンド機会を効果的に特定する
  2. ピラミッド型命令によって単点のリスクを減らす
  3. 利益の目標設定によって利益を固定する
  4. オープン価格と以前の低価格フィルターを使用して偽のブレイクを避ける

リスク分析

  1. 長期保有期間で逆転リスクに直面する可能性があります.市場が引き続き下落した場合,損失は拡大します.
  2. MA信号は誤った信号を与え,損失につながる可能性があります.
  3. 利益目標が達成されない場合,完全にまたは部分的に利益を得ることができない場合

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

  1. 異なるパラメータ設定で収益性と安定性をテストする
  2. MACD,KDなどの他の指標を組み合わせてエントリを決定することを検討します
  3. 異なる製品の特徴に基づいて,適切なMA期間を選択する.
  4. パラメータを動的に最適化するための機械学習アルゴリズムを導入する

概要

一般的には,これは古典的で普遍的なMA取引戦略である.短期間の購入機会を特定するために,複数のMAと組み合わせて,MAのスムージング機能を正しく利用する.ピラミッドオーダーとタイムリーな利益を取ることでリスクを制御する.しかし,重要な政策ニュースのような市場イベントに対する反応はより受動的である可能性があります.これはさらに最適化できるものです.全体として,パラメータ最適化とリスク管理の適切な改善により,この戦略は安定した過剰収益を得ることができます.


/*backtest
start: 2023-12-13 00:00:00
end: 2023-12-20 00:00:00
period: 1m
basePeriod: 1m
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)

もっと