
GM-8 & ADX双均線戦略は,複数の技術指標を組み合わせた定量取引戦略である.この戦略は,GM-8指標,ADX指標と第2のEMA指標を使用して,潜在的な買入シグナルを識別する.GM-8指標は,価格トレンドを判断するために使用される,ADX指標は,トレンドの強さを確認するために使用される,第2のEMA指標は,トレンドの方向を判断するために使用される.価格がGM-8平均線を突破し,ADX指標が値より高くなったときに,買入シグナルが生成される.この戦略の優点は,複数の指標を組み合わせて,信号の信頼性を向上させることにある.しかし,同時に,信号と滞りがあるというリスクもある.
GM-8 & ADXの双均線戦略の原理は以下の通りである.
GM-8 & ADX双均線戦略は,複数の技術指標を組み合わせて買賣信号を識別する古典的な定量化取引戦略である.この戦略の優点は,論理が単純で明快で,信号は比較的信頼性があり,初心者の学習使用に適していることにある.しかし,同時に,トレンド識別遅延,頻繁な取引,パラメータ選択の困難などのリスクもある.戦略のパフォーマンスをさらに向上させるために,条件のフィルタリング,出場時のエントリー最適化,パラメータのダイナミック調整,ポジション管理の最適化などの追加措置を導入することを考えることができる.全体的に言えば,GM-8 & ADX双均線戦略は,定量化取引のための良い基礎の枠組みを提供し,実践で絶えず修正し,改善する価値がある.
/*backtest
start: 2023-04-24 00:00:00
end: 2024-04-29 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("GM-8 and ADX Strategy with Second EMA", overlay=true)
// Input parameters
gm_period = input(15, title="GM-15 Period")
second_ema_period = input(59, title="Second EMA Period")
adx_period = input(8, title="ADX Period")
adx_threshold = input(34, title="ADX Threshold")
lot_size = input.float(0.4, title="Lot Size")
// Calculate the ADX manually
adx(high, low, close, length) =>
sum_truerange = 0.0
sum_plusDM = 0.0
sum_minusDM = 0.0
for i = 1 to length
truerange_calc = high[i] - low[i]
truerange_prev_close = high[i] - close[i-1]
truerange_close = low[i] - close[i-1]
truerange_calc := truerange_prev_close > truerange_calc ? truerange_prev_close : truerange_calc
truerange_calc := truerange_close > truerange_calc ? truerange_close : truerange_calc
sum_truerange := sum_truerange + truerange_calc
plusDM = high[i] - high[i-1] > low[i-1] - low[i] and high[i] - high[i-1] > 0 ? high[i] - high[i-1] : 0
sum_plusDM := sum_plusDM + plusDM
minusDM = low[i-1] - low[i] > high[i] - high[i-1] and low[i-1] - low[i] > 0 ? low[i-1] - low[i] : 0
sum_minusDM := sum_minusDM + minusDM
plusDI = sum_plusDM / sum_truerange * 100
minusDI = sum_minusDM / sum_truerange * 100
sumDI = plusDI + minusDI
adx_value = 100 * (plusDI - minusDI) / (sumDI == 0 ? 1 : sumDI)
// Calculate indicators
gm_8 = ta.sma(close, gm_period)
second_ema = ta.ema(close, second_ema_period)
adx_value = adx(high, low, close, adx_period)
// Define buy and sell conditions
buy_condition = ta.crossover(close, gm_8) and close > gm_8 and close > second_ema and adx_value > adx_threshold
sell_condition = ta.crossunder(close, gm_8) and close < gm_8 and close < second_ema and adx_value > adx_threshold
// Entry and exit logic
if (buy_condition)
strategy.entry("Buy", strategy.long, qty=lot_size)
if (sell_condition)
strategy.entry("Sell", strategy.short, qty=lot_size)
// Exit conditions
exit_buy_condition = ta.crossunder(close, gm_8) and close < gm_8
exit_sell_condition = ta.crossover(close, gm_8) and close > gm_8
if (exit_buy_condition)
strategy.close("Buy")
if (exit_sell_condition)
strategy.close("Sell")