Библиотеки: mt-R - страница 2

 

У меня так же наблюдается эта проблема с MT5 - библиотека работает только в скриптах, а советники вылетают с ошибкой сразу после вызова RInit.

Билд - 1643

 

В МТ5 - 1653 - Win7х64 все работает в т.ч. в советнике.

И основная версия и версия от DR. Trader, она лучше тем, что не выдает сообщений об ошибке "не своего терминала". Возможно ее лучше поместить в качестве основной.

 
Внимание!
RGetVector не может принять из R более 100000 элементов. Пришлось полный массив запрашивать кусками (по 50000) и потом склеивать.
 

Внимание!
В файле R.mqh имена переменных vector и matrix стали выдавать ошибку при компиляции. Переименуйте их в другие и все будет работать. Я использовал vectr и matr.

Редактор подсвечивает эти слова синим, как тип данных наподобие int, double. Видимо зарезервировали слова под новые типы.

 

Описание всех функций (скопировал из предыдущей версии https://www.mql5.com/en/code/11112)

   /**
   * Return the dll version. The upper 16 bit of the return value
   * are the major version and the lower 16 bit the minor. This
   * is used in RInit() to make sure that this header file and
   * zzthe dll fit together.
   */
int RGetDllVersion();

   /**
   * This is not meant to be called directly, it will be
   * called by RInit() after the successful version check.
   * You should call RInit() to start a new R session.
   */
long RInit_(string commandline,int debuglevel);

   /**
   * Teminate the R session. Call this in your deinit() function.
   * After this the handle is no longer valid.
   */
void RDeinit(long rhandle);
   
   /**
   * return true if the R session belonging to this handle is
   * still runing. R will terminate on any fatal error in the
   * code you send it. You should check this at the beginning
   * of your start function and stop all actions. The last
   * command prior to the crash will be found in the log.
   * If R is not running anymore this library won't emit any
   * more log messages and will silently ignore all commands.
   */
bool RIsRunning(long rhandle);

   /**
   * return true if R is still executing a command (resulting
   * from a call to RExecuteAsync())
   */
bool RIsBusy(long rhandle);

   /**
   * execute code and do not wait. Any subsequent call however
   * will wait since there can only be one thread executing at
   * any given time. Use RIsBusy() to check whether it is finished
   */
void RExecuteAsync(long rhandle,string code);
   
   /**
   * execute code and wait until it is finished. This will not
   * return anything. You can basically achieve the same with
   * the RGet*() functions, evaluating the expression is also
   * just executig code, the only difference is that these
   * RGet*() functions will additionally try to parse and return
   * the output while RExecute() will just execute, wait and
   * ignore all output.
   */
void RExecute(long rhandle,string code);
   
   /**
   * assign a bool to the variable name. In R this type is called "logical"
   */
void RAssignBool(long rhandle,string variable,bool value);
   
   /**
   * assign an integer to the variable name.
   */
void RAssignInteger(long rhandle,string variable,int value);
   
   /**
   * assign a double to the variable name.
   */
void RAssignDouble(long rhandle,string variable,double value);
   
   /**
   * assign a string to the variable namd. In R this type is called "character"
   */
void RAssignString(long rhandle,string variable,string value);
   
   /**
   * assign a vector to the variable name. If the size does not match
   * your actual array size then bad things might happen.
   */
void RAssignVector(long rhandle,string variable,double &vectr[],int size);
   
   /**
   * assign a vector of character (an array of strings) to the variable. If you need
   * a factor then you should execute code to convert it after this command. In
   * recent versions of R a vector of strings does not need any more memory than
   * a factor and it is easier to append new elements to it.
   */
void RAssignStringVector(long rhandle,string variable,string &vectr[],int size);
   
   /**
   * assign a matrix to the variable name. The matrix must have the row number as the
   * first dimension (byrow=TRUE will be used on the raw data). This function is much
   * faster than building a huge matrix (hundreds of rows) from scratch by appending
   * new rows at the end with RRowBindVector() for every row. This function is optimized
   * for huge throughput with a single function call through using file-IO with the
   * raw binary data. For very small matrices and vectors with only a handful of elements
   * this might be too much overhead and the other functions will be faster. Once you
   * have the matrix with possibly thousands of rows transferred to R you should then
   * only use RRowBindVector() to further grow it slowly on the arrival of single new
   * data vectors instead of always sending a new copy of the entire matrix.
   */
void RAssignMatrix(long rhandle,string variable,double &matr[],int rows,int cols);
   
   /**
   * append a row to a matrix or dataframe. This will exexute
   * variable <- rbind(variable, vector)
   * if the size does not match the actual array size bad things might happen.
   */
void RAppendMatrixRow(long rhandle,string variable,double &vectr[],int size);
   
   /**
   * return true if the variable exists, false otherwise.
   */
bool RExists(long rhandle,string variable);
   
   /**
   * evaluate expression and return a bool. Expression can be any R code
   * that will evaluate to logical. If it is a vector of logical then only
   * the first element is returned.
   */
bool RGetBool(long rhandle,string expression);
   
   /**
   * evaluate expression and return an integer. Expression can be any R code
   * that will evaluate to an integer. If it is a floating point it will be
   * rounded, if it is a vector then only the first element will be returned.
   */
int RGetInteger(long rhandle,string expression);
   
   /**
   * evaluate expression and return a double. Expression can be any R code
   * that will evaluate to a floating point number, if it is a vector then
   * only the first element is returned.
   */
double RGetDouble(long rhandle,string expression);
   
   /**
   * evaluate expression and return a vector of doubles. Expression can
   * be anything that evaluates to a vector of floating point numbers.
   * Return value is the number of elements that could be copied into the
   * array. It will never be bigger than size but might be smaller.
   * warnings are output on debuglevel 1 if the sizes don't match.
   * >>> Limited to 100000 elements
   */
int RGetVector(long rhandle,string expression,double &vectr[],int size);
   
   /**
   * do a print(expression) for debugging purposes. The outout will be
   * sent to the debug monitor on debuglevel 0.
   */
void RPrint(long rhandle,string expression);

mt4R for new MQL4
mt4R for new MQL4
  • www.mql5.com
mt4R, modified for supporting new MQL4
Причина обращения: