ATcl - Tcl interpreter for MT4 - page 10

 
Is there a possibility to compile a simple third-party code and execute the resulting machine code in the Expert Advisor?
The situation is as follows: there is a function, can be written in C or other similar language, it uses simple mathematical functions, complex third-party libraries are not needed, this function is compiled in the EA and used where necessary, for example, it is one of the strategies that determines the entry and exit condition.
Is it possible to implement this?
Just to make everything happen in the RAM, without creating libraries.
 
Aliaksandr Hryshyn:
Is it possible to compile third party simple code and execute the resulting machine code in the EA?
The situation is as follows: there is a function, can be written in C or similar language, it uses simple mathematical functions, complex third-party libraries are not needed, this function is compiled in the EA and used where necessary, for example, is one of the strategies that determines the entry and exit condition.
Is it possible to implement this?
Just so everything happens in memory, without creating libraries.

There is Critcl on board - on-the-fly compilation and launching of C/C++ modules. It's exactly "compile and run" using the native system compiler, not JIT.

In the demos, there is a simple example of execution of a function written in C.

about using a package, see http://andreas-kupries.github.io/critcl/doc/files/critcl_usingit.html

Quite simply, if you feed something like this into Tcl (ATcl library):

critcl::cproc math {double x double y double z} double { double up = rand () * sin (x); double down = pow(y, log (z)); return up/down; }
it will be compiled at the tcl level and available as a math procedure, which in turn can be called from MQL

cproc commits C and immediately makes an interface to it. ccode just compiles and links (not every C function needs to be pulled up)

PS/ but in the editor/styles on the site glitch :-) the text in the code block is copied, in the editor the formatting is there, when viewing is not :-)

critcl_use - C Runtime In Tcl (CriTcl)
  • andreas-kupries.github.io
This is the section for developers writing, or wishing to write, a package embedding C into Tcl via critcl. I guess that we are allowed to asssume that you, gentle reader, are here because you have written some Tcl code which is not fast enough (any more) and you wish to make it "go faster" by replacing parts (or all) of it with speedy C...
 

Thank you). I use my own interpreter, fairly simple, executes a sequential (no loops) strategy script. I think it could run faster, there could be many more parameters.

 

ATcl is preparing to "combine" with 5,

Released a new version. changes:

- now based on BAWT distribution http://www.bawt.tcl3d.org/ ( more "batteries" there and has office-automation )

- compiler changed from VC to GCC

download from SourceForge:https://sourceforge.net/projects/mt-atcl/

or from the project page:http://luxtrade.tk/atcl:install

or download the attached

 

the 2Mb zip isn't adding up very well.

again, later when the site stops glitching, try to attach it, in a separate message