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
Well it depends on the account type but in your case you would fire an opposing order of the matching or equal volume, to cancel out the position.
So you are either long or short but not at the same time, if you want that you have to use a Hedging account.
I think that's what's causing me the confusion. Is it an absolute that you can only ever have one position per symbol (as it suggests in the documentation), or is this dependant on the account type with my broker? I'm not interested in hedging functionality, it's more knowing whether I could have more than one position open on a symbol.
Yes that is called a Hedging type account.
ENUM_ACCOUNT_MARGIN_MODE
Identifier
Description
ACCOUNT_MARGIN_MODE_RETAIL_NETTING
Used for the OTC markets to interpret positions in the "netting" mode (only one position can exist for one symbol). The margin is calculated based on the symbol type (SYMBOL_TRADE_CALC_MODE).
ACCOUNT_MARGIN_MODE_EXCHANGE
Used for the exchange markets. Margin is calculated based on the discounts specified in symbol settings. Discounts are set by the broker, but not less than the values set by the exchange.
ACCOUNT_MARGIN_MODE_RETAIL_HEDGING
Used for the exchange markets where individual positions are possible (hedging, multiple positions can exist for one symbol). The margin is calculated based on the symbol type (SYMBOL_TRADE_CALC_MODE) taking into account the hedged margin (SYMBOL_MARGIN_HEDGED).
https://www.mql5.com/en/docs/constants/environment_state/accountinformation
Thanks for clarifying, I'm still getting my head around all the info for MQL5 and the documentation on positions didn't give any suggestion of this.
Position Properties
Execution of trade operations results in the opening of a position, changing of its volume and/or direction, or its disappearance. Trade operations are conducted based on orders, sent by the OrderSend() function in the form of trade requests. For each financial security (symbol) only one open position is possible. A position has a set of properties available for reading by the PositionGet...() functions.
@SteMcG1984 I appreciate you asked this 18 months back, but I was working on something similar this week so I thought I would make a suggestion.
"- Is it possible for an MT5 position to have multiple magic numbers? Then do partial close for all parts with a specific MN."
I found that by multiplying the ulong magic no, you can free up digits on the RHS which can be used to store additional info, for example a unique ID.
So you could have something like this:
<magicID> x 100 yields: <magicID><2 digit groupID> which allows 100 unique groups with a common magic No- <magicID><00>, <magicID><01>, ... <magicID><99>
The ulong field can support 19 digits so you can easily made the right hand section longer if needed.
Hope that helps