With what to replace OnTradeTransaction() in mql4? - page 7

 
Alexey Viktorov:

In that case, it would be hard to live without Artem's library.

Will the library telepathically learn the information it needs? It will be shaking orders 86400 times just the same.

 
Igor Makanu:

what to do with "do not add to array" - I mean deleting data on missing market orders?

But to avoid overloading the code with calculations, we should at least set an event flagOnTradeTransaction, that should be raised when placing or forcibly closing an order - you know what kind of operation you want to do, don't you? - Why not tell the machine about it directly? instead of trying to make the machine run all the data every tick / or every 10 ms


ZS: another thread with a request for a solution to a problem in the absence of any knowledge base, nothing personal, but this is already becoming a regular occurrence - no matter how you look at it, you need to study additional material, just discussing the problem with like-minded people is just discussing the problem with like-minded people at the same level of knowledge ((((

With "don't add to array"... Although there is no ArrayRemove() function in mql4, but its principle is based on copying an array into itself with further reduction of size by the number of deleted indexes. And instead of OnTradeTRansaction() I have repeatedly said in this thread that there is no alternative to Artem's library and is not expected.
 
Igor Makanu:

I should at least make a flag ofOnTradeTransaction event which should be set when placing or forcibly closing an order

I thought about it, but different EAs have different functions and nobody will combine them.

 
Aleksandr Volotko:

Will the library telepathically find out the information it needs? It will shake orders 86400 times just like that.

You can find this out in the discussion thread of the article. And I'm not the one who will be answering. I only tried to use it... And start by re-reading Artem's posts. Pay attention to this message.

Forum on trading, automated trading systems and strategy testing

How to replace OnTradeTransaction() in mql4?

the properties of orders and positions. The symbol is encoded into the sum of the character codes that make up its name. But then only full cycle. When hash sum is changed - see what happened.


 
Aleksandr Volotko:

Yes, I thought about it, but different EAs have different functions and no one will combine them, you can write a file-flag in sammon, I may even do so, why not look for an alternative?

here's an alternativehttps://www.mql5.com/ru/docs/standardlibrary/datastructures

or use the material from Artem's articles, which, however, will still rely on SB "Data Collections"


No matter how you look at it, but the new material will have to be studied to at least understand the capabilities of MQL, and just sitting in a 10 year old array and reducing the analysis time OrderTotal() .... will not solve the current problem and new problems in the future anyway


If we are talking about several EAs and data exchange - order placing flag, etc., then there is no universal solution - there are many variations on this subject; in general this is a sore point for me, I have used a lot of ready-made tools but got no success, I'd rather use a DB server and exchange data through it, it will certainly be reliable and practical, unfortunately MT developers have ignored this problem for many years based on their understanding of the functionality needed by users

 
Alexey Viktorov:

You can find that out in the discussion thread of the article. And I'm not the one who will be answering. I only tried to use it... And start by re-reading Artem's posts. Pay attention to this message.

All of this leads to order overshooting, and you don't want to do that 100500 times a day. And it doesn't matter - I will count aggregate position volume in a loop, or the library hash sum of order properties.

 
Igor Makanu:

the alternative ishttps://www.mql5.com/ru/docs/standardlibrary/datastructures

or use the material from Artem's articles, which, by the way, will still rely on "Data Collections".


No matter how you look at it, but the new material will have to be studied to at least understand the capabilities of MQL, and just sitting in a 10 year old array and reducing the analysis time OrderTotal() .... will not solve the current problem and new problems in the future anyway

Don't think I'm completely dumb, it's just that sometimes you only have to work with what's available, and there's very little available to use

 
Vitaly Muzichenko:

How's that?

StringToShortArray()
ShortArrayToString()
 
Artyom Trishkin:
StringToShortArray()
ShortArrayToString()

I guess I'm not smart enough.)

How do I apply this?

static __Total = -1;
int OT=OrdersTotal();
  if(OT!=__Total)
   {
     SetMarket(); // здесь дёргаем текущую ситуацию на счёте и заполняем структуры
     __Total=OrdersTotal(); // запомним количество
   }

I have only one problem and it is very rare, today I found it for the first time in a couple of years, I may have seen it before, I just did not notice it

Forum for trading, automated trading systems and strategy testing

How to replace OnTradeTransaction() in mql4?

Vitaly Muzichenko, 2020.01.27 15:32

I don't know, but I've noticed that one position closed and the other one opened on another one and almost at the same time between the ticks.

In the end OrdersTotal() remained 8. The Expert Advisor's logic got confused - it has not recalculated the new data


 

That's it, the solution is simple: introduce another history change check, that way nothing will be lost and it will work 100%

static __OTotal = -1;
static __HTotal = -1;
int OT=OrdersTotal();
int HT=OrdersHistoryTotal();
  if(OT!=__OTotal || HT!=__HTotal) // если изменилось - выполняем
   {
     SetMarket(); // здесь дёргаем текущую ситуацию на счёте и заполняем структуры
     __OTotal=OrdersTotal(); // запомним текущее количество
     __HTotal=OrdersHistoryTotal(); // запомним количество в истории
   }