
ゴールドVWAP MACD SMO取引戦略は,12時間周期で設計された完全な取引戦略である.それはVWAP月線,SMO振動器,MACD指標を組み合わせて,ゴールド市場の取引機会を識別する.
この戦略は,VWAP月線を主要なトレンド指標として使用する.VWAPは,価格の平均取引価格を表す.月線は,VWAPの計算の時間範囲が過去1ヶ月であることを意味する.現在の閉店価格がVWAP月線より高い場合は,現在トレンド上昇段階にあることを示し,閉店価格がVWAP月線より低い場合は,トレンドが低下していることを意味する.
SMO振動器は,現在の超買超売状況を判断するために使用される.それは,長周期構成要素と短周期構成要素で構成されている.振動器が0以上であるときは,超買状態にあることを示し,0未満である時は,超売状態を表している.
MACD直角図は,動力の方向を判断できる.柱が上を突破すると,動力が正転を強く,多めにできる;柱が下を突破すると,動力が弱転することを意味し,空き場を考慮すべきである.
この3つの指標に基づいて,取引戦略の具体的なルールを設定できます.
多頭入り:閉盘価格がVWAP月線より高く,MACD直線の柱上が突破し,SMO振動器が0より高いときに多頭入り 空頭入り:閉盤価格がVWAP月線を下回ると,MACD直線の柱は下落して突破し,SMO振動器は0を下回ると空白
ストップ・ストップ・損失は,入力されたパーセントに応じて設定されます.
この戦略は,複数の時間帯と指標を組み合わせて,トレンドの方向と強さを効果的に判断することができ,以下の利点があります.
この戦略は合理的に設計されているものの,注意すべきリスクはいくつかあります.
上記のリスクを制御するために,VWAPとMACDのパラメータを合理的に最適化すべきであり,大きすぎてはならない.同時に,ストップ・ストップ・損失比率は大きすぎてはならない.単一の損失を3%ほど制御すべきである.
この戦略は,以下の点で最適化できます.
黄金のVWAP MACD SMO戦略は,トレンドを判断する複数の指標を統合し,オーバーバイ・オーバーセルの状況を効果的に捉えることができます.一定のリスクがあるものの,パラメータ最適化とリスク管理手段によって制御できます.この戦略は,非常に強力な拡張性を持ち,実際の需要に応じてモジュール的に最適化することができ,長期にわたって追跡する価値のある取引システムです.
/*backtest
start: 2023-09-19 00:00:00
end: 2023-10-19 00:00:00
period: 4h
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/
// © exlux99
//@version=4
// strategy("VWAP Gold strategy", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 10000, calc_on_every_tick = true, commission_type = strategy.commission.percent, commission_value = 0.005)
source = input(low)
//vwap monthly
timeframeM = time("M")
beginningM = na(timeframeM[1]) or timeframeM > timeframeM[1]
sumsourceM = source * volume
sumVolM = volume
sumsourceM := beginningM ? sumsourceM : sumsourceM + sumsourceM[1]
sumVolM := beginningM ? sumVolM : sumVolM + sumVolM[1]
vwapMonthly= sumsourceM / sumVolM
//macd
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
src = input(title="Source", type=input.source, defval=close)
signal_length = input(title="Signal Smoothing", type=input.integer, minval = 1, maxval = 50, defval = 9)
fast_ma = ema(src, fast_length)
slow_ma = ema(src, slow_length)
macd = fast_ma - slow_ma
signal = ema(macd, signal_length)
hist = macd - signal
//SMO
longlen = input(22, minval=1, title="Long Length SMO")
shortlen = input(6, minval=1, title="Short Length SMO")
siglen = input(5, minval=1, title="Signal Line Length SMO")
erg = tsi(close, shortlen, longlen)
sig = ema(erg, siglen)
osc = erg - sig
shortCondition = close < vwapMonthly and hist < hist[1] and osc < 0
longCondition = close > vwapMonthly and hist> hist[1] and osc > 0
tplong=input(0.085, step=0.005, title="Take profit % for long")
sllong=input(0.03, step=0.005, title="Stop loss % for long")
tpshort=input(0.05, step=0.005, title="Take profit % for short")
slshort=input(0.025, step=0.005, title="Stop loss % for short")
strategy.entry("long",1,when=longCondition)
strategy.entry("short",0,when=shortCondition)
strategy.exit("short_tp/sl", "long", profit=close * tplong / syminfo.mintick, loss=close * sllong / syminfo.mintick, comment='LONG EXIT', alert_message = 'closeshort')
strategy.exit("short_tp/sl", "short", profit=close * tpshort / syminfo.mintick, loss=close * slshort / syminfo.mintick, comment='SHORT EXIT', alert_message = 'closeshort')