LoginSignup
2
3

More than 5 years have passed since last update.

MacOSXでWindowsのソフトであるMetaTrader4を使う

Last updated at Posted at 2018-05-29

Summary

MacOSXでWindowsのソフトであるMetaTrader4を使う

image.png

Prepare

# xquartzをインストール
$ brew cask install xquartz

# wineをインストール
$ brew install wine

# winetricksをインストール
$ brew install winetricks

# create 32-bit wine prefix
WINEPREFIX="$HOME/.wine" WINEARCH=win32 wine wineboot

# windows10にする
$ winecfg
# —> Guiがたちあがる
# —> 右下のポップアップでwindows10を選ぶ

Font

# フォントをインストール
$ winetricks allfonts

# フォントを滑らかな表示にする
$ winetricks fontsmooth-rgb

# 日本語を表示できるようにする
.wine$ pwd
/Users/callmekohei/.wine
# Meiryoを指定してみる
.wine$ vim user.reg
[Software\\Wine\\Fonts\\Replacements] 1517178030
#time=1d3988634f50dc0
"Arial Unicode MS"                            = "Meiryo"
"Batang"                                      = "Meiryo"
"BatangChe"                                   = "Meiryo"
"DFKai-SB"                                    = "Meiryo"
"Dotum"                                       = "Meiryo"
"DotumChe"                                    = "Meiryo"
"FangSong"                                    = "Meiryo"
"Gulim"                                       = "Meiryo"
"GulimChe"                                    = "Meiryo"
"KaiTi"                                       = "Meiryo"
"Meiryo"                                      = "Meiryo"
"Meiryo UI"                                   = "Meiryo"
"Microsoft JhengHei"                          = "Meiryo"
"Microsoft YaHei"                             = "Meiryo"
"MingLiU"                                     = "Meiryo"
"MS Gothic"                                   = "Meiryo"
"MS Mincho"                                   = "Meiryo"
"MS PGothic"                                  = "Meiryo"
"MS PMincho"                                  = "Meiryo"
"MS UI Gothic"                                = "Meiryo"
"NSimSun"                                     = "Meiryo"
"PMingLiU"                                    = "Meiryo"
"SimHei"                                      = "Meiryo"
"SimKai"                                      = "Meiryo"
"SimSun"                                      = "Meiryo"
"\x30e1\x30a4\x30ea\x30aa"                    = "Meiryo"
"\xff2d\xff33 \x30b4\x30b7\x30c3\x30af"       = "Meiryo"
"\xff2d\xff33 \x660e\x671d"                   = "Meiryo"
"\xff2d\xff33 \xff30\x30b4\x30b7\x30c3\x30af" = "Meiryo"
"\xff2d\xff33 \xff30\x660e\x671d"             = "Meiryo"

MetaTrader4をインストール

# exeファイルの場所まで移動
$ cd ~/Downloads/

# インストール開始
$ wine oanda4setup.exe

実行コマンドの作成

$ touch metatrader
$ chmod 777 metatrader
$ vim metatrader 
cd "/Users/callmekohei/.wine/drive_c/Program Files/OANDA - MetaTrader"
wine "/Users/callmekohei/.wine/drive_c/Program Files/OANDA - MetaTrader/terminal.exe”
$ mv metatrader /usr/local/bin

実行

$ metatrader

Re-dock

ウインドウとウインドウの間にフローティングしたウインドウをもってきて右側をダブルクリック

foo.gif

custom indicators のインストール

image.png

Step1
Data Folderをひらく
MT4 > File > Open Data Folder

Step2
indicators Folderをひらく
mql4 > indicators

Step3
もう一度Data Folderをひらく
ファイルを保存した場所に行ってCopy

Step4
Data FolderPaste

Shortcutの設定

foo.gif

01. 下記からAutoHotkeyをインストール

AutoHotkey

02. 設定ファイルを書く

see also: WindowsメッセージのIDと効能を調べる(2)。

see also: Metatrader4's Help
Help > client Terminal > User Interface > Fast Navigation

こんな感じで callmekohei's sample foo.ahk

03. shortcutを有効にする

# autohotkeyを立ち上げる
> autohotkey.exe foo.ahk

# MetaTrader4を立ち上げる
> terminal.exe

たとえばこんな感じで・・・

# metatraderというコマンドはこんな感じで作成
$ cat /usr/local/bin/metatrader

wine "C:/Program Files/AutoHotkey/autohotkey.exe" "Z:/Users/callmekohei/Downloads/foo.ahk" &
cd "/Users/callmekohei/.wine/drive_c/Program Files/OANDA - MetaTrader"
wine "/Users/callmekohei/.wine/drive_c/Program Files/OANDA - MetaTrader/terminal.exe"
ps | grep -e 'foo.ahk' | head -n 1 | cut -d ' ' -f 1 | xargs kill

# metatraderを立ち上げるときは
$ metatrader

uninstall

$ brew cask uninstall xquartz

$ brew uninstall winetricks

$ brew uninstall wine

~$ rm -rf .wine/

Reference

LinuxでWindowsアプリケーションを動かしたい人のためのWineの設定

Installing Wine on Mac

MacOS/Building

How to compile an MQL4 file with a command-line tool?

2
3
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
2
3