木星と土星 モメントMA クロスオーバー フィルタリング戦略

作者: リン・ハーンチャオチャン,日付: 2023年11月3日 16:13:20
タグ:

img

概要

この戦略は,変動指標BBとフィルタリング用のカスタムモメント指標を組み合わせて移動平均クロスオーバーを取引信号として使用し,MAクロスオーバー信号の信頼性を向上させ,偽信号を減らすことを目的としています.

原則

  1. 50期間のEMAと200期間のSMAを使って 黄金十字と死十字の信号を形成します

  2. 価格が上昇傾向にある場合,価格が200日線以上で,カスタムモメントインジケーター値が25以下で,購入信号を生成する必要があります.

  3. 価格が下落傾向にある場合,価格が200日線以下で,カスタムモメンタムインジケータ値が75以上で,セールシグナルを生成する必要があります.

  4. カスタムモメントインジケーターは,過去最大値と最小値に基づいて BBのミッドラインとバンド距離を 0-100の範囲に映し出します.

  5. モメント インディケーターは相対的な価格変動を反映し,値フィルタリングは誤ったクロスオーバーを減らすのに役立ちます.

利点

  1. 中長期トレンドを把握するために EMA と SMA の強みを活用する.

  2. モメントインジケーターによる過濾の強化により,信頼性が向上し,偽信号が減少します.

  3. BB帯距離は波動性強度を反映し,歴史的な正規化はパラメータ依存を避けます.

  4. 調整可能な EMA,SMA 期間とインパルス 限界,変化する市場環境に適応できる.

  5. シンプルな論理と最適化柔軟性 強力な実用性

リスク分析

  1. EMAとSMAは遅延効果があり 短期的な機会を逃す可能性があります

  2. 範囲限定市場では不適格な傾向がある.

  3. モメントスロージルは最適パラメータの反復バックテストを必要とし 過剰なフィットメントのリスクがあります

  4. 長期的システムでは 安定した利回りがありますが 絶対利回りは限られています

  5. 適応性を向上させるために MA 期間を短縮したり,補完指標を追加したりできます.

増進 の 機会

  1. 最適なパラメータのために異なるMA組み合わせを試験する.

  2. MACD,KDなどの補完指標を追加します

  3. 動き指標のパラメータを最適化します 振り返る期間,マッピング範囲など

  4. ストップ・ロスはリスク管理に 組み込まれる.

  5. 機械学習機能抽出を使用して,シンボルの特定のパラメータを調整します.

  6. 不合理なクロスオーバー信号を避けるために音量指標を追加します.

結論

この戦略は,長期トレンドフォローと二重モメンタムスローズルフィルタリングの強みを組み合わせて,高い信頼性と実用的な価値を実現する.パラメータ最適化と補完技術によりさらなる改善が可能である.この革新的なコンセプトは,他のトレンドシステムに貴重な洞察を提供している.アルゴリズム取引戦略ライブラリに貴重な追加である.


/*backtest
start: 2023-10-26 00:00:00
end: 2023-10-27 13:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
strategy(title="EMA Difference Mapping with Trades", shorttitle="EMA Diff Map", overlay=false)

// Inputs
emaLength = input(20, "EMA Length")
stdDevLength = input(2, "Standard Deviation Length")
priceSource = close
takeProfitPoints = input(1000, title="Take Profit (in Points)")
stopLossPoints = input(2500, title="Stop Loss (in Points)")

// Calculate EMA
ema = ema(priceSource, emaLength)

// Calculate Standard Deviation
stdDev = stdev(priceSource, stdDevLength)

// Calculate differences
diff1 = (ema + stdDev) - ema
diff2 = ema - (ema - stdDev)

// Calculate min and max differences from last year
lookbackPeriod = 504 // Number of trading days in a year
minDiff1 = lowest(diff1, lookbackPeriod)
maxDiff1 = highest(diff1, lookbackPeriod)
minDiff2 = lowest(diff2, lookbackPeriod)
maxDiff2 = highest(diff2, lookbackPeriod)

// Map differences based on requirements
mappedDiff1 = 50 + 50 * ((diff1 - minDiff1) / (maxDiff1 - minDiff1))
mappedDiff2 = 50 - 50 * ((diff2 - minDiff2) / (maxDiff2 - minDiff2))

// Combine mapped differences into a single line
mappedLine = if close > ema
    mappedDiff1
else
    mappedDiff2

// Plot 'mappedLine' in the main chart area conditionally
plot(mappedLine, title="EMA Difference Mapping", color=(close > ema ? color.blue : na), style=plot.style_line, linewidth=2)

// Calculate the 50EMA and 200SMA
ema50 = ema(close, 50)
sma200 = sma(close, 200)

// Plot the 50EMA and 200SMA on the main chart
plot(ema50, color=color.blue, title="50 SMA", linewidth=2)
plot(sma200, color=color.red, title="200 SMA", linewidth=2)

// Initialize trade variables
var bool waitingForBuy = na
var bool waitingForSell = na
var bool buyConditionMet = false
var bool sellConditionMet = false

if not sellConditionMet and crossunder(ema50, sma200)
    sellConditionMet := true
    waitingForBuy := false

if sellConditionMet 
    waitingForSell := true
    sellConditionMet := false

if waitingForSell and close < sma200 and mappedLine > 75
    strategy.entry("Sell", strategy.short)
    strategy.exit("Sell Exit", "Sell", profit=takeProfitPoints, loss=stopLossPoints)
    waitingForSell := false

// Define the strategy conditions and execute trades
if not buyConditionMet  and crossover(ema50, sma200)
    buyConditionMet := true
    waitingForSell := false

if buyConditionMet 
    waitingForBuy := true
    buyConditionMet := false

if waitingForBuy and close > sma200 and mappedLine < 25
    strategy.entry("Buy", strategy.long)
    strategy.exit("Buy Exit", "Buy", profit=takeProfitPoints, loss=stopLossPoints)
    waitingForBuy := false


もっと