OpenTrading / OTMql4Py

Open Trading Metatrader 4 Python Integration
GNU Lesser General Public License v3.0
104 stars 49 forks source link

Usage of this bridge #11

Open williamwongys opened 7 years ago

williamwongys commented 7 years ago

Essential information for reporting Issues:

I was looking to call Python from MT4, MT4 will pass a few arrays of doubles to Python which will use the arrays to calculate and return a double back to MT4. MT4 will then draw an indicator using the return value. Can this be done? Is there an example to start with? I installed and tried with a simple script in MT4, it hanged MT4 with access violation:

include <OTMql4/OTPy27.mqh>

int OnStart(){ uchar expr[]; StringToCharArray("a=""a string""",expr); PyInitialize(); int s=PyEvaluate(expr); StringToCharArray("a",expr); s=PyEvaluate(expr); s=PyGetString(s); printf("%s",s);

return(0);

}