Errors, bugs, questions - page 1886

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
So what is the question?
Where can you see that under the number "i" there is a position with such-and-such ticket, for such-and-such symbol? In general, apart from the simple output of the sequence number, you also output the ticket and the symbol.
Is it normal that for different situations, one function gives the same value?
ZS: by the way there was a question in the post.
The point is, if I select buy, the function(PositionGetInteger(POSITION_TYPE)) returns 0
And if you select a non-existing position, the function will also return 0
Is it normal that for different situations one function gives the same value?
What is "different situations"? And do as I recommended above:
Forum on trading, automated trading systems and trading strategy testing
Bugs, bugs, questions
Vladimir Karputov, 2017.05.12 11:15
...
In general, apart from the simple output of the sequence number, you also output the ticket and the symbol.
I know I need to check, but things can happen...
PositionGetInteger
The function returns the requested property of an open position, previously selected using thePositionGetSymbol orPositionSelect function. The position property should be of datetime, int type. There are 2 variants of the function.
1. Directly returns the value of the property.
longGetInteger(
ENUM_POSITION_PROPERTY_INTEGERproperty_id// property identifier
);
2. Returns true or false depending on success of the function. If successful, the property value is placed in the target variable, which is passed by reference to the last parameter.
boolPositionGetInteger(
ENUM_POSITION_PROPERTY_INTEGERproperty_id,// property identifier
long&long_var//take the value of the property
);
Parameters
property_id
The [in] identifier of the position property. The value can be one of the values of enumENUM_POSITION_PROPERTY_INTEGER.
long_var
[out] Variable of the long type, taking the value of the requested property.
Returned value
Value of typelong. In case of unsuccessful execution returns 0.
The situation is more subtle with magic. So it is logical to do a check (PositionGetInteger(POSITION_TICKET) > 0).
Yes, it's good to do a check.
But when you write a function, you always try to make sure that it returns a different value in different situations.
I think it is incorrect that the same value comes out of the function under different situations.but when you write a function, you always try to get a different value for different situations.
This is the reason why Magic mentioned it. What to return in case of error PositionGetInteger(POSITION_MAGIC) ?
Is it OK if one function gives the same value for different situations?
ZS: there was a question in the post by the way.
the point is, if I select buy, the function(PositionGetInteger(POSITION_TYPE)) returns 0
and if you select a non-existing position, the function will also return 0
So the first call is used when you GUARANTEED a position (like you have in the loop). And here is the second form of call
for cases where the position is selected out of the blue.
Do that and believe what you get in the "result" variable - everything falls into place:
0 - the position is opened manually. correct?
So the first call is used when you GUARANTEED a position (like you have in the loop). And here is the second form of call
for cases where the position is selected out of the blue.
Do this and believe what you get in the "result" variable - everything falls into place:
that's not the question, it's that the function returns the same value for different situations.
I know how to check it.
the original question was whether it's normal at all?
SZY: an error can be made unintentionally and then in 100000 code you'll get tired of looking for it.
What? You don't have to make mistakes? )
this is not the question, but the function returns the same value for different situations.
I know how to check it
The question was originally about whether this is normal at all?
You, as I see it, have not checked the code I showed you. How about this: you check it first, then ask the question again.