
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
long is a variable type, but I repeat that it is not right.
PositionGetInteger() returns long type. You don't need to bother with such long types likeENUM_POSITION_TYPE.
Anyway, the programmer performs one type conversion. You'd better write it shorter.
They give advice to novice programmers here...
Nextor257:
...
Why is (long) specified before POSITION_TYPE_BUY ?
...
This is a change of type by a variable on the fly.
PositionGetInteger() returns long type. You don't need to bother with such long types likeENUM_POSITION_TYPE.
Anyway, the programmer performs one type conversion. You'd better write it shorter.
They give advice to beginners here...
Wrong, because after that the comparison is done:
And POSITION_TYPE is not long, but
ENUM_POSITION_TYPE
Identifier
Description
POSITION_TYPE_BUY
Buy
POSITION_TYPE_SELL
Sell
Wrong, because then comes the comparison:
And POSITION_TYPE is not long, but
ENUM_POSITION_TYPE
Identifier
Description
POSITION_TYPE_BUY
Buy
POSITION_TYPE_SELL
Sell
Yep... you have very deep knowledge in programming.
You don't seem to have any knowledge at all - just ambition!
ENUM_POSITION_PROPERTY_INTEGER
Identifier
Description
Type
POSITION_TIME
Position opening time
datetime
POSITION_TIME_MSC
Position opening time in milliseconds from 01.01.1970
long
POSITION_TIME_UPDATE
Time of position change in seconds since 01.01.1970
long
POSITION_TIME_UPDATE_MSC
Time of position change in milliseconds since 01.01.1970
long
POSITION_TYPE
Type of position
ENUM_POSITION_TYPE
POSITION_MAGIC
Magic number for the position (see ORDER_MAGIC)
long
POSITION_IDENTIFIER
The position identifier is a unique number, which is assigned to each newly opened position and remains unchanged throughout its life. Reversal of a position does not change the position identifier.
long
You seem to have no knowledge at all - just ambition!
ENUM_POSITION_PROPERTY_INTEGER
Identifier
Description
Type
POSITION_TIME
Position opening time
datetime
POSITION_TIME_MSC
Position opening time in milliseconds from 01.01.1970
long
POSITION_TIME_UPDATE
Time of position change in seconds since 01.01.1970
long
POSITION_TIME_UPDATE_MSC
Time of position change in milliseconds since 01.01.1970
long
POSITION_TYPE
Type of position
ENUM_POSITION_TYPE
POSITION_MAGIC
Magic number for the position (see ORDER_MAGIC)
long
POSITION_IDENTIFIER
The position identifier is a unique number, which is assigned to each newly opened position and remains unchanged throughout its life. Reversal of a position does not change the position identifier.
long
For the PositionGetDouble() function
This is the case that people say: "when you look in the book, you see a figurine".
Try to compile it first:
There will be a warning.
One function cannot produce different types in different cases. It will be long in any case. And did you believe that the same function returns different types? Yes... No one is surprised by superstitions on this forum, it's normal...
ENUM_POSITION_TYPE in the type column means that all possible return values are in the corresponding enumerator.
It would also help to pay more attention, the table above refers to PositionGetInteger(), and the PositionGetDouble() written below has nothing to do with it at all.
I wonder who sees the "figure" ....
I wrote it this way:
This is a change of type change on the fly.
I wonder who sees the "figure" ....
I wrote it like this:
ENUM_POSITION_TYPE pos_type = ENUM_POSITION_TYPE(PositionGetInteger(POSITION_TYPE));
Why write ENUM_POSITION_TYPE before the PositionGetInteger? Because, according to your belief, the PositionGetInteger function with the identifier POSITION_TYPE already returns the type ENUM_POSITION_TYPE.
Why write ENUM_POSITION_TYPE before PositionGetInteger? Because, according to your belief, the PositionGetInteger function with identifier POSITION_TYPE already returns the ENUM_POSITION_TYPE type.
You are the Guru of programming - go answer it yourself....
And this is not my "belief", but the documentation...
But I think thePositionGetInteger() functionalways returns the value of the LONG type and it doesn't matter what was "inside" INTRGER or LONG.
The developers did it to avoid writing two functions.
Therefore, to get the position type(and it is INTEGER) it is correct to do as I wrote: