AutoGraf Series 4 - MQL features. - page 34

 

If you include the file via include, you can declare extern variables and do not need any parameter passing. To avoid confusion with the names of variables and functions, it is necessary to use different prefixes in the names for each strategy.

Sorry to interfere, but such a long agony over such a simple question does not leave indifferent:)

 
Integer >> :

If you include the file via include, you can declare extern variables and do not need any parameter passing. To avoid confusion with the names of variables and functions, it is necessary to use different prefixes in the names for each strategy.

Sorry, but such long agonies about such simple question don't leave you indifferent:)

>> Thank you. >> We'll give it a try.

 
Integer писал(а) >>

If you include the file via include, you can declare extern variables and do not need any parameter passing. To avoid confusion with the names of variables and functions, it is necessary to use different prefixes in the names for each strategy.

Sorry for interrupting, but such long agonies over such a simple question do not leave you indifferent:)

We are talking about importing functions into compiled EA (ex4).
 
SK. писал(а) >>
We are talking about importing functions into compiled EA (ex4).

I'm sorry, as usual I'm not talking about... How about importing from a compiled library?

-

If the main module is compiled, then it's not a problem to use inculcator with strategy, everything will be compiled. If main module is open source, but strategy is compiled, then you can make an adapter in the form of open source inculdnik.

 

Dear Sirs!

I am considering the following connection chain diagram:



The function AG_AT is a switch to select the strategies to be joined.

 

Ladies and Gentlemen!

Please answer a question.

If the AT function is not a switch, but contains strategy code then (although I understand it makes no difference), how does the application distinguish that the AT function gives an instruction (e.g. referring to the terminal) to it, rather than trading itself?

From the description of the application:

Исполнение функции АТ связано с двумя основными возможностями.

The first is that the AT function can trade on its own - generate trade orders and send them to the server. At the same time, the function cannot process any data received from the application (or process a part of such data), but it can perform its own calculations using all the capabilities of MQL4, including calling the terminal for processing the orders, getting current quotes, calculating trading criteria, managing graphical objects, etc.

The second feature is directly connected with the AutoGraf 4 application. This function can instruct the AutoGraf 4 application to install any necessary instruments with preset settings on specific orders or a price chart, change the application's general settings, delete instruments, display messages to the user, etc. (output parameters). (output parameters).

If the AT function has generated a trade order and there is no line of code to account for in the application, then it trades itself. The application, in this case, simply broadcasts the order to the terminal without any accounting or processing.

If there is, then the order goes through the application in the AT function parameters passed through the link.

Do I understand this correctly?

 
Integer писал(а) >>

I'm sorry, that's not what I meant, as usual... How about importing from a compiled library?

-

If the main module is compiled, then it's not a problem to use inculcator with strategy, everything will be compiled. If the main module is open source, but strategy is compiled, then you can make an adapter in the form of open source inculcator.

Nothing to apologize for, the discussion is on point.

--

A bit of terminology. There are two mirror concepts - export and import. They are used in relation to our own territory.

Exports are from us outside our borders. For example, gas exports from Russia to Europe.

Import is from abroad into our borders. For example, importing sand into Siberia from Africa.

In this case we are talking about imports. Our territory here is expert AG_exp.ex4. This is the basis of the AutoGraf 4 application that is supplied to the user as a compiled file. The Expert Advisor source code is not supplied (of course, since the application is distributed commercially, although it is free of charge) and, therefore, no modules can be added to the Expert Advisor via inclide (by user-programmer).

--

The task was to enable the user to attach to the AutoGraf 4 application his/her own trading algorithms written in MQL4 and executed as .ex4 files of strategies. To solve this problem, the Expert Advisor AG_exp.ex4 includes code that imports into the Expert Advisor the function of automatic trading AG_AT that is available both as .ex4 and mq4 files. Further on, the user can decide on his or her own how to arrange the codes. One of two options is the most convenient:

1. To write your own code directly in AG_AT() function and compile AG_AT.mq4 file with the same name, getting AG_AT.eq4.

Пример: http://autograf.dp.ua/Pages/2/26/267/26711/26711_1.htm, примеры 1-15: http://autograf.dp.ua/Pages/2/26/267/2679/2679_1.htm

2. Write your own code for the new function in a separate strategy file, for example, My_Strategy() in file My_Strategy.mq4. Write in AG_AT() the import of the My_Strategy() function from the My_Strategy.eq4 file (modern version). Примеры http://autograf.dp.ua/Pages/2/26/267/26712/26712_1.htm, http://autograf.dp.ua/Pages/2/26/267/26712/26712_2.htm

.

In none of these variants is it possible to write external variables so that they are available to the user. The only possibility to specify external variables is to write them in AG_exp.ex4 during design phase, which is done. The values of the variables are passed in transit through AG_AT() to the user My_Strategy() in the Instrument array. This is the technology adopted in the latest release of AutoGraf 4 and it works fine.

--

What does all this mean to the user? This means that any user can write his own strategy and run it in an AutoGraf 4 environment. At the same time, his own strategy will work and all the features of AutoGraf 4 will be available to the user. In particular, any AutoGraf 4 (!) tools such as pullups, overturns, sounds, etc. can be controlled from the strategy.

For professional programmers, the technology provides the ability to pass a customizable password variable into the strategy file. This means that programmers can write strategies for AutoGraf 4 and distribute them on a commercial basis (e.g. only for a specific account).

 
LeonidSB писал(а) >>

Dear Sirs!

I am considering the following connection chain diagram:

The AG_AT function is a switch to select the strategies to be joined.

Yes. Correct.

 
LeonidSB писал(а) >>

Ladies and Gentlemen!

Please answer a question.

If the AT function is not a switch, but contains a strategy code, then (although I understand it makes no difference), how does the application distinguish that the AT function is giving instructions (e.g., referring to the terminal) to it, rather than trading itself?

The strategy can pass to the application:

- values of common adjustable parameters (SL, TP, Lots, etc.)

- Parameters of instruments to be installed or deleted

The strategy does not transmit orders to open and close orders to the application (this is planned in AG 5 on the basis of MQL 5 capabilities) and currently (in AG 4) this is not strictly required. The strategy can and should open/close orders using the user's own algorithm.

If the AT function generates a trade order and there is no code line to be registered in the application, the strategy will trade by itself. The application, in this case, simply broadcasts the order to the terminal without any accounting or processing.

If there is, the order goes through the application in the AT function parameters passed via link.

Am I understanding this correctly?

It's not very clear what you call "a line of code to be accounted for in the application".

The application accounts for the orders whenever it receives control back. At each iteration of a large cycle, the recalculated array of orders is passed to AG_AT and then to the strategy. Based on the order count, the strategy can calculate the appropriate control actions. The strategy application should be updated more frequently so the strategy always has a fresh array of order bookkeeping.

A trade order from any part of the program (application or AG_AT or a strategy) goes directly to the MT4 terminal and directly to the server. After the execution of the order on the server, the control returns in the same way to the trade order sending point. While the order is being processed on server all is silent and waiting for reply - nothing happens (if I am not mistaken, in MT5 this technology will be changed - we will not wait, we will work:)

 
Thank you!
Reason: