MQL5で#importがうまく使えません。 新しいコメント Suzuki1992 2021.01.20 12:05 下に日本語あります。 Hi, everyone! I started to use MT5 and MQL5. I had a trouble in using #import. The code of Libraries\import_test.mq5 is as below. #property library #property copyright "---" #property link "https://www.mql5.com" #property version "1.00" void import_test(void) export { Print("SUCCEEDED"); } And the code of Indicators\TEST.mq5 is as below. #property copyright "---" #property link "https://www.mql5.com" #property version "1.00" #property indicator_chart_window #property indicator_buffers 1 #property indicator_plots 1 #import "import_test.ex5" void import_test(void); #import int OnInit() { import_test(); return(INIT_SUCCEEDED); } int OnCalculate(const int rates_total, const int prev_calculated, const int begin, const double &price[]) { return(rates_total); } I compiled each code. There is no problem in compiling import_test.mq5. After I got import_test.ex5, I tried to compile TEST.mq5. Then I had a error. The error massage is : ')' - undeclared identifier. And the message is given to 15th line of TEST.mq5, namely 'import_test();' which is inside OnInit function. Why the compiling is failed? I never had such problem while using MT4 and MQL4. I read MQL5 Reference, but I can't find out big difference between MQL5 and MQL4 with using #import. 日本語と英語でフォーラムが分かれているのに気が付きませんでした。 上のコードがライブラリ内にあり、下のコードがIndicatorフォルダの中にあるのですが、#importをつかってインポートできません。 MQL4を使用したときには、問題なくインポートは使えていて、MQL5のリファレンスを読んでも、#importの使い方については、ほとんど変わりがないように思えます。 なぜ、うまくいかないのでしょうか? How to use #import in MQL5? Code Generation Error Question about dedicated back testing Shino Unada 2021.01.20 13:05 #1 括弧内になぜ void が入っているんですか? 括弧内を空にしたらうまくいかない?この質問は テクニカル指標 に投稿すべきです。 MQL5フォーラム: テクニカル指標 www.mql5.com MQL5言語でユーザーにより開発されたテクニカル指標はここでディスカッションされます Suzuki1992 2021.01.20 13:20 #2 Nagisa Unada: 括弧内になぜ void が入っているんですか? 括弧内を空にしたらうまくいかない? この質問は テクニカル指標 に投稿すべきです。 ご返答ありがとうございます。 投稿先の件、大変失礼いたしました。今後気を付けます。 先程、自力で解決いたしました。 voidは関係ないと思います。 どうやら、ファイル名と関数名が一致した場合、コンパイルに失敗するようです。ファイル名がimport_testだとすると、関数名は import_test123などとしないといけないようです。 MT4をアンインストールしてしまったので、すぐに確認できませんが、たしか、MQL4にはそんな制約はなかったはずです。 これは MQL5のバグだと思います。 新しいコメント 取引の機会を逃しています。 無料取引アプリ 8千を超えるシグナルをコピー 金融ニュースで金融マーケットを探索 新規登録 ログイン スペースを含まないラテン文字 このメールにパスワードが送信されます エラーが発生しました Googleでログイン WebサイトポリシーおよびMQL5.COM利用規約に同意します。 新規登録 MQL5.com WebサイトへのログインにCookieの使用を許可します。 ログインするには、ブラウザで必要な設定を有効にしてください。 ログイン/パスワードをお忘れですか? Googleでログイン
下に日本語あります。
Hi, everyone!
The code of Libraries\import_test.mq5 is as below.
And the code of Indicators\TEST.mq5 is as below.
I compiled each code.
There is no problem in compiling import_test.mq5.
After I got import_test.ex5, I tried to compile TEST.mq5.
Then I had a error.
The error massage is : ')' - undeclared identifier.
And the message is given to 15th line of TEST.mq5, namely 'import_test();' which is inside OnInit function.
Why the compiling is failed?
I never had such problem while using MT4 and MQL4.
I read MQL5 Reference, but I can't find out big difference between MQL5 and MQL4 with using #import.
日本語と英語でフォーラムが分かれているのに気が付きませんでした。
上のコードがライブラリ内にあり、下のコードがIndicatorフォルダの中にあるのですが、#importをつかってインポートできません。
MQL4を使用したときには、問題なくインポートは使えていて、MQL5のリファレンスを読んでも、#importの使い方については、ほとんど変わりがないように思えます。
なぜ、うまくいかないのでしょうか?