You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
If I understand you correctly, this is the right way to go. As a more experienced comrade, please advise, for the purpose of catching newborn positions such a filter will work ??? Or maybe there is a better option ???
This is for Alexey - I don't work with OnTradeTransaction() for some reason.
Are you thus suggesting that the other posts be pushed back? Let them go unmentioned? That's not right.
In my opinion, it is better to define a separate section of the forum in which each problem would be a separate topic. The number of topics is much less than the number of posts per topic. So despite the considerable number of topics, they won't get pushed back as far as individual issues and bug reports are pushed back now.
Well, you highlighted in red that you don't know. What was the problem? How did it manifest itself? And what was the new method?
As for reporting bugs: "right or wrong", but if you want to report it, you will. And if you don't want to, you don't want to. And to shut yourself off like "letting people talk about their own" is an excuse.
If I understand you correctly, this is the right way to go. As a more experienced comrade, please advise, for the purpose of catching newborn positions such a filter will work ??? Or maybe there is a more correct option ???
In my opinion, this line
unnecessary. And in general, I am currently reconsidering OnTradeTransaction operation for the following variant
At the moment of adding of a deal we don't have a ticket of the order which generated the deal. But if we need a ticket for the order and its properties, as I now need the opening price of the order not to disable grid step because of slippage, then it is the best variant. imho.
In general, I am a supporter of writing for a specific task. In contrast, SB has a great deal of universality requiring additional variables which are sometimes absolutely unnecessary.
Well, you highlighted in red that you didn't know. What was the problem? How was it manifesting itself? And what was the new method?
And about the error messages: "right or wrong", but if you want to report it, you will. And if you don't want to, you don't want to. And to shut yourself off like "letting people talk about theirs" is an excuse.
In my opinion, this line
unnecessary. In general, I am currently reconsidering OnTradeTransaction operation for the following variant
At the moment of adding a trade there is no ticket of the order which generated the trade. But if you need a ticket of the order and its properties, as I now need the opening price of the order, so that the grid step is not knocked down due to slippage, then this is the best option. imho.
Generally, I am a supporter of developing for a particular task. And the UB has crammed in universality, which requires additional, sometimes absolutely unnecessary variables.
Extremely grateful for pointing in the right direction. Did it this way (below, seems to work):
Now I'm puzzling over how to catch tickers of positions which closed at Take Profit or by a direct order. We only need ticks from them to remove these positions from the main array of positions.
Extremely grateful for the guidance in the right direction. I did so (below, seems to work):
Now I'm puzzling how to catch ticks of positions which closed at takeprofit or by direct order. We only need ticks from them to remove these positions from the main position array.
I would add a check for the symbol and magician.
Here is a fragment of my code where position closing is detected.
We can also divide by reasons of closing from enumeration ENUM_DEAL_REASON
In another Expert Advisor
In the first case I need an order, in the second case a deal is enough. In general, when I need something, I will write it.
I would also add a check for symbol and magik
Here is a fragment of my code where position closing is detected.
We can also divide by reasons of closing from enumeration ENUM_DEAL_REASON
Here in another Expert Advisor
In first case I need order, in second case trade is enough. In general, I will write it when I need it.
Good evening. Your responsiveness and consideration do me great honour. Much obliged. As the youngsters say - respect and respect.
Thank you for your good advice. For one, they are not very much needed at the moment, my Expert Advisor has no and probably will not have any competitors because it is high-frequency, a lot of small positions. He is suffocating on his own, where else can he compete with others? Of course, if it comes to that, it will have one in the terminal and in the account. The second one is probably farfetched, I just don't know much yet, but maybe it will save resources a bit.
Your examples are good, I will definitely save them, but I have no ticket, no order, no deal. More precisely, I have hundreds of them and I don't know which one will close now. You suggested me to think that the fact of closing a position may be pulled out of my calculations and I will try to do it now.
I will try to print everything that it prints in the flow. My Expert Advisor will be a position generator and it knows how to actively open positions and close them at the same time. The only thing is to find this position (the position ticket) in the array/structure and remove it. So it is like this.
And as the typewriter, I will try to use an example code from the reference, in the section about this function, it is called there:
//|OnTradeTransaction_Sample.mq5 |
//| Copyright 2018, MetaQuotes Software Corp.
//|https://www.mql5.com ||
//+------------------------------------------------------------------+
#property copyright"Copyright 2018, MetaQuotes Software Corp."
#property link"https://www.mql5.com"
#property version"1.00"
#property description"TradeTransaction event listener example"
Good evening. Your responsiveness and attention do me honour. Much obliged. As the young people say, kudos and respect.
Thank you for your wise advice. I don't turn on Magik and the symbol almost consciously, firstly, because they are not very much needed right now, my Expert Advisor has no and probably will not have any competitors, because it has a high frequency, a huge number of minimum positions. He is suffocating on his own, where else can he compete with others? Of course, if it comes to that, it will have one in the terminal and in the account. The second one is probably farfetched, I just don't know very much yet, but maybe it will save resources a bit.
Your examples are good, I will definitely save them, but I have no ticket, no order, no deal. More precisely, I have hundreds of them and I don't know which one will close now. You suggested me to think that the fact of closing a position may be taken out of my calculations and I am trying to do it now.
I will try to print everything that it prints in the flow. My Expert Advisor will be a position generator and it knows how to actively open positions and close them at the same time. The only thing is to find this position (the position ticket) in the array/structure and remove it. So it is like this.
And as a typewriter, I'll try to use the example code from the reference, in the section about this function, it's called there:
It's always nice to share my little knowledge with someone who is figuring something out on his own from documentation on the basis of these tips. © I.A. Krylov. The Cuckoo praises the Cock for praising the Cuckoo. )))
If you are writing an EA solely for yourself, of course you can take some liberties. If you don't think it is necessary to check the symbol and the magician, then don't.
About the highlighted:
There's everything, the position ticket, the order ticket and the transaction ticket. And it's not even difficult to pull out a trade and / or order opening position. It's all in the MqlTradeTransaction structure
Если позицию выбрать не получилось, значит она закрыта Ой-ли?
Alexey, it all refers only to OnTradeTransaction event handling
An event has occurred, a trade that closes a position has been executed. The position is already gone at this moment. This can be confirmed by selecting the list of orders and deals (not present in the code) and reading
And note that we are talking about a hadge account where the position usually has only two orders and two trades.