強さの指標:ADX

Pythonで学ぶ金融トレーディング

Chelsea Yang

Data Science Instructor

ADXとは?

  • “Average Directional Movement Index” の略
  • 開発者:J. Welles Wilder
    • “New Concepts in Technical Systems” (1987)

ウェルズ・ワイルダーの本

  • トレンドの強さを測定
    • 0〜100で推移
    • ADX <= 25:非トレンド
    • ADX > 25:トレンド相場
    • ADX > 50:強いトレンド相場
Pythonで学ぶ金融トレーディング

ADXの計算方法

  • +DI と -DI の差の平滑移動平均から導出
    • +DI(Plus Directional Index):上昇トレンドの有無を定量化
    • -DI(Minus Directional Index):下降トレンドの有無を定量化

 

  • 計算入力:
    • 各期間の高値・安値・終値
Pythonで学ぶ金融トレーディング

PythonでのADX実装

# Calculate ADX
stock_data['ADX'] = talib.ADX(stock_data['High'], stock_data['Low'], stock_data['Close'],
                              timeperiod=14)

# Print the last five rows print(stock_data.tail())
             Open   High    Low  Close   ADX
Date                                        
2020-11-24 540.40 559.99 526.20 555.38 21.16
2020-11-25 550.06 574.00 545.37 574.00 23.92
2020-11-27 581.16 598.78 578.45 585.76 26.82
2020-11-30 602.21 607.80 554.51 567.60 28.25
2020-12-01 597.59 597.85 572.05 584.76 29.58
Pythonで学ぶ金融トレーディング

ADXのプロット

import matplotlib.pyplot as plt

# Create subplots
fig, (ax1, ax2) = plt.subplots(2)

# Plot ADX with the price ax1.set_ylabel('Price') ax1.plot(stock_data['Close']) ax2.set_ylabel('ADX') ax2.plot(stock_data['ADX']) ax1.set_title('Price and ADX') plt.show()

上に価格、下にADXを表示したプロット

Pythonで学ぶ金融トレーディング

演習に進みましょう

Pythonで学ぶ金融トレーディング

Preparing Video For Download...