[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 377

 
Zhunko:

All scripts and advisors work in their own threads. Trade orders from them are collected in a separate queue. Then, they are distributed to free trade streams. The number of free trade threads can be equal to 8.

Print() outputs what is available for output at the moment of output. The presence of multiple threads can be determined through the log. The output is displayed at the very beginning of the start() function and at the very end. Put a delay between them. Run several Expert Advisors on different tools. Look at the log. You can see that between the outputs of one Expert Advisor there will be outputs of other Expert Advisors.

I.e., answering Arles' question, if one Expert Advisor has registered orders and "took a nap" for a while, at this moment another EA will place an order (enter a deal at the market) that has not crossed the limit of allocated funds (let's assume 80% of deposit - both EAs will have this size). And when the 1st one resumes the work (and the money management terminal has already been calculated the day before), he/she will also open a deal exceeding the limits set by the Expert Advisor?

If this system (hypothetically) is multiplied by several EAs, then may there be one where the Risk-Management will be in a critical system?

Do I understand this multithreading correctly? - If so, it is certainly a mess from a financial point of view. But, as the probability of this happening is low in small accounts, this is only hypothetical. And on larger accounts, they will probably write something themselves. But still, does it turn out to be the case?

And I have a question - is this the official position or is it just speculation and experiments like mine?
 
Chiripaha:

I.e. answering Arles' question, if one EA has made accounting of orders and "took a nap" for a while, at that moment another EA has not exceeded the limit of allocated funds (let us assume 80% of deposit - both EAs will have such size) and will place an order (enter a deal at the market). And when the 1st one resumes the work (and the money management terminal has already been calculated the day before), he/she will also open a deal exceeding the limits set by the Expert Advisor?

If this system (hypothetically) is multiplied by several Expert Advisors, then may there be one where the Risk-Management will be in a critical system?

Do I understand this multithreading correctly? - If so, then it is certainly a mess from the financial point of view. But since the probability is low in small accounts, it's only hypothetical. And on larger accounts, they will probably write something themselves. But still, does it turn out to be the case?

And I have a question - is this the official position or is it just speculation and experience like mine?

Do you know anything about synchronization?

MQL4 has a function for synchronization at atomic level.

 
Zhunko:

Do you know anything about synchronisation?

MQL4 has a function for synchronisation at atomic level.


Vadim, have you tried it? It does not synchronize anything. I have been playing with it recently. You have to build the queue yourself. Unfortunately, all it does is reduce the code by three lines. Or maybe I don't understand it.
 
I.e. simply applying this function ensures that only one EA is running at a time, but the queue is not lined up, one EA can be idle and the other can be called twice.
 
Zhunko:

Do you know anything about synchronisation?

MQL4 has a function for synchronization at atomic level.

Thanks for the link - now I have an idea how to organize this multithreading more efficiently. Although it's just a guess - I don't see a solution so far (in the sense of the current issue resolution). And adds Igor's position about "semaphore".

Nevertheless - it is you who have completed another model. Where these processes are lined up, allegedly (I have doubts), in a coherent way.

And I'm trying to answer Arles' question and now mine - in that model which I've described above. You, after all, have evaded answering my question. In this model you get a Risk-Management mismatch.

I don't know about synchronization. I'm new to programming. But, on the other hand, I am good at counting money, i.e. I am good with finances. : ))

And my financial skills tell me that "the music can stop playing..." (from Margin Call) with this approach. : ))
 
Integer:

Vadim, have you tried applying it? It doesn't sync anything. I've been playing with it recently. You have to build the queue yourself. Unfortunately, all it does is reduce the code by three lines. Or maybe I don't understand it.
Just in line with my doubts...
 

I'll tell you (exactly in this form) so! (I'm asking you to take it as a joke).

My experiments, in spite of all suggestions to check multithreading, show that as long as I don't swap the blocks in the charts, it doesn't work at all. As soon as I switched them all at once all questions are gone.

I will therefore proceed in my creations on the basis of this postulate for the time being.

And the fact that the Risk-Management may "go bust" not on my will - thank you, Vadim, that you have shown it and drawn attention to it. It will help to avoid such a situation. Well, to those who know about it.

 

Good day! The line e is ok, can you tell me how to do this?

//Comment("OrdersProfit  ",OrdersProfit(),"AccountBalance  ",AccountBalance(),"Equity  ",AccountEquity());
 
Dimka-novitsek:

Good day! The line e is ok, can you tell me how to do this?


Comment("OrdersProfit ",OrdersProfit(), "AccountBalance ",AccountBalance(), "Equity ",AccountEquity());

Such errors are easily seen in the editor when compiling.

 
Thanks!!!!!! It was referring to a function in general... I don't know how I wrote it that way!
Reason: