Quantcast
Channel: Vimタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 5608

MQL on Vim ( VimでMQLをかいてみる )

$
0
0

Summary

MQLという言語をVimで書いて実行する環境を作ってみましたっ

foo.gif

Thanks

// twitter
@haxe
@matthn
@raa0121

Environment

$ sw_vers 
ProductName:    Mac OS X
ProductVersion: 10.13.3
BuildVersion:   17D47

$ wine --version
wine-3.0

$ mono --version
Mono JIT compiler version 5.4.1.6 (tarball Mon Dec 11 14:59:42 GMT 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           normal
    SIGSEGV:       altstack
    Notification:  kqueue
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            sgen (concurrent by default)$ wine cmd
Microsoft Windows 10.0.15063 (3.0)

Z:\Users\callmekohei\.config\>

MetaEditorに F5 を送る

こんな感じ(F#という言語で書いてます)

abc.fsx
openSystem.Runtime.InteropServicesopenSystem.Windows.Forms[<DllImport"user32.dll">]externnativeintFindWindow(stringclassName,stringwindowName)[<DllImport"user32.dll">]externboolSetForegroundWindow(nativeinthwnd)FindWindow("MetaQuotes::MetaEditor::5.00",null)|>SetForegroundWindow|>ignoreSendKeys.Send"{F5}"

Quickrunの設定とBash script

letg:quickrun_config.mql4 ={        \'exec':['%c %o %s:p:t']        \,'command':'bash'        \,'cmdopt':'$HOME/tmp/quickrunMQL/quickrunMQL.bash'    \}

^Mctrl V -> ctrl Mで入力する

foo.bash
# ===========================================================================#  FILE    : foo.bash#  AUTHOR  : callmekohei <callmekohei at gmail.com>#  License : MIT license# ===========================================================================file=$1MetaTraderHOME=("$WINEPREFIX/drive_c/Program Files/OANDA - MetaTrader")MetaEditor=("${MetaTraderHOME[@]}"/metaeditor.exe)SendsKeyCMD=$(cd$(dirname$0)&&pwd)/quickrunMQL

wine "${MetaEditor[@]}" /s /log:foo.log /compile:$file 2>/dev/null
iconv -f utf-16 -t utf-8 foo.log | sed-e"s/^M//g"> bar.log

echo"───── MetaEditor Compiler ─────"cat bar.log

if cat bar.log | fgrep 'Result 0 error(s), 0 warning(s)' 1>/dev/null ;then

    echo"───── MetaTrader Terminal ─────"echo$SendsKeyCMD | wine cmd 1>/dev/null
    echo$SendsKeyCMD | wine cmd 1>/dev/null
    echo$SendsKeyCMD | wine cmd 1>/dev/null
    cat"${MetaTraderHOME[@]}"/MQL4/Logs/$(date +"%Y%m%d").log | tail-4 | sed-e"s/\\^M//g"fi

rm foo.log
rm bar.log

課題

とりあえず動く、という程度なのでもっと洗練させたい

TODO: 2018/05/29
もうすこしわかりやすく書く!

Viewing all articles
Browse latest Browse all 5608

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>