[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 391

 
Integer:


1. You're stuck. Once again. The system has no way of knowing if a flow has been idle or if it has performed an action.

The system doesn't need to know that. It is the thread's problem. It will be handled either way. It is guaranteed by the system. Unless, of course, you stop it yourself with some bug in the code.
 
Zhunko:
The system doesn't need to know that. It is a flow problem. It will be handled either way. It is guaranteed by the system. Unless, of course, you stop it yourself with some bug in the code.


It's been clear for a long time that you don't know what you're talking about at all.
 

Junko, why are you even trying to make a point here... and you don't even know what you're talking about. You want the system, you don't want the system... You don't even know what you're talking about. It's about solving the problem that was previously outlined... and now you're going to start saying it's not necessary... You've already said there shouldn't be such a task. You go around in your head and you don't realize it, and you put yourself in the role of a guru.

 
It's not the flow that matters, it's what it does, which it doesn't always do. And you have to steer what it does.
 
Integer:
It's not the thread that matters but what it does and it doesn't do it all the time. And you have to manage what it does.

I wrotehere:

Zhunko:

There is another case where a queue is needed. But not a queue of threads' execution, but an order of processing data received from threads (results of threads' work). This is the most frequent task for queues.

This?

 
Zhunko:

Writtenhere:

This?

Roughly similar. But before that there were statements such that the order is not important at all. And here it was generally stated when not only tasks must be performed evenly, but also in a certain sequence (if not perform, but to collect data for further processing, or else you get to the inaccuracy of statements). Now it's your turn to answer - I know I did... then what's been going on for the last 10 pages?
 
Please advise, is it normal when you run 1 time per year of history (300-400 trades) tester creates a log file that weighs up to a gigabyte... ?
 
lottamer:
Please advise, is it normal when you run 1 time per year of history (300-400 trades) tester creates a log file that weighs up to a gigabyte... ?

Basically it's ok :) Not so normal or not normal, it just does that, that's all. Look at what it says, if error messages, you need to take some action with these errors. If any information messages - you need to disable them (if there is a switch) or comment out calls to functions Print()(), Comment(), Alert().
 
Integer:

Roughly the same. However, before that there were statements such that the order is not important at all. And here it's more important, when not only tasks must be executed evenly, but also in a certain sequence (if not to execute, but to collect data for further processing, otherwise you may get confused with inaccuracy of statements). Now it's your turn to answer - I know I did... then what's been going on for the last 10 pages?

What happened was from a lack of explanation on your part. Wrote back on page 381. If you had read my reply you would have noticed and said.

===================

1. There are several independent threads.

2. The results are stacked in some queue.

3. This queue is a shared resource.

4. You need to synchronize threads' access to the shared result queue.

Right?

===================

This is how it should work correctly without removing the global variable:

#property show_inputs

extern int Pause = 1000;

int    hwndChart = NULL; // Уникальный идентификатор скрипта.
string sName = "Condition";

void init()
 {
  hwndChart = WindowHandle(Symbol(), 0);
  // Создаём глобальную переменную синхронизации скриптов.
  if (!GlobalVariableCheck(sName)) GlobalVariableSet(sName, 0);
 }
 
void deinit()
 {
  while (!IsStopped())
   {
    if (!GlobalVariableSetOnCondition(sName, hwndChart, 0)) continue;
    if (GlobalVariableSetOnCondition(sName, 0, hwndChart)) return;
   }
 }

void start()
 {
  while (!IsStopped())
   {
    Sleep(200); // Имитация тика.
    // Начало блока синхронизации.
    if (!GlobalVariableSetOnCondition(sName, hwndChart, 0)) continue;
    if (GlobalVariableGet(sName) == hwndChart)
     {
      Print("Start");
      Sleep(Pause); // Имитация работы.
      Print("End");
     }
    GlobalVariableSetOnCondition(sName, 0, hwndChart);
   } // Завершение блока синхронизации.
 }

Chiripaha:

This...

I think Arles has figured out the answer to the question, as I'm not immediately able to grasp the gist of the solution yet. But that's because I'm a beginner and I need more time to learn the theory first and then try the practice. But I will try to master the matter.


Right, by unresolved question I meant exactly this list of questions.

................

====================================

I mean, in other words. - If there is no block of solution suggested by you in the EA, then using a lot of such EAs may cause the situation described in the question about Risk-Management?

Let me explain a little bit more. I am not sure that it is too critical. Therefore I have considered it hepothetically so far. Because the speed of solving problems is high and probably the solutions in the computer will "fly through" the wide bitrate channel of the computer. - But maybe I'm wrong about that, because according to Arles - he gets just 2 orders per round. So there is a problem.

Only now I understood the question :-))

If this happens, it's a problem with the wrong risk. There is no need to synchronise anything if the risk is low. +-0.0001% of the deposit is not crucial.

 

Zhunko:

Only now understood the question :-))

If this happens, it's a problem with the wrong risk. With low risk there is no need to synchronise anything. +-0.0001% of the deposit is not decisive.

It happens... When a person is in solution of some current problem (issue), it is difficult to switch one's mind to other tasks. And when there are a lot of tasks it is difficult to do everything... : )) Time management rules.

Another question concerning multithreading.

Sergei Kovalev's tutorial describes a method with optimized Squaredness where the Expert Advisor will work in a loop. If we consider this and multi-threading, do I understand correctly that this kind of cyclic behavior of the EA will not cause disadvantages for other EAs, scripts and indicators? And we can safely start the work of the EA in a loop? Or it would be better not to do that? And when it should be avoided?

As far as I understand, this work cycle is implemented in the code above. Perhaps, that is why I remembered it.

And by the way, if such a looped EA is run in tester, how correct it will be? Or should we "turn off" the loop in this case?

Reason: