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
An imaginary position is needed from the point of view of robot's algorithm: if it has opened it, it should close it.
I should add that the task in the first post was even easier - we needed to implement operation of a grid of limit orders where each node of the grid closes its SL/TP.
For example, only one such unidirectional EA works in an account and no one else does. But we are talking about imaginary positions here as well.
And the issue raised is not just about netting. The same can happen in hedging. There are several Expert Advisors in hedging, and someone just closed several positions by CloseBy. If Expert Advisors are implemented through imaginary positions, then such a collapsing will not break the logic.
Generally, this can be solved through a virtual trading environment. It can be solved easily. That's how algorithmic offices run their TS portfolios on the exchanges.
To simplify things, yes. Agreed.
At this point, the "Transport Manager" hasn't completely clarified the problem and his actions.
Of course, for a part of a position with which our EA is working, the stop orders are pending sell/buy stop and sell/buy limit.
So far, I have realized that it would be better to move to OnTrade due to a great number of pitfalls of OnTradeTransactions.
Of course, stop orders are pending sell/buy stop and sell/buy limit for a part of a position that is handled by a specific EA.
So far, I have understood that it is better to go for OnTrade due to a great number of pitfalls of OnTradeTransactions.
Only pay attention that they work together. I don't remember which is the first and which is the second. But OnTradeTransactions has at least some information without any additional code, while OnTrade has to get everything by force. First of all we have to determine which event triggered the function...
I have written a transaction catcher - it may be useful to determine what and from where (although there is simple processing depending on transaction type) - there is no reference to order and transaction history (e.g. to print the Expert Advisor ID)
fxsaber thanks for the example!
Only it's not really an example, it's a complete solution to the original problem.
Of course, stop orders are pending sell/buy stop and sell/buy limit for a part of a position that is handled by a specific EA.
So far, I have understood that it is better to go for OnTrade due to a great number of pitfalls of OnTradeTransactions.
Keep up the good work :)
A little hint MqlTradeTransaction &trans - ONLY the fields are relevant
TRADE_TRANSACTION_DEAL_* FIELDS
For trade transactions related to trade processing (TRADE_TRANSACTION_DEAL_ADD, TRADE_TRANSACTION_DEAL_UPDATE and TRADE_TRANSACTION_DEAL_DELETE) the following fields are filled in MqlTradeTransaction structure
And look at MqlTradeResult &result.
But now you have 1000 lines of code!
Keep up the good work :)
A little hint MqlTradeTransaction &trans - ONLY the fields are relevant
TRADE_TRANSACTION_DEAL_*.
For trade transactions related to trade processing (TRADE_TRANSACTION_DEAL_ADD, TRADE_TRANSACTION_DEAL_UPDATE and TRADE_TRANSACTION_DEAL_DELETE) the following fields are filled in MqlTradeTransaction structure
And look at MqlTradeResult &result.
But now you have 1000 lines of code!
Of course, I understand that you are bursting with ego. Experience, everything...
But I came here not for a bit of sarcasm but for help. If you look a bit higher, you'll see that I agreed that I made a mistake in parsing fields that aren't filled in for deal_add.
I would be grateful to you for more constructive help, I can "shit" myself) I accept constructive criticism.
About"And look at MqlTradeResult &result".
According to help, trade transaction result is filled only withTRADE_TRANSACTION_REQUEST and it must be analyzed only with this type of transactions.
You have a strange perception.
I wouldn't dream of "shitting on anyone", that's probably your perception of life and you probably use it a lot yourself.
You probably use it a lot yourself.
It's not me, but fxsaber(a), because in almost every topic he pushes his
But he himself does not trade on the real Market, and certainly not on the FORTS!
There are simple and complex solutions for the same problem.
Judging by your question, you are a beginner.
But as the saying goes: "We do not look for easy ways"!
The OnTradeTransaction function has been specifically designed to simplify
"life for programmers in robot development, but the old-timers don't want to use it,
because they are used to OnTrade and have to write a bunch of code to make it work.
I've already told you that the order is the head, not the deal!
What will you do if the volume of the initial order is not 1, but 2, 10?
You set a pending order, and it means you cannot "strictly" control it, much less control the trades!
You cannot "tightly" control it, all the more so if you do any deals! There are a lot of pitfalls with pending orders.
But, you have chosen the easy way, by getting a dubious ready-made solution, instead of trying to
But you have chosen the easy way, instead of trying to figure it out yourself (with hints).
Good luck, I am no longer involved.
You have a strange perception.
I wouldn't dream of "shitting on anyone", that's probably your perception of life and you probably use it a lot yourself.
You probably use it a lot yourself.
It's not me, but fxsaber(a), because in almost every topic he pushes his
But he himself does not trade on the real Market, and certainly not on the FORTS!
There are simple and complex solutions for the same problem.
Judging by your question, you are a beginner.
But as the saying goes: "We do not look for easy ways"!
The OnTradeTransaction function has been specifically designed to make
"life" for programmers in robot development, but it's the old-timers who don't want to use it,
because they are used to OnTrade and have to write a bunch of code to make it work.
I've already told you that the order is the head, not the deal!
What will you do if the volume of the initial order is not 1, but 2, 10?
You set a pending order, and it means you cannot "strictly" control it, much less control the trades!
You cannot "tightly" control it, all the more so if you do any deals! There are a lot of pitfalls with pending orders.
But, you have chosen the easy way, getting a dubious ready-made solution, instead of trying to
But you have chosen the easy way, instead of trying to figure it out yourself (with hints).
Good luck, I am no longer involved.
Let's start with the fact that I don't use ready-made solutions. I don't know what you've made up for me, but I haven't used any of the solutions in the thread (although I've extracted some useful knowledge) and I'm still experimenting and figuring things out. Generally, I've noticed from your posts that you like to second-guess others. No offence.
As for the order volume, it doesn't matter what it is. It is a deal that allows me to judge what volume is really executed. I think it is easier than catching the partial order execution by its appropriate type. In one of the topics, in addition, it was pointed out that only a deal makes you sure that the position has been executed.
To begin with, I don't use ready-made solutions. I don't know what you've guessed for me, but I haven't used any of the solutions in the thread (although I've learned some useful knowledge) and I'm still experimenting and figuring it out. Generally, I've noticed from your posts that you like to second-guess others. No offence.
As for the order volume, it doesn't matter what it is. It's a deal that allows me to judge what volume is really executed. I think it is easier than catching the partial order execution by its appropriate type. In one of the topics, it was pointed out that only a deal makes us sure that the position has been executed.
Have you forgotten how to read?
"Good luck, I'm no longer involved."