ジュコフの移動平均のクロスオーバートレンド

作者: リン・ハーンチャオチャン,日付: 2023年12月12日 12:24:11
タグ:

img

概要

この戦略は,移動平均クロスオーバーとATRインジケーターを使用して,取引後に自動化されたトレンドを実装する. 速いEMAがスローEMAを超えると長くなって,速いEMAがスローEMAを下回ると短くなります. 同時に,トレンド方向を判断するためにATRインジケーターを使用し,ATRがトレンドがあることを示す場合にのみ取引信号を送信します.

戦略の論理

この戦略は主に2つの技術指標に基づいています.

  1. EMAライン: 異なるパラメータ,高速と遅い2つのEMAラインを使用する.高速EMAが遅いEMAの上に横切ると,それは長い信号とみなされます.高速EMAが遅いEMA以下に横切ると,それは短い信号とみなされます.

  2. ATR指標: ATR指標は,現在の動きの傾向性を判断するために価格変動の大きさと力を測定する.小規模なATR値は統合を示し,大きな上昇するATR値は上昇傾向を示し,大きな下落するATR値は下落傾向を示します.

EMAのクロスオーバーを組み合わせて 取引機会を特定し ATRフィルターを組み合わせて 低トレンドネス制を回避することで この戦略は 市場が動揺している間に 引っかかることを避けることを目指しています

利点分析

この戦略の利点は以下の通りです.

  1. ATRがトレンドを特定するときにのみ取引する.これは非方向性レジムの際にフラッシュされるのを避けるのに役立ちます.

  2. 取引信号を識別するために シンプルな高速対遅いEMAクロスオーバーロジックを使用します

  3. パラメータ調整によるEMAの感度とスムーズさを調整できる.

  4. パインエディタで簡単に実装できる 2つの簡単な指標で構築された完全な自動取引システムです

  5. パラメータの調整を継続する必要が最小で セット・アンド・フォリバー・アプローチ

リスク分析

留意すべきリスクは以下のとおりです.

  1. EMAのクロスオーバーは誤った信号を生み,不必要な損失を引き起こす可能性があります.よりスムーズな EMAパラメータが役立ちます.

  2. ATRの動向判断も誤りになり,取引機会が逃れることもあります.ATRの値が緩和される可能性があります.

  3. 高時間枠の基本要素を考慮しない.主要なニュースイベントは,EMAの高速クロスオーバーが見逃すかもしれない逆転を誘発し,手動的な介入を必要とします.

このリスクは最適化によって軽減できます

オプティマイゼーションの方向性

主な最適化方向は以下の通りである.

  1. 他の指標を追加して統合システムを作成し,信号の精度を向上させる.例:RSIを統合して過買い/過売リスクを回避する.

  2. EMA と ATR パラメータを特定市場に最も適した形で,取引されたシンボルと時間枠に基づいて選択する.

  3. 機械学習による動的パラメータ最適化を実施し,固定静的値の代わりに現在の市場状況に基づいて指標を調整する.

結論

基本的には,このトレンドは戦略をフォローする非常に実用的なトレンドです.単に2つの指標の単純な組み合わせで,比較的完全な取引システムを構築します.パラメータ調整を通じて,異なる好みやスタイルを持つトレーダーに適応できます.同時に,さらなる拡張と最適化は戦略のパフォーマンスをさらに向上させることができます. シンプルで効果的な取引論理と強力な最適化可能性は,これを長期的に研究し適用する価値のある定量戦略にします.


/*backtest
start: 2022-12-05 00:00:00
end: 2023-12-11 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This strategy has been created for GMT trade 4h by Zhukov


//@version=5
strategy('ZhukovTrade', overlay=true, calc_on_every_tick=true, currency=currency.USD)

// INPUT:

// Options to enter fast and slow Exponential Moving Average (EMA) values
emaFast = input.int(title='Fast EMA', defval=100, minval=1, maxval=9999)
emaSlow = input.int(title='Slow EMA', defval=200, minval=1, maxval=9999)

// Option to select trade directions
tradeDirection = input.string(title='Trade Direction', options=['Long', 'Short', 'Both'], defval='Both')

// Options that configure the backtest date range
startDate = input(title='Start Date', defval=timestamp('01 Jan 2023 00:00'))
endDate = input(title='End Date', defval=timestamp('31 Dec 2023 23:59'))


// CALCULATIONS:

// Use the built-in function to calculate two EMA lines
fastEMA = ta.ema(close, emaFast)
slowEMA = ta.ema(close, emaSlow)
emapos = ta.ema(close,200)

// PLOT:

// Draw the EMA lines on the chart
plot(series=fastEMA, color=color.new(color.orange, 0), linewidth=2)
plot(series=slowEMA, color=color.new(color.blue, 0), linewidth=2)
plot(series=emapos, color=color.new(color.red, 0), linewidth=2)


// CONDITIONS:

// Check if the close time of the current bar falls inside the date range
inDateRange = true

// Translate input into trading conditions
longOK = tradeDirection == 'Long' or tradeDirection == 'Both'
shortOK = tradeDirection == 'Short' or tradeDirection == 'Both'

// Decide if we should go long or short using the built-in functions
longCondition = ta.crossover(fastEMA, slowEMA) 
shortCondition = ta.crossunder(fastEMA, slowEMA) 
// ORDERS:
// Set take profit and stop loss percentages
take_profit_percent = input(0, title="Take Profit Percent")
stop_loss_percent = input(0, title="Stop Loss Percent")
// Submit entry (or reverse) orders


atrPeriod = input(12, "ATR Length")
factor = input.float(3.0, "Factor", step = 0.01)

[supertrend, direction] = ta.supertrend(factor, atrPeriod)

bodyMiddle = plot((open + close) / 2, display=display.none)
upTrend = plot(direction < 0 ? supertrend : na, "Up Trend", color = color.green, style=plot.style_linebr)
downTrend = plot(direction < 0? na : supertrend, "Down Trend", color = color.red, style=plot.style_linebr)

fill(bodyMiddle, upTrend, color.new(color.green, 90), fillgaps=false)
fill(bodyMiddle, downTrend, color.new(color.red, 90), fillgaps=false)

if longCondition and inDateRange 
    if longOK and direction<0

        strategy.entry(id='long', direction=strategy.long, alert_message = "LONG")
if shortCondition and inDateRange 
    if shortOK and direction>0
        strategy.entry(id='short', direction=strategy.short, alert_message = "SHORT")

// Submit exit orders in the cases where we trade only long or only short

if strategy.position_size > 0 and take_profit_percent
    strategy.exit(id='tp long',from_entry ="long",profit = take_profit_percent)
if strategy.position_size > 0 and stop_loss_percent
    strategy.exit(id='sl long',from_entry="long",loss=stop_loss_percent)

if strategy.position_size < 0 and stop_loss_percent
    strategy.exit(id='sl short',from_entry="short",loss=stop_loss_percent)
if strategy.position_size < 0 and take_profit_percent
    strategy.exit(id='tp short',from_entry="short",profit = take_profit_percent)


もっと