Exchanging data between two EAs running in different terminals

 

This thread is a technical continuation of the "NFA ban on locking from 15 May 2009" thread.

In particular, starting with this post:

'NFA bans locking from 15 May 2009'

solandr 26.04.2009 12:06

2. If you have an American brokerage account you will divide it into 2 separate accounts of equal size. On one account all positions for all instruments will be BUY only, on the other one all positions for all instruments will be SELL only. This rule is not violated when hedging is prohibited on one account, because we have 2 accounts. Then we need to work out a method of distributing positions of the only Expert Advisor on these 2 different accounts. Since this has not been my previous task, I would like to know what methods are available for accurate execution of orders of one Expert Advisor on 2 different accounts?

I would like to discuss the technical implementation of data exchange between two EAs working in different terminals.

I believe the most promising direction for discussion is the transfer of information between EAs using a shared memory space, but any other options can be discussed.

That is, each of the Expert Advisors needs to have the full information about the orders from the other terminal. How to arrange this?

I would like to ask only technical details to be discussed in this thread. Thank you in advance!

 
All the technical details as well as the implementation of the algorithm have long been described. Use the search.
 
HIDDEN >> :
All the technical details as well as the implementation of the algorithm have long been described. Use the search.

Do you mean this article or something else?

'Automated selection of DCs for efficient expert work'.

 
 

For your task, using the toolkit described in the article on automated DC selection is a shot in the dark. Without any dlls, you can get by with just files.

 

The use of sqllite3 by one of the terminals suggests that this is one of the easiest ways.

And, for developers, it would be a good idea to load all the terminal information into this database.

Then with usual functions we'll have access to reading more structured information...

For example, now it is a non-trivial task to analyze logs for estimating, for example, quality of position opening.

*

Sorry if I'm off-topic...

*

If we're talking about DB, I'm looking for ways that may help during exchange between accounts,

how to write and read the same database cells?

That is, for their purposes, we start a table , and in her fields, let's call conditionally A, B, C, D, with one row.

Schematically, it's like this:


A
B
C
E
data
123
1.2548
12.04.2009
buy
 
solandr >> :

This thread is a technical continuation of the "NFA ban on locking from 15 May 2009" thread.

In particular, starting with this post:

'NFA bans locking from 15 May 2009'

solandr 26.04.2009 12:06

2. If you have an American brokerage account you will divide it into 2 separate accounts of equal size. On one account all positions for all instruments will be BUY only, on the other one all positions for all instruments will be SELL only. This rule is not violated when hedging is prohibited on one account, because we have 2 accounts. Then we need a method to distribute trades of the only Expert Advisor among these 2 different accounts. Since this has not been my previous task, I would like to know what methods are available for accurate execution of orders of one Expert Advisor on 2 different accounts?

I would like to discuss the technical implementation of data exchange between two EAs working in different terminals.

I believe the most promising direction for discussion is the transfer of information between EAs using a shared memory space, but any other options can be discussed.

That is, each of the Expert Advisors needs to have the full information about the orders from the other terminal. How to arrange this?

I would like to ask only technical details to be discussed in this thread. Thank you in advance!

I have several ideas

1-file exchange

2- it is possible to use various windows event methods

3 via TCP/IP


File sharing is simpler in terms of complexity


you have to be careful with file sharing

Access to the same file by different programs must be properly separated

In any case, you need a good idea of how file sharing works.

 
kombat >> :


If we are talking about mysql, then I am looking for ways that may also be useful for exchanging between accounts,

how to write and read the same cells in a database?


Elementary, Watson. Through SQL queries.

 
Reshetov >> :

It's elementary, Watson. Via SQL queries.

Thank you, Holmes! ;)))

The only problem is how to do it...

I, for example, have not yet succumbed to this task.

(though I only work on it occasionally).

*

If seriously, the problem is to make a read/write request by specific table coordinates.

 
kombat >> :

Thanks, Holmes! ;)))

The only problem is how to do it...

I, for example, have not yet succumbed to this task.

(though I only work on it occasionally).

*

Seriously, the problem is making a read/write query for specific table coordinates.


SQL can do it too

there's a problem... how do the two EA's know to mess with the SQL?

they will have to use a monitor in both Expert Advisors that will use a quantum of time to look into SQL to see if the EA has "written" something

Similarly with file exchange ! You have to go through the same trouble - with every quantum of time you go to the file

if something has changed, if a friend who trades on another account has reported something


--

it is more resource saving and better to use an event

event occurs - kick!

if an event has not arisen - do not kick!

each expert may have the "urge" to tell his friend about his intentions

this will be the event... that's how he kicks his sleeping friend

windows is an event driven operating system - better to go in that direction

--

 

In principle, it is more than enough for me to check/record a file at regular intervals.

As for file access, a colleague suggested the following idea to me. While writing to a file, we call it something like file.running. As soon as we finish writing into it, we rename it to file.output. After the file is read by the second Expert Advisor , delete the file. Thus we let the first Expert Advisor know that we can write a new file with the passed information during the next operation cycle of the first EA (after a certain quantum of time). Perhaps, for the security of access separation, we could use some flags.


I have seen some examples of using TCP/IP when data is sent over localhost 127.0.0.1 on some port. Each Expert Advisor knows the port of another and transmits data to it. At the same time it listens on its own port to intercept data from other Expert Advisor. I have an example of how this can be done in VB script. I do not know how it can be implemented in an EA.

Are there any ready examples of how to send data through TCP/IP for Expert Advisors?

Reason: