見出し画像

エリオット波動のプログラム公開


マイクロソフト株価 エリオット波動

上記結果は、それっぽく捉えているように思えますが、以下の2点、問題があります。
1.エリオット波動のノイズフィルタしきい値により、全く違うポイントが検出される。
prominence_value = 15 # Adjust as needed
これにより、エリオット波動の1波動目がどこか見極めが難しい

2.場所により8波動セットのフィルタしきい値を変えないと、きれいにマッチングできない。(大きい波集団、小さい波集団があるということ)

簡単には、全自動まではいきませんね
半日間悩んでいましたが、一旦プログラムを公開

最終版完成したら、いろんな株価の情報を巡回で調べて、
その中でも、大きな波集団の1波目を探し出す、なんてことやりたいんですが

サーフィンでいうと、サーフィンの場所と、そこで乗りたい大きな波を探し出すという作業ですね

最後の行を書き換えたら、他の株価の波動が確認できます。

エリオット波動が何かは、こちらを参考に

プログラムは、Pythonインストール無しに、グーグルコラボのページで実行できます。簡単なので、みなさんも実行してみてください。

使い方が分からなかったら、詳細の説明がこちらに

でも、このエリオット波動見てて、まるでマンデルブロー集合と思ったのは、言い過ぎなんかな
波動のひとつの中に、似たような波動1セットを見つけることができます
また、この波動1セットも離れて見ると、大きな変化の1つだったりしてね
所詮、ランダムウォークなんだろうけど、なんか面白いね


import yfinance as yf
import matplotlib.pyplot as plt
from datetime import datetime
from scipy.signal import find_peaks
import matplotlib.dates as mdates

def find_elliott_wave_cycles(peaks, troughs):
    # Combine peaks and troughs and sort them to simulate the full wave cycle
    combined = list(peaks) + list(troughs)
    combined.sort()
    return combined

def elliott_wave_analysis(ticker_symbol, start_date):
    now = datetime.now()
    end_date = now.strftime('%Y-%m-%d')
    data = yf.download(ticker_symbol, start_date, end_date)

    prices = data['Close'].values
    dates = data.index

    prominence_value = 15  # Adjust as needed
    peaks, _ = find_peaks(prices, prominence=prominence_value)
    troughs, _ = find_peaks(-prices, prominence=prominence_value)

    combined_indices = find_elliott_wave_cycles(peaks, troughs)

    plt.figure(figsize=(14, 7))
    plt.plot(dates, prices, label=f'{ticker_symbol} Price')
    plt.plot(dates[peaks], prices[peaks], "x", label="Peaks")
    plt.plot(dates[troughs], prices[troughs], "o", label="Troughs")

    plt.gca().xaxis.set_major_locator(mdates.MonthLocator(interval=2))
    plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%Y/%m'))

    wave_count = 1
    for idx in combined_indices:
        plt.axvline(x=dates[idx], color='gray', linestyle='--')
        plt.text(dates[idx], prices[idx], f'WAVE {wave_count}', rotation=45, color='darkgreen')
        wave_count += 1
        if wave_count > 8:
            wave_count = 1

    plt.title(f"Elliott Wave Analysis of {ticker_symbol}")
    plt.xlabel("Date")
    plt.ylabel("Price")
    plt.legend()
    plt.show()

# Example usage:
elliott_wave_analysis('MSFT', '2023-10-01')

この記事が気に入ったらサポートをしてみませんか?