ATcl - Tcl interpreter for MT4 - page 8

 

The script is ready and included into ATcl library.
In the library is located at path Libraries/ATcl/app/mq45dist.tcl

It needs (suddenly) tcl, and zip to work :-)

If you run it without parameters, it will ask to select any project file and open a console to display the log.

If you pass the file name as a parameter, it will not open any windows, it will work as a console application.

I am attaching the tcl script.

In addition to adding the script, some bugs were fixed,
and relaunched the library archives at http://nektomk.ru/ru:atcl:install and SourceForge https://sourceforge.net/projects/mt-atcl/

ATcl
  • nektomk.ru
Рад представить вам библиотеку ATcl v1 beta - интерпретатор Tcl для MT4. Расширяте возможности ваших программ MQL, используйте СУБД, дополняйте сетевыми средствами, интегрируйте их с любыми программами используя Tcl.
Files:
 

Another, and easiest (and most pressing) use : configurations of software/experts/panels and stuff. That is, all sorts of configuration files :-)

With ATcl it's very easy to keep it all in simple text files.

# комментарии начинаются с # и идут до конца строки

# именованное значение "use_gui"
set use_gui true

# список (вектор) значений
set vector { 1.0 2.0 0.12 }

# список из список (матрица)

set matrix {
  { 1 2 3 }
  { 4 5 6 }
  { 7 8 9 }
}

# хеш ( ключ->значение)
set option(key1) "например строка"
set option(key2) "другая строка"

# можно сразу

array set option {
   key3 0.21
   another_key { можно задавать произвольные значения }

}

and it is very easy to read it all in MT4:

ATcl *tcl=new ATcl;     // создадим новый интерпретатор (их можно много делать)

tcl.Eval("source MQL4/Files/myconfig.tcl"); // прочесть конфигурацию

bool use_gui = tcl.Long("use_gui",0); // взять переменную "use_gui" как long, или вернуть 0 по умолчанию

double vector[];
tcl.ToArray("vector",vector); // копировать список в массив.

double matrix[][3];
tcl.ToArray("matrix",0,matrix[0]); // читать 1-ю строку матрицы
tcl.ToArray("matrix",1,matrix[1]); // и так далее
tcl.ToArray("matrix",2,matrix[2]);

string option_key1=tcl.String("option(key1)",""); // хеши можно читать указывая полное имя
string option_key2=tcl.String("option","key2",""); // или отдельно ключ, значение

delete tcl; // всё прочитали, интерпретатор больше ненужен

By the way, as a bonus, you can also read the built-in/system environment variables :-)

string APPDATA=tcl.String("env","APPDATA",""); // окружение Windows - %APPDATA%
string TEMP=tcl.String("env","TEMP","");     // рекомендованный каталог для временных файлов %TEMP%

 

Based on a post in the English part of the forum and to explain

"Why all this is needed and why it's the way it is".

Sketched out an article, in my opinion it turns out quite good and useful. Dedicated to the question of why another language might be useful and how it's selected.

First draft of part one - http://nektomk.ru/atcl:why this one goes into the question setting and requirements identification.

If there are any questions, comments, suggestions, I'll answer and add to it :-)

The second part is a discussion of all the languages and systems mentioned. Obviously, it is highly specialised and requires a background

 

I haven't written so many texts in a long time :-) but since I promised and started, I have to do it...

as a continuation of the first part about language selection,

I sketched out the second part of http://nektomk.ru/atcl:whynot where I looked at quite a few systems.

Even people far from ATcl and ideas of extending MQL capabilities may find it useful and not without interest.

It will be published together with the first part in local blogs. Just have a "pause" and reread + correct grammar and turns of speech :-)

update: the first part is also published on local blogs https://www.mql5.com/ru/blogs/post/718610 so you can read it without leaving the site

выбор языка, часть 2
  • nektomk.ru
Взял смелость и в статье объединяю большие «числогрызы» в одну главу. Они не решат наших задач про «взаимодействие с миром», про GUI, и так далее, но они востребованя. На них, с их помощью, благодаря им делаются и отрабатываюся торговые стратегии. Начну с R, так получилось что с практикой его применения в MT знаком очень плотно. Фактически это...
 
Based on correspondence - maximum detailed installation instructions

1. You need to install Tcl 32 bit for Windows

Unfortunately ActiveState recently (a month or two ago) stopped supporting 32 bit and
removed the installer from the available downloads. It had been the most convenient distribution for Windows
and ATcl was developed on it. I haven't tested other distributions yet, I will check it this weekend.

------------------------------
Installing Tcl 32bit on Windows
------------------------------

1.1 BAWT distribution

1.1.1 Download the distribution from import of functions from DLL".
BAWT - Downloads
  • Paul Obermeier
  • www.bawt.tcl3d.org
BAWT - Build Automation With Tcl
 

Good afternoon interested in your project, but there is a problem with MT4 deleting both EAs and indicators, could you please advise what the possible reason is.

 
kovtynmen:

Good afternoon interested in your project, but there is a problem with MT4 deleting both EAs and indicators, could you please advise what the possible reason is.

I do not understand the problem ;-)

what do you mean "it removes both EAs and indicators" ?

 
Maxim Kuznetsov:

I don't understand the problem ;-)

what does it mean "delete both EAs and indicators" ? explain the point, if you can with screenshots

Yeah sure, here are the log screenshots

Expert TradePanel

Custom indicator CawtExcel

 
kovtynmen:

Yes of course, here are the log screenshots


1. when you run the Expert Advisor/indicator, make sure you enabled import from DLL

2. In the previous instruction it is highlighted - if you have installed the BAWT distribution, you need to copy tcl86.dll to tcl86t.dll in the c:/tcl/bin directory, i.e. add the letter t to the dll name

there should be no other problems, except for allowing to use DLL in terminal and distributor DLL name - just on clean VDS, put MT4, put BAWT and ATcl library from sourceforge (not "variant-in-development", but publicly available). Flight is normal

 
Maxim Kuznetsov:

1. when you run EA/indicator make sure that import from DLL is enabled

2. In the previous instruction it is highlighted - if you have the BAWT distribution, you need to copy tcl86.dll to tcl86t.dll in the c:/tcl/bin directory, i.e. add the letter t to the dll name

there should be no other problems, except for allowing to use DLL in terminal and distributor DLL name - just on clean VDS, put MT4, put BAWT and ATcl library from sourceforge (not "variant-in-development", but publicly available). Flight is ok

Thanks, already tried and tested all this and the result is the same. I will try everything again tomorrow along with mt4. Although there is a possibility that it might be something with access rights on win 10.
Reason: