
この戦略は,多層移動平均の交差原理を適用し,中長線のトレンドを捕捉し,安定した利益を実現する.この戦略は,異なるパラメータの快速,中速,および遅速の3つの移動平均を採用し,その交差状況に応じて取引決定を行う.この多層移動平均の交差戦略は,従来の移動平均の2組のみの戦略と比較して,より多くの偽信号をフィルターして,戦略の勝利率を向上させる.
この戦略は,移動平均の3つのグループを使用します. 急速移動平均MAshort,中速移動平均MAmid,および遅い移動平均MAlong. その中,MAshortのパラメータは9であり,短線信号を捕捉するために最も迅速に反応します.
戦略の具体的な取引論理は,中速移動平均MAmid上を横切るMAlongは,株価の上昇勢いが形成されていることを示し,戦略は多めに行います.中速移動平均MAshort下を横切るMAmidは,ショートラインのトレンドが転向していることを示す,戦略は平仓します.
この戦略の最大の利点は,複数の移動平均の組み合わせをマッチングすることで,偽信号を効果的にフィルターし,中長線上のトレンドの中でより強力な突破を選択して,より多くのポジションを構築できる点にある.
この戦略の利点は以下の通りです.
この戦略には以下のリスクがあります.
上記のリスクに対して,我々は戦略の適用範囲をさらに拡大し,ストップ・テクニカル・コントロールと組み合わせて,最大限の撤回を行う.中長線トレンドが逆転した場合,我々はポジションの減少の方法で対応する.
この戦略は,以下の点で改善できます.
この戦略は典型的な中長線量化戦略であり,複数の移動平均をWebDriverWait==long term trendとマッチングすることで,取引リスクを制御する前提で,継続的な利益を得る.この戦略は,単一の指標と比較して,複数のパラメータを融合させ,強力な中長線トレンド信号を効果的に識別することができる.この戦略は,さらに最適化することで,より多くの品種に適用され,量化取引の分野で重要な役割を果たす.
/*backtest
start: 2023-12-12 00:00:00
end: 2024-01-11 00:00:00
period: 1h
basePeriod: 15m
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/
// © Coinrule
//@version=4
strategy(shorttitle='Multi Moving Average Crossing',title='Multi Moving Average Crossing (by Coinrule)', overlay=true, initial_capital=1000, default_qty_type = strategy.percent_of_equity, default_qty_value = 30, commission_type=strategy.commission.percent, commission_value=0.1)
//Backtest dates
fromMonth = input(defval = 1, title = "From Month", type = input.integer, minval = 1, maxval = 12)
fromDay = input(defval = 1, title = "From Day", type = input.integer, minval = 1, maxval = 31)
fromYear = input(defval = 2020, title = "From Year", type = input.integer, minval = 1970)
thruMonth = input(defval = 1, title = "Thru Month", type = input.integer, minval = 1, maxval = 12)
thruDay = input(defval = 1, title = "Thru Day", type = input.integer, minval = 1, maxval = 31)
thruYear = input(defval = 2112, title = "Thru Year", type = input.integer, minval = 1970)
showDate = input(defval = true, title = "Show Date Range", type = input.bool)
start = timestamp(fromYear, fromMonth, fromDay, 00, 00) // backtest start window
finish = timestamp(thruYear, thruMonth, thruDay, 23, 59) // backtest finish window
window() => true // create function "within window of time"
//MA inputs and calculations
inlong=input(100, title='MAlong')
inmid=input(50, title='MAmid')
inshort=input(9, title='MAfast')
MAlong = sma(close, inlong)
MAshort= sma(close, inshort)
MAmid= sma(close, inmid)
//Entry
bullish = crossover(MAmid, MAlong)
strategy.entry(id="long", long = true, when = bullish and window())
//Exit
bearish = crossunder(MAshort, MAmid)
strategy.close("long", when = bearish and window())
plot(MAshort, color=color.orange, linewidth=2)
plot(MAmid, color=color.red, linewidth=2)
plot(MAlong, color=color.blue, linewidth=2)