FIXME Эта страница пока что не переведена полностью. Пожалуйста, помогите завершить перевод.
(Сотрите это сообщение по окончании перевода.)

Почему Tcl

почему именно tcl был выбран мной для встраивания в платформу MetaTrader.

обновляемая статья, по мотивам (и для) обсуждения на форуме MQL5 :

Briefly, for what it would be desirable to use scripting language inside MQL:

  • simplification and reduction of recording algorithms, rapid prototyping . In a high-level scripting language

algorithms are written very compactly and are quickly developed.

  • overcoming the «problems» of MQL . The language of the platform is focused primarily on interaction with the trading environment

and fast mathematical calculations. Arrays are not first-class entities, but dynamic structures are rather difficult to program. For the sake of justice - it has justifications and partly it is solved by the «Standard Library»

  • Code reuse . Many of the developed would like to be used outside of MetaTrader, and MQL is exclusively

trading platform language

  • Programming the GUI . When I look at how programmers are tormented by developing components that can be displayed

only inside the graph and at the same time programmers calculate the pixels, I want to cry. 2018, the 21st century, trading platform. In any language there are 1-2-3 modern, full-featured, stable framework for user interfaces.

  • Interaction with the «world» - the trader's environment includes DBMS, tables, different data streams, news feeds,

analytical software and so on. You need the means to interact with this

  • I would like to have «glue» for using other means . In order to debug one DLL and one language in one platform,

and all others easily clung to him already. All modern languages ​​have mechanisms for adapting external modules from other languages.

Of course, the solution will have obvious limitations and drawbacks, this too must be immediately understood and accounted for the scope of application:

  • the use of another language entails the use of its infrastructure. Simply speaking, installation is required

this language with its libraries and tools on the computer.

  • programs using DLL:
    • can not be executed on popular «VDS» MetaQuotes
    • can not be used in the «optimizer cloud»

* can not be sold through «market»

Known features of MetaTrader work, which significantly influence the choice of the language for embedding:

  1. There are three types of user programs:
    1. indicators
    2. scripts
    3. experts
  2. each program is a separate entity, works with its own memory and should not affect the work of others
  3. for execution of the program, the platform calls its methods (standard functions) which must be worked out to the end
  4. while indicators of one chart are executed (called) within one system thread associated with the chart
  5. scripts and experts use a separate thread for each chart
  6. MT functions can not be called from the DLL.

the main system requirement follows from this:

«should be able to run several independent instances of the interpreter (or virtual machine language) on 1 system thread.»

and one great wish (to make the impossible possible):

«it is desirable that the language / interpreter has a» continuation «that is, it allows the return of the intermediate result with the preservation of its own state»

To learn a new programming language is not so difficult, the more I have a presentation about their device, and I consistently looked at almost everything. Of course, I had my requirements / wishes for them (with a few explanations):

  1. this should not be an exotic or very new / experimental language.
  2. must have not too big API
  3. The API must provide access directly to the language and data, and not just its console or bath-mode
  4. the language itself must be quite high
  5. have good application libraries
  6. have a suitable license interpreter and libraries, which allows you to use it in freelancing or commercial projects without imposing restrictions on the customer

Forth and Lisp immediately disappeared, the first is too low, the second is so sharply different from MQL that using it is a dissonance. Although anyone who wrote in MQL «translator of arithmetic formulas» or «calculator with brackets» almost realized one of them. depending on the applied method of parsing expressions :-)

C and C ++, such interpreters, for example, Cling ( used in the analysis of CERN data, do not seem to be suitable. Using scripts like C ++ within a C ++-like language will not make the recording of algorithms easier or faster.

Remained the following group of popular languages: Python, Ruby, R, JavaScript, Lua, Tcl