0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

MT5を監視してSlackに通知を出すプログラムを作ってみた!

Posted at

概要

株取引である MT5 を監視してゴールデンクロスなどを検知して slack へ通知を出すプログラムを作りました

リポジトリはこちら

制約

  • MT5 は Windows 上で動かす必要がある
  • Mt5 のアカウントは作成する必要がある
  • Mt5 に適切に設定をする必要がある
  • 今回のプログラムでは WSL 上の Docker 環境で動かすことを想定

仕組み

今回作成した仕組みは以下の通りです

  1. MT5 上でdocs/MT5で行う設定/WSL_FileBridge.mq5を常時実行しておく
    a. /mnt/c/Users/campbel/AppData/Roaming/MetaQuotes/Terminal/Common/Filesに移動平均線のデータがユニークな id 付きの csv で保存される
    b. 例) mt5_ma_20251113T165918Z_8fdf77.csv

  2. /mnt/c/Users/campbel/AppData/Roaming/MetaQuotes/Terminal/Common/Filesに作成されたファイルを WSL 上の Python から定期的に読み取り移動平均線のデータを取得して解析を行う

図で表すと以下の通り

環境設定

1. 環境変数の作成

  • docker/local/.env.exampleを参考にしてdocker/local/.envを作成
  • project/.env.exampleを参考にしてproject/.envを作成

2. MT5 の設定を行う

  • docs/MT5で行う設定を参考にして MT5 上で設定

3. Docker 環境の作成

  • make initコマンドを実行する

4. プログラムの実行

  • docker compose -f "./docker/local/docker-compose.yml" -p mt5 exec mt5 pipenv run python scripts/moving_average_detection.pyを実行

もしくは

  • make shellで Docker の中に入ってpipenv run python scripts/moving_average_detection.pyを実行
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?