tor4en: How do I get the total number of positions for a symbol?
There can only be one position per tool.
tor4en: PositionsTotal() returns the total number of positions for all symbols. I need to know that there are no open positions for a symbol. How to do it correctly?
Either PositionSelect(), or organize the enumeration of existing positions using PositionsTotal() and PositionGetSymbol()
Yedelkin: Either PositionSelect() or enumerate existing positions using PositionsTotal() and PositionGetSymbol()
The PositionSelect() function has to find out why it returns false. It turns out that there's no standard method to determine that there's no position opened for a symbol?
tor4en: PositionSelect() should also be analyzed why it returns false.
That's exactly right. I only described the general approach, in response to the question about the possibility itself. ...And error handling - it is often encountered when calling one function or another. Routine, so to speak.
tor4en: It turns out that there is no standard method to determine that there is no open position on a symbol?
Look at the second method from the mentioned ones. An opinion was expressed here that it is universal in some way. The details were not mentioned.
tor4en: PositionSelect() still needs to understand why it returns false. It turns out that there is no standard method to determine that there is no open position for a symbol?
If it returns true - there is a position, if it returns false - there is no position (no matter what the reason is)
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
ENUM_POSITION_TYPE
two values. and what is returned if there are no open positions?
I use the PositionType() method from the standard library.
Okay, I get it, PositionSelect() returns false, and PositionType() returns the type of the last position selected.
How do I get the total number of positions for a symbol?
PositionsTotal() returns the total number of positions for all symbols.
I need to know that there are no open positions for a symbol. How can I do this correctly?
There can only be one position per tool.
ENUM_POSITION_TYPE
two values. and what is returned if there are no open positions?
I use the PositionType() method from the standard library.
Okay, got it, PositionSelect() returns false, and PositionType() returns the type of the last position selected.
There is such a thing. It's called Fixed Chart Position
Which by default is on the left side in a corner.
Can it be set in ChartSet(Get) properties?
There is such a thing. It's called Fixed Chart Position
Which by default is on the left side in a corner.
Can it be set in ChartSet(Get) properties?
Either PositionSelect() or enumerate existing positions using PositionsTotal() and PositionGetSymbol()
That's exactly right. I only described the general approach, in response to the question about the possibility itself. ...And error handling - it is often encountered when calling one function or another. Routine, so to speak.
Look at the second method from the mentioned ones. An opinion was expressed here that it is universal in some way. The details were not mentioned.
PositionSelect() still needs to understand why it returns false. It turns out that there is no standard method to determine that there is no open position for a symbol?