Library for MQL5 (MetaTrader) with support for Spark
|
Class for PythonDLL.dll.
Public Member Functions | |
CPythonDLL () | |
bool | initialize (const string python_home, const bool console=false) |
bool | isInitialized () |
Check the active environment of Python. More... | |
void | finalize () |
It is not necessary to use this function, because it is always called when a test is completed or MetaTrader is closed. More... | |
bool | eval (const string pycode, const bool override_class=false) |
Compiling and executing code. More... | |
bool | isError (const bool clear=true) |
Checks for errors. More... | |
string | getErrorText () |
Checks for errors, gets text and clears the error. More... | |
int | getLong (const long magic, const long value, const long &inputs[], long &outputs[], const int inputs_size=WHOLE_ARRAY, const int outputs_size=WHOLE_ARRAY) |
Calls the mql.getLong() function with the data passed. More... | |
int | getULong (const long magic, const ulong value, const ulong &inputs[], ulong &outputs[], const int inputs_size=WHOLE_ARRAY, const int outputs_size=WHOLE_ARRAY) |
Calls the mql.getULong() function with the data passed. More... | |
int | getDouble (const long magic, const double value, const double &inputs[], double &outputs[], const int inputs_size=WHOLE_ARRAY, const int outputs_size=WHOLE_ARRAY) |
Calls the mql.getDouble() function with the data passed. More... | |
string | getString (const long magic, const string value, const uchar &inputs[], const int inputs_size=WHOLE_ARRAY) |
Calls the mql.getString() function with the data passed. More... | |
int | getString (const long magic, const string value, const uchar &inputs[], string &buffer, const int inputs_size=WHOLE_ARRAY, const int stringBufferLen=WHOLE_ARRAY) |
Calls the mql.getString() function with the data passed. More... | |
Protected Attributes | |
string | bufstr |
CPythonDLL::CPythonDLL | ( | ) |
bool CPythonDLL::eval | ( | const string | pycode, |
const bool | override_class = false |
||
) |
Compiling and executing code.
[in] | pycode | |
[in] | override_class | when changing the variable mql, set to true. |
void CPythonDLL::finalize | ( | ) |
It is not necessary to use this function, because it is always called when a test is completed or MetaTrader is closed.
int CPythonDLL::getDouble | ( | const long | magic, |
const double | value, | ||
const double & | inputs[], | ||
double & | outputs[], | ||
const int | inputs_size = WHOLE_ARRAY , |
||
const int | outputs_size = WHOLE_ARRAY |
||
) |
Calls the mql.getDouble() function with the data passed.
The error is automatically displayed in the log.
[in] | magic | |
[in] | value | |
[in] | inputs | |
[out] | outputs | array size will not change. |
[in] | inputs_size | |
[in] | outputs_size |
string CPythonDLL::getErrorText | ( | ) |
Checks for errors, gets text and clears the error.
int CPythonDLL::getLong | ( | const long | magic, |
const long | value, | ||
const long & | inputs[], | ||
long & | outputs[], | ||
const int | inputs_size = WHOLE_ARRAY , |
||
const int | outputs_size = WHOLE_ARRAY |
||
) |
Calls the mql.getLong() function with the data passed.
The error is automatically displayed in the log.
[in] | magic | |
[in] | value | |
[in] | inputs | |
[out] | outputs | array size will not change. |
[in] | inputs_size | |
[in] | outputs_size |
string CPythonDLL::getString | ( | const long | magic, |
const string | value, | ||
const uchar & | inputs[], | ||
const int | inputs_size = WHOLE_ARRAY |
||
) |
Calls the mql.getString() function with the data passed.
The error is automatically displayed in the log.
[in] | magic | |
[in] | value | |
[in] | inputs | |
[in] | inputs_size |
int CPythonDLL::getString | ( | const long | magic, |
const string | value, | ||
const uchar & | inputs[], | ||
string & | buffer, | ||
const int | inputs_size = WHOLE_ARRAY , |
||
const int | stringBufferLen = WHOLE_ARRAY |
||
) |
Calls the mql.getString() function with the data passed.
The error is automatically displayed in the log.
[in] | magic | |
[in] | value | |
[in] | inputs | |
[out] | buffer | |
[in] | inputs_size | |
[in] | stringBufferLen | use StringBufferLen(buffer) |
int CPythonDLL::getULong | ( | const long | magic, |
const ulong | value, | ||
const ulong & | inputs[], | ||
ulong & | outputs[], | ||
const int | inputs_size = WHOLE_ARRAY , |
||
const int | outputs_size = WHOLE_ARRAY |
||
) |
Calls the mql.getULong() function with the data passed.
The error is automatically displayed in the log.
[in] | magic | |
[in] | value | |
[in] | inputs | |
[out] | outputs | array size will not change. |
[in] | inputs_size | |
[in] | outputs_size |
bool CPythonDLL::initialize | ( | const string | python_home, |
const bool | console = false |
||
) |
Attempt to create a Python environment.
* If python_home is set incorrectly, the terminal will be destroyed.
@param[in] python_home path to the environment of Python. @param[in] console show console window. @return Py_NewInterpreter() != NULL
bool CPythonDLL::isError | ( | const bool | clear = true | ) |
Checks for errors.
To get an error message, use getErrorText().
[in] | clear | clears the error. |
bool CPythonDLL::isInitialized | ( | ) |
Check the active environment of Python.
|
protected |