Typical mistakes and how to deal with them when dealing with the trading environment - page 5

 
fxsaber:

In the example we are talking about the specific TC situation described. And there the question is left unanswered.

The function returns what is physically in the account. And it lies exactly as much as it would lie in MT4. I.e. everything is normal.

In MT4, the function will not return "maybe three", it will return exactly two.
You propose to return both physically existing positions - their number, and market orders that are not yet a position. And may never become one.
And I'm not talking about hypothetical examples. I'm talking about a specific function that returns the number of positions in the account.
 
Artyom Trishkin:

With all due respect, I can't understand your desire to move away from the real problem to a sucked up (and not even formalised in this thread) problem.

Carry on without me.

 
Artyom Trishkin:
In MT4 the function will not return "maybe three", it will return exactly two.

You propose to return both physically existing positions - their number - and market orders which are not yet positions. And may never become one.

Absolutely right!

And I'm not talking about hypothetical examples. I'm talking about a specific function that returns the number of positions in an account.

My example is not more hypothetical than yours from the viewpoint of the TS behavior.

 
Andrey Khatimlianskii:

With all due respect, I can't understand your desire to move away from the real problem to a sucked up (and not even formalised in this thread) problem.

Carry on without me.

Andrew. The real problem is that the proposed solution to the problem of opening a redundant position can itself, in turn, return a lie. Is this not a problem? There are two positions. One market order. The function returns three. The order is canceled by the server. That's the error.
I'm suggesting we discuss options for an exact return, not a "maybe it'll go away". I agree that there is a problem. But so far, imho, the method of solving it is no better than the problem itself.
 
fxsaber:

Absolutely right!

My example is not more hypothetical than yours in terms of TC's behaviour.

No one seems to want to see a different problem. Everyone has enough of the other problem. As long as you don't encounter problems generated by it.
I'm not making them up. I am speaking on the basis of my experience of creating custom TCs. And, if an exact number is required, e.g. 2, then you don't need to return 3 until there are definitely 3.
 
Artyom Trishkin:
Andrey. The real problem is that the suggested solution to the problem of opening an extra position may itself, in turn, return false. Is this not a problem? There are two positions. One market order. The function returns three. The order is canceled by the server. That's the error.

I will even show you what such cancelled market orders look like

Only there is no error.

 
Artyom Trishkin:
No one seems to want to see a different problem. Everyone has had enough of the other problem. Until you are faced with the problems it created.
I'm not making them up. I'm speaking from experience of creating custom-made ts. And, if an exact number is required, e.g. 2, then you don't need to return 3 until there are exactly 3.

That's the thing, when there are two positions and one opening market order, there are three positions. If in a moment the broker cancels the market order, the positions become two. Where is the error?

I cited an example for a reason, to understand the logic.

Forum on trading, automated trading systems and trading strategies testing

Typical mistakes and how to fix them when working with a trading environment

fxsaber, 2018.02.24 14:46

Let's move away from MT5 towards MT4. An advisor is trading. Suddenly the broker, through a technical error (not you), places a position on your account that successfully passes the EA's own-others filter - magik, symbol, etc. Seconds later, the broker corrects his mistake - deletes (doesn't even close) his position from your account.

Will your TS break down?

 
Artyom Trishkin:
No one seems to want to see a different problem. Everyone has had enough of the other problem.
We have already discussed it. there is no universal solution, because one needs one thing and the other another another.
 
fxsaber:

I will even show you what such cancelled market orders look like

Only there is no error.

What makes you think it isn't?
The function will return the wrong quantity, though.
There are two positions. There are two orders. The function returns 4. Immediately the orders are canceled. We have two positions. But the function returned 4.
Isn't it an error? It should be like this? Is it right?
I don't understand something...
 
fxsaber:

The point is that when there are two positions and one opening market order, there are three positions. If in a moment the broker cancels the market order, there are two positions. Where is the error?

I gave an example for a reason, so that the logic is clear.

There are two real positions. The market order is not a position. Why return it as a position? And if its lot is the limit? Based on the false volume, which does not really exist, the program will make a mess, and then we will heroically handle these miracles.
Reason: