OpenTrading / OTMql4Lib

Open Trading Metatrader 4 Library
GNU Lesser General Public License v3.0
20 stars 16 forks source link

Runtime is not defined? #1

Closed useless42 closed 9 years ago

useless42 commented 9 years ago

I am using metatrader 4.00(build 840).

OTPyTestNullEA works fine(after commenting out

include <OTMql4/OTLibLog.mql> on line 9

vError on line 17 )

However OTMqlPyTest.mq4 doesn't compile(iPyInit and similar are not defined) unless I import OTMql4/OTLibPy27.mqh. After that it compiles, but quickly fails after dragging it on chart, as shown in the screenshot.

I am not very proficient in mt to understand what is the issue, it seems to be python-related but I installed python and included it into PATH. Should I look into this direction?

Thanks!

OpenTrading commented 9 years ago

OTPyTestNullEA should work fine with no changes - I just tried it now.

You're right about the test scripts in the Scripts directory - I had not updated them to a change in the library naming.

But in general, ignore the Scripts files - they're just little test scripts. The only thing that matters is OTPyTestPikaEA.mq4 in Experts/OTMql4. It should work fine with no changes - I just tried it now, and I use it almost every day.
It's stable with no major changes going on right now.

Try attaching it to a chart and look carefully at the Experts log. In the log, it will say the name of the file in MQL4\Logs where the Python also writes its own log - ignore the beginning verbose information in the log and look for any Traceback error messages. Paste them here if there are any.

The "runtimeerror" in your Experts log is actually the right thing it should say for that test, which is why the message is INFO: not ERROR: The good news is that your Python under Mt4 has been initialized and is running fine, but was intentionally tested with garbage.

I have fixed the Scripts, but what matters is attaching OTPyTestPikaEA.mq4 Update your pulls from github.com and try attaching OTPyTestPikaEA.mq4 If it fails, post the screen shot of the Experts log, and any Traceback from the Python log: Logs/_test_PyTestPikaEA.txt

If it fails you must restart Mt4, and you must remove the EA before you exit: This is a problem that came with build 600+ that you can only load the Python once per session, and it is not loading it right if it starts up with it.

I think I'll remove the Py tests in Scripts because the testing is covered in the EA, and it would be natural for someone to try attaching the scripts and then the EA, which does not work in the same session because of the above problem.

Because of recent changes, you will have to update all 3 projects from github.com: OTMql4AMQ OTMql4Lib and OTMql4Py.

useless42 commented 9 years ago

Thanks a lot for such a detailed reply! I'll try.

useless42 commented 9 years ago

Thanks, it works!

It seems that I can't eval import statements, could you tell me a bit about other major limitations of eval, if there is any?

useless42 commented 9 years ago

(And perhaps you know any workaround for import? I was kind of hoping to use something like sockets :( )

useless42 commented 9 years ago

Nevermind, I found where you have imports and how you use eval() :) Thanks.