Typical mistakes and how to deal with them when dealing with the trading environment - page 7
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
I'm afraid that's crooked logic. But I could be wrong, of course. It would be interesting to hear the logic.
3+ foot arbitration
3+ foot arbitrage
Different logics can be used for this TS. Typically it is asynchronous sending of three orders. But, indeed, there are variants where a synchronous OrderSend is sent first to the symbol most likely to be strong. And if the OrderSend ends in an open position - the least likely two OrderSendAsync orders are sent.
In this situation, it may seem that the first "position" - the market order - needs a mechanism for determining whether the first "position" is incomplete. But the first OrderSend goes through a limit order at the current price or slightly worse. Therefore it is not considered a 'position'. The other two are market orders, more often than not. And counting them as "positions" allows you to avoid situations of re-opening positions. In this case this accounting does not have any negative effects.
All in all, as I understand it - there will be no solution. Not even a solution, but a logically correct working principle with the number of orders and positions.
I am talking about the function used for any strategy, others say - for each strategy - a different crutch.
This example turned out to be much cooler. The TP, which was placed by the broker himself, was redirected! And almost immediately (I was waiting for 115 ms - apparently it was a bug in MT5) after the re-registration, the broker placed the next TP, which was executed. The comments to the orders did not show up in the screenshot. Green colour isORDER_REASON_TP. Accordingly, the reject order even has ORDER_POSITION_ID.
This is not a reject order, but a normally filled order that was executed. When it is executed, the position ID is obtained.
Also, we have two orders, one of which is not executed. Now the question is: how many positions (if these orders were not stop orders but position orders), so - how many positions would your approach return to you? The answer is: one more, which is false. Why would you do that then?
This is no longer a reject order, but a normally filled - executed order. When executed, that is when the position ID is received.
You have the wrong idea.
One more thing: there are two orders, one of which was not executed. Now the question is: how many positions (if these orders were not stop orders but position orders), so how many positions would your approach return to you? The answer is: one more, which is false. Why would you do that then?
Let's do it again. Suppose there were two open positions. And let's set a future market order of this kind. The function returns 2+1=3. TS considers that there are three positions and everything is OK. In 16 ms the re-jacket comes. TS checks how many positions - 2+0=2. And it needs three! - sends another market order. Then again 2+1=3. And the order is executed, getting 3+0=3.
In general, as I understand it - there will be no solution. Not even a solution, but a logically correct working principle with the number of orders and positions.
I am talking about the function used for any strategy, others say - for each strategy - a different crutch.
I have not changed my mind. The function remains universal for 99.9% of EAs and trading platforms.
You have the wrong idea.
Let's go over it again. Suppose there were two open positions. And we put this kind of future market order. The function returns 2+1=3. TS looks at three positions and everything is OK. In 16 ms the re-jacket comes. TS checks how many positions - 2+0=2. And it needs three! - sends another market order. Then again 2+1=3. And the order is executed, getting 3+0=3.
#896615 - reject, and does NOT have an ID-position.
Let's put it another way. Suppose there were two open positions. We get a signal to open a third position, send us a trade request and obtain this reverse market order. If there are three positions, our EA will switch to sending other trade requests using a different symbol. Function returns 2+1=3. TS looks at three positions and starts to calculate volumes, takes/stops of three more positions - by another symbol, sends trade orders to open by another symbol. After 16 ms the rebid of one from another symbol arrives. TS looks how many positions - 2(current)+3(2 positions and one market from another symbol)=5. And it should be six! - sends another market order for the current symbol at a completely different price and calculates the volume and takeoffs/stops of new positions for the third symbol. Then the same mess happens again.
And then we are scratching our heads - why has he gone crazy?![](https://c.mql5.com/3/174/neznaet.gif)
Or do you think that you have to create functions for only one - your - strategy and logic of TS building? You are wrong.
I have not changed my mind. The function remains universal for 99.9% of EAs and trading platforms.
No. Only for one behavioural logic.
And there are thousands of them.
I have not changed my mind. The function remains universal for 99.9% of EAs and trading platforms.
The function should return what is asked of it. Clearly and unconditionally, and not for the user to decide what they need later on.
The logic that I suggest should be like this
... Or it should be like this:
And you suggest:
#896615 is reject and does NOT have an ID position.
Read the number in the third left red box in the screenshot above.
Let's put it another way. Suppose there were two open positions. We obtain a signal to open a third position, send a trade request and obtain this redirected market order. If we have three positions, our EA will switch to sending other trade requests using a different symbol. Function returns 2+1=3. TS looks at three positions and starts to calculate volumes, takes/stops of three more positions - by another symbol, sends trade orders to open by another symbol. After 16 ms the rebid of one from another symbol arrives. TS looks how many positions - 2(current)+3(2 positions and one market from another symbol)=5. And it should be six! - Sends another market order for the current symbol at a completely different price and calculates the volume and takeoffs/stops of new positions for the third symbol. Then the same mess happens again.
And then we scratch our heads wondering why he's gone crazy.
If you do not write and make up the bent trading logic, you will not only scratch your own reputation. I understand that among the crooked TK, which probably flooded freelancing, this is not uncommon. And because the money does not smell, someone takes them on the principle, if they ask for shit, do it and forget it. Nothing even close to that has ever been written in a nightmare. But I'm sure freelancers know much better than I do about the grades of feces among TK. So yes, for inadequate TCs can be very useful option proposed by @Combinator- to do feet from the TC, as soon as found a market order with zero ID.
Or do you think that we have to create functions for only one - your - strategy and logic of building the TS? You're wrong.
I think we need to think, at the very least. And not create a suitable environment for the reproduction of abominable TCs. Unfortunately, I am unable to formulate a criterion for defining a bottom amongst TCs. Not to hurt anyone, I will reverse the worldview - myself on the bottom, and known TK will float on the laws of physics.
The recipe, as they say, is universal: