ALMAクロスオーバー戦略

作者: リン・ハーンチャオチャン, 日付: 2023-09-23 15:11:02
タグ:

概要

この戦略は,クロスオーバー信号を生成するために,2つのArnaud Legoux Moving Average (ALMA) を使用し,一つは高速で一つは遅い.ALMAは遅延を軽減し,従来のMAと比較して信号ラインをスムーズにする.信号精度を向上させるためにボリュームフィルタが追加されている.暗号化のために最適化されているが,他の楽器のために調整することができる.アラートが含まれている.

戦略の論理

主要な指標と規則は次のとおりです.

  1. 短時間で 突破を捕まえる

  2. スローALMA: 傾向を測定するための長い期間.

  3. ボリュームフィルター: ショート EMA がロング EMA を横切るときには有効です.

  4. 購入信号:高速ALMAが遅いALMAを横切り,ボリュームフィルタが通過する.

  5. 売り信号: 速いALMAは遅いALMAを下回る.

  6. 短信号:高速ALMAは遅いALMAとボリュームフィルターを通過するより下を通過します.

  7. カバー信号: 速いALMAが遅いALMAを横切る.

この戦略は,強固な信号のためのトレンド,モメント,ボリューム分析を組み合わせます.ALMAは遅延を軽減し,ボリュームは偽のブレイクを回避します.

利点

伝統的な移動平均戦略と比較して,主な利点は以下の通りです.

  1. ALMAは遅延を軽減し 信号の質を向上させます

  2. ボリュームフィルターは 誤ったブレイクによる損失を回避します

  3. スピード/スローコンボがトレンド方向を測ります

  4. シンプルで直感的なルールで 簡単に実行できます

  5. 異なる市場向けに 柔軟な MA パラメータの調整

  6. 合理的なリスク管理

  7. パラメータ調整によるさらなる最適化の可能性

  8. 伝統的なクロスオーバー戦略に比べて,全体的に安定性と品質が向上した.

リスク

利点はありますが,以下のリスクは注意すべきです.

  1. クロスオーバーシステムでは 内部的に 鞭打ちに脆弱です

  2. ALMAの性能はパラメータ調整に依存します

  3. 音量のピークは信号生成を誤導する可能性があります.

  4. 損失をすべて避けることはできません.

  5. 過剰な最適化による過剰な適応リスク

  6. 音量が異常なときに信号が失われます

  7. 機械学習技術は より良い結果を生むかもしれません

  8. 過剰な引き上げを避けるため,報酬/リスク比率を監視する.

強化

リスクに対処するために,以下の分野では改善が可能です.

  1. ALMAのパラメータを最適化して 感度向上を図る

  2. 異なる体積測定値で実験する

  3. ストップ・ロスを取引ごとにコントロール・ロスを導入する.

  4. 強力な信号のために他の指標を組み込む.

  5. 機械学習モジュールを追加して 信号をより賢く調整します

  6. 戦略の多様化のために複数の製品に展開します

  7. ポジションサイズモデルを異なる市場に最適化する.

  8. 耐久性を調べて オーバーフィッティングを防ぐ

結論

結論として,従来のクロスオーバー戦略と比較して,この戦略はALMAアルゴリズムとボリュームフィルターを通じて信号品質と強度を向上させる.しかし,戦略最適化は繰り返しのプロセスである.変化する市場に対応するために,複数の次元から戦略を改善し続けることが重要です.


/*backtest
start: 2022-09-16 00:00:00
end: 2023-09-22 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Sarahann999
// Calculations for TP/SL based off: https://kodify.net/tradingview/orders/percentage-profit/
//@version=5
strategy("ALMA Cross", overlay=true)

//User Inputs
src= (close)
long_entry = input(true, title='Long Entry')
short_entry = input(true, title='Short Entry')

//Fast Settings
ALMA1 = input(100, "ALMA Lenghth 1", group= "ALMA Fast Length Settings")
alma_offset = input.float(defval=0.85, title='Arnaud Legoux (ALMA) - Offset Value', minval=0, step=0.01)
alma_sigma = input.int(defval=6, title='Arnaud Legoux (ALMA) - Sigma Value', minval=0)
Alma1 = ta.alma(src, ALMA1, alma_offset, alma_sigma)

//Slow Settings
ALMA2 = input(120, "ALMA Length 2", group = "ALMA Slow Length Settings")
alma_offset2 = input.float(defval=0.85, title='Arnaud Legoux (ALMA) - Offset Value', minval=0, step=0.01)
alma_sigma2 = input.int(defval=6, title='Arnaud Legoux (ALMA) - Sigma Value', minval=0)
Alma2 = ta.alma(src, ALMA2, alma_offset2, alma_sigma2)

//Volume
var cumVol = 0.
cumVol += nz(volume)
if barstate.islast and cumVol == 0
    runtime.error("No volume is provided by the data vendor.")
shortlen = input.int(5, minval=1, title = "Short Length", group= "Volume Settings")
longlen = input.int(10, minval=1, title = "Long Length")
short = ta.ema(volume, shortlen)
long = ta.ema(volume, longlen)
osc = 100 * (short - long) / long

//Define Cross Conditions
buy = ta.crossover(Alma1, Alma2)
sell = ta.crossunder(Alma1, Alma2)

//Calculate Take Profit Percentage
longProfitPerc = input.float(title="Long Take Profit", group='Take Profit Percentage',
     minval=0.0, step=0.1, defval=2) / 100
shortProfitPerc = input.float(title="Short Take Profit",
     minval=0.0, step=0.1, defval=2) / 100
     
// Figure out take profit price 1
longExitPrice  = strategy.position_avg_price * (1 + longProfitPerc)
shortExitPrice = strategy.position_avg_price * (1 - shortProfitPerc)

// Make inputs that set the stop %  1
longStopPerc = input.float(title="Long Stop Loss", group='Stop Percentage',
     minval=0.0, step=0.1, defval=2.5) / 100
shortStopPerc = input.float(title="Short Stop Loss",
     minval=0.0, step=0.1, defval=2.5) / 100

// Figure Out Stop Price
longStopPrice  = strategy.position_avg_price * (1 - longStopPerc)
shortStopPrice = strategy.position_avg_price * (1 + shortStopPerc)

//Define Conditions
buySignal = buy and osc > 0
     and strategy.position_size == 0

//sellSignal 
sellSignal = sell and osc > 0
     and strategy.position_size == 0

// Submit entry orders
if buySignal and long_entry
    strategy.entry(id="Long", direction=strategy.long, alert_message="Enter Long")
    alert(message="BUY Trade Entry Alert", freq=alert.freq_once_per_bar)
    
if sellSignal and short_entry
    strategy.entry(id="Short", direction=strategy.short, alert_message="Enter Short")
    alert(message="SELL Trade Entry Alert", freq=alert.freq_once_per_bar)
    
// Submit exit orders based on take profit price
if (strategy.position_size > 0)
    strategy.exit(id="Long TP/SL", limit=longExitPrice, stop=longStopPrice, alert_message="Long Exit 1 at {{close}}")
if (strategy.position_size < 0)
    strategy.exit(id="Short TP/SL", limit=shortExitPrice, stop=shortStopPrice, alert_message="Short Exit 1 at {{close}}")

//Draw
plot(Alma1,"Alma Fast", color=color.purple, style=plot.style_circles)
plot(Alma2,"Alma Slow", color=#acb5c2, style=plot.style_circles)

もっと