この戦略は重量化定量移動平均のクロスオーバー戦略基本のアイデアは,価格,取引量,および他の指標に基づいて,高速と遅い線を設計し,黄金クロスとデッドクロスが発生するときに購入および販売信号を生成することです.
この戦略の核心指標は定量移動平均 (QMA) である.QMAは,一定の期間における重度の平均価格を計算することによってトレンド方向を測定する.通常の移動平均とは異なり,QMAの価格の重量 (重量=価格*取引量) は時間とともに減少する.したがって,最新の価格は市場変化により迅速に対応できるより大きな重量を持っています.
具体的には,この戦略は,25日間の高速QMAラインと29日間の遅いQMAラインを構築する.高速線がスローラインを越えると購入信号を生成し,高速線がスローラインを下回ると販売信号を生成する.
この戦略は,通常の移動平均値と比較して以下の利点があります.
この戦略にはいくつかのリスクもあります:
上記のリスクは,頻度を適切に調整し,厳格に前向きな分析を行い,他の指標を組み込むことで軽減できる.
この戦略をさらに最適化できる余地があります.
一般的に,これは安定した短期取引戦略である.単一価格平均と比較して,その指標は市場の供給と需要関係をよりよく反映することができる.適切なパラメータ調整とリスク管理により,この戦略は長期的に安定して動作し,健全な利益を得ることができます.
/*backtest start: 2022-11-29 00:00:00 end: 2023-12-05 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=3 strategy("Brad VWMACD Strategy 2233", overlay=false, max_bars_back=500,default_qty_type=strategy.percent_of_equity,commission_type=strategy.commission.percent, commission_value=0.18, default_qty_value=100) // === INPUT BACKTEST RANGE === FromMonth = input(defval = 9, title = "From Month", minval = 1, maxval = 12) FromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31) FromYear = input(defval = 2018, 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) // === FUNCTION EXAMPLE === 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 SMA === //fastMA = input(defval = 16, type = integer, title = "FastMA", minval = 1 ) //slowMA = input(defval = 23, type = integer, title = "SlowMA", minval = 1) fastMA = input(defval = 25, title = "FastMA", minval = 1 ) slowMA = input(defval = 29, title = "SlowMA", minval = 1) Long_period = slowMA Short_period = fastMA Smoothing_period = input(9, minval=1) xLongMAVolPrice = ema(volume * close, Long_period) xLongMAVol = ema(volume, Long_period) xResLong = (xLongMAVolPrice * Long_period) / (xLongMAVol * Long_period) xShortMAVolPrice = ema(volume * close, Short_period) xShortMAVol = ema(volume, Short_period) xResShort = (xShortMAVolPrice * Short_period) / (xShortMAVol * Short_period) xVMACD = xResShort - xResLong xVMACDSignal = ema(xVMACD, Smoothing_period) nRes = xVMACD - xVMACDSignal //plot(nRes*20+slowMA, color=blue, style = line ) //plot(3000, color=red, style = line ) // === SERIES SETUP === buy = crossover( xVMACD,xVMACDSignal) // buy when fastMA crosses over slowMA sell = crossunder( xVMACD,xVMACDSignal) // sell when fastMA crosses under slowMA // === SERIES SETUP === //buy = crossover(vwma(close, fastMA),7+vwma(close, slowMA)) // buy when fastMA crosses over slowMA //sell = crossunder(vwma(close, fastMA),vwma(close, slowMA)-7) // sell when fastMA crosses under slowMA // === EXECUTION === strategy.entry("L", strategy.long, when = window() and buy) // buy long when "within window of time" AND crossover strategy.close("L", when = window() and sell) // sell long when "within window of time" AND crossunder // === EXECUTION === strategy.entry("S", strategy.short, when = window() and sell) // buy long when "within window of time" AND crossover strategy.close("S", when = window() and buy) // sell long when "within window of time" AND crossunder plotshape(window() and buy, style=shape.triangleup, color=green, text="up") plotshape(window() and sell, style=shape.triangledown, color=red, text="down") plot(xVMACD*100, title = 'FastMA', color = orange, linewidth = 2, style = line) // plot FastMA plot(xVMACDSignal*100, title = 'SlowMA', color = aqua, linewidth = 2, style = line) // plot SlowMA