今後のマイクDルート予測戦略


作成日: 2023-12-13 17:21:44 最終変更日: 2023-12-13 17:21:44
コピー: 0 クリック数: 714
1
フォロー
1621
フォロワー

今後のマイクDルート予測戦略

概要

この戦略の核心思想は,マックD指数の将来の動きを分析して,価格の傾向を予測することです.この戦略は,マックD指数の急速平均線と遅い平均線が構成する交差から生じる取引シグナルを充分利用しています.

戦略原則

  1. マックD指標の差値 ((歴史値) を計算し,それに基づいてマックD線と信号線の上昇と低下を判断する.
  2. 利回りオプションを設定し,4時間間のマックD指数の将来の値を使用して,マックD指数の将来の動きを判断し,価格トレンドを予測する.
  3. マックD指数の差が0より大きい (多頭市場を表す) で上昇が続くと予想される場合は,多頭; マックD指数の差が0より小さい (空頭市場を表す) で減少が続くと予想される場合は,空頭.
  4. この戦略は,トレンド追跡とトレンド反転の2つの取引方法を組み合わせ,トレンドをキャプチャしながら,トレンド反転のタイミングを把握します.

戦略的優位分析

  1. マックD指数は,市場トレンドの優位性を判断するために使用され,波動を効果的にフィルターし,長線トレンドを捕捉することができます.
  2. マック・D指数の予測により,価格の転換点を早期に把握し,戦略の前向き性を高めることができます.
  3. 同時に,トレンド追跡とトレンド反転の取引方法を融合させ,トレンド追跡の過程で適切なタイミングでポジションを反転させ,より大きな利益を得ることができます.
  4. 戦略のパラメータは調整可能で,ユーザーは異なる時間周期と市場環境に応じて最適化して,戦略の安定性を高めることができる.

戦略的リスク分析

  1. マック・D指数の将来の動きの予測に依存し,予測が不正確であれば取引が失敗する.
  2. 単一損失を制御するために,ストップと連携する必要があります.ストップ幅の設定が不適切であることも,戦略の効果に影響を与えます.
  3. マックD指数は,遅滞により,価格の急速な反転の機会を逃す可能性がある.これは,高度な変動状況下での戦略的パフォーマンスの懸念である.
  4. 取引コストの影響を考慮する必要があります

戦略最適化の方向性

  1. 他の指標と組み合わせて予測し,単一のマックD指標への依存を軽減し,予測の正確性を向上させる.例えば,取引量の変化を調査する.
  2. 機械学習アルゴリズムを組み込み,マックD指数の予測モデルを訓練する.
  3. 最適化パラメータの設定,最適のパラメータの組み合わせを探す.
  4. 市場環境によって異なるパラメータ配置に対応し,自己適応システムに自動最適化パラメータを追加することができる.

要約する

この戦略は,マックD指数の判断トレンドの優位性を充分に活用しながら,指数の将来の動きの予測分析を加え,トレンドを捕捉した基礎で重要な転換点を把握する.単純にトレンドを追跡するよりも,この戦略の適用前向き性が強く,利益の余地が大きい.もちろん,一定のリスクがあり,さらなる最適化と完善が必要である.全体的に,この戦略は,研究と応用の価値があります.

ストラテジーソースコード
/*backtest
start: 2023-12-05 00:00:00
end: 2023-12-12 00:00:00
period: 5m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// @version=4
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © x11joe
strategy(title="MacD (Future Known or Unknown) Strategy", overlay=false, precision=2,commission_value=0.26, initial_capital=10000, currency=currency.USD, default_qty_type=strategy.percent_of_equity, default_qty_value=100)

//OPTIONAL:: Allow only entries in the long or short position
allowOnlyLong = input(title="Allow position ONLY in LONG",type=input.bool, defval=false)
allowOnlyShort = input(title="Allow position ONLY in SHORT",type=input.bool, defval=false)


strategy.risk.allow_entry_in(allowOnlyLong ? strategy.direction.long : allowOnlyShort ? strategy.direction.short : strategy.direction.all) // There will be no short entries, only exits from long.

// Create MacD inputs
fastLen = input(title="MacD Fast Length", type=input.integer, defval=12)
slowLen = input(title="MacD Slow Length", type=input.integer, defval=26)
sigLen  = input(title="MacD Signal Length", type=input.integer, defval=9)

// Get MACD values
[macdLine, signalLine, _] = macd(close, fastLen, slowLen, sigLen)
hist = macdLine - signalLine

useFuture = input(title="Use The Future?",type=input.bool,defval=true)

macDState(resolutionType) =>
    hist_from_resolution = security(syminfo.tickerid, resolutionType, hist,barmerge.gaps_off, barmerge.lookahead_on)
    Green_IsUp = hist_from_resolution > hist_from_resolution[1] and hist_from_resolution > 0
    Green_IsDown = hist_from_resolution < hist_from_resolution[1] and hist_from_resolution > 0
    Red_IsDown = hist_from_resolution < hist_from_resolution[1] and hist_from_resolution <= 0
    Red_IsUp = hist_from_resolution > hist_from_resolution[1] and hist_from_resolution <= 0
    result=0
    if(Green_IsUp)
        result := 1
    if(Green_IsDown)
        result := 2
    if(Red_IsDown)
        result := 3
    if(Red_IsUp)
        result := 4
    result

macDStateNonFuture(resolutionType) =>
    hist_from_resolution = security(syminfo.tickerid, resolutionType, hist,barmerge.gaps_off, barmerge.lookahead_off)
    Green_IsUp = hist_from_resolution > hist_from_resolution[1] and hist_from_resolution > 0
    Green_IsDown = hist_from_resolution < hist_from_resolution[1] and hist_from_resolution > 0
    Red_IsDown = hist_from_resolution < hist_from_resolution[1] and hist_from_resolution <= 0
    Red_IsUp = hist_from_resolution > hist_from_resolution[1] and hist_from_resolution <= 0
    result=0
    if(Green_IsUp)
        result := 1
    if(Green_IsDown)
        result := 2
    if(Red_IsDown)
        result := 3
    if(Red_IsUp)
        result := 4
    result

// === INPUT BACKTEST RANGE ===
FromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
FromDay   = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
FromYear  = input(defval = 2019, title = "From Year", minval = 2017)
ToMonth   = input(defval = 1, title = "To Month", minval = 1, maxval = 12)
ToDay     = input(defval = 1, title = "To Day", minval = 1, maxval = 31)
ToYear    = input(defval = 9999, title = "To Year", minval = 2017)

start     = timestamp(FromYear, FromMonth, FromDay, 00, 00)  // backtest start window
finish    = timestamp(ToYear, ToMonth, ToDay, 23, 59)        // backtest finish window
window()  => time >= start and time <= finish ? true : false // create function "within window of time"
// === INPUT BACKTEST RANGE END ===

//Get FUTURE or NON FUTURE data
macDState240=useFuture ? macDState("240") : macDStateNonFuture("240") //1 is green up, 2 if green down, 3 is red, 4 is red up

//Fill in the GAPS
if(macDState240==0)
    macDState240:=macDState240[1]

//Plot Positions
plot(close,color= macDState240==1 ? color.green : macDState240==2 ? color.purple : macDState240==3 ? color.red : color.yellow,linewidth=4,style=plot.style_histogram,transp=50)

if(useFuture)
    strategy.entry("buy_1",long=true,when=window() and (macDState240==4 or macDState240==1))
    strategy.close("buy_1",when=window() and macDState240==3 and macDState240[1]==4)
    strategy.entry("sell_1",long=false,when=window() and macDState240==2)
else
    strategy.entry("buy_1",long=true,when=window() and (macDState240==4 or macDState240==1))//If we are in a red macD trending downwards MacD or in a MacD getting out of Red going upward.
    strategy.close("buy_1",when=window() and macDState240==3 and macDState240[1]==4)//If the state is going upwards from red but we are predicting back to red...
    strategy.entry("sell_1",long=false,when=window() and macDState240==2)//If we are predicting the uptrend to end soon.