Organising the order cycle - page 10

 
Alexey Viktorov:

Who got hurt when an order was re-selected?

Forum on trading, automated trading systems and strategy testing

Organizing an order replay cycle

fxsaber, 2017.10.06 06:26

Can lead to a situation where some ticket will be missed or a ticket through one will be repeated etc.

And it's not even about modification, it's about simple AmountOrders.

 
fxsaber:

Why, if IsChange is five lines?

Not for solving this particular problem. It's for my library - and a lot of issues needed for comfortable program creation are solved there. But in particular it returns the fact of any change in market or historical lists.

 
fxsaber:

And it's not even about modification, it's about simple AmountOrders.

You just don't need to go through the lists from the environment, which are shuffled when the environment changes, but have your own list - it is not shuffled, and it has all (or in excess, but not in deficiency) the tickets you need to close/delete/modify. If they are physically missing, you don't have to start the cycle all over again, just move on to the next one on the list. And that's all - no need to change the loop index or try to repeat the loop somehow. We simply go to our list and try to do what we need. No ticket is in the market - no big deal (you can't return it already) - we go to the next one and do what we want with it. And the timer in turn will correct the list on the next tick.

 
fxsaber:

And it's not even about modification, it's about simple AmountOrders.

Of course it can. Anything can happen, anytime. You're walking, you're walking, everything's fine, and suddenly you slip... There's no safety net for everything. That's why I don't try to write maximally universal functions "for all occasions". So, what does it matter if an order is selected twice for a simple AmountOrders? What is the probability that the order would be manually closed/deleted exactly at the moment of loop execution? Because in the given example, the order is being closed in the same loop. This may be done only as an experiment, but I cannot imagine that we would have to modify the order or do something else and close it immediately...

 
Artyom Trishkin:

You just don't need to go through the lists from the environment which are shuffled when the environment changes, but have your own list - it is not shuffled, and it has all (or in excess, but not in insufficiency) of the tickets you need to close/delete/modify. If they are physically missing, you don't have to start the cycle all over again, just move on to the next one on the list. And that's all - no need to change the loop index or try to repeat the loop somehow. We simply go to our list and try to do what we need. No ticket is in the market - no big deal (you can't return it) - we go to the next one and do what we want with it. And the timer in turn will correct the list on the next tick.

Suppose we want to disable the EA if the number of orders for a given symbol exceeds the specified number. So, how?

 
Alexey Viktorov:

Of course it can. Anything can happen, anytime. You're walking, you're walking, everything's straight, and suddenly you slip... There's no safety net for everything. That's why I don't try to write maximally universal functions "for all occasions". So, what does it matter if an order is selected twice for a simple AmountOrders? What is the probability that the order would be manually closed/deleted exactly at the moment of loop execution? Because in the given example, the order is being closed in the same loop. This may be done only as an experiment, but I cannot imagine that we would have to modify the order or do something else and close it immediately...

Didn't you watch this? Reproducible in no time!

 
fxsaber:

Suppose we want to disable the EA if the number of orders for a given symbol exceeds the specified number. So how?

There - in the timer when writing orders to the list - exceeded - sent an event or raised a flag.

 
Artyom Trishkin:

There - in the timer when writing orders to the list - exceeded - have sent an event or raised a flag.

However, it's best not to do this - everything should be in its place.

In the timer of the Expert Advisor we take the list according to necessary criteria and at list.Total()>xxx we do what we want.

 
fxsaber:

Didn't you watch this? It's playable in no time!

That's exactly what I watched.

    
  // Закрыли позиции
  for (int i = 0; i < Total; i++)
    OrderClose(Tickets[i], 1, SymbolInfoDouble(_Symbol, SYMBOL_BID), 100);
}


And my post

Forum on trading, automated trading systems and testing of trading strategies

How to organize an order loop

Alexey Viktorov, 2017.10.06 08:49

What is the probability of manually closing/deleting an order exactly at the moment of executing the cycle?


And also, what is the deepest sense in real trading to continuously chase the order loop? Most importantly for nothing...

 
Alexey Viktorov:

Also, what is the deeper meaning in real trading of continuously racing through a loop of orders?

In a combat environment this should always be done! So the probability of running into a side closing a position within a cycle is a percentage.

Reason: