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
Shouldn't all events be shown in the logbook?
I am switching from mql4 to mql5.
I want to close an open position (BUY or SELL) on a magik.
Is there an analogue of OrderClose()?
Can someone share the code?
I am switching from mql4 to mql5.
I want to close an open position (BUY or SELL) on a magik.
Is there an analogue of OrderClose()?
Can someone share the code?
Perhaps some more clarification is required here.
I need to delete a pending order; I need to close a certain position (a position opened at the moment); I need to close a part of a position on a previously executed trade (opened by market or pending order)...
A clarification is probably needed here.
You need to close a certain position (position open at the moment), a pending order or a part of a position on a previously executed trade (opened by market or pending order)...
We need to close a certain open position that was opened in the market.
I understand you need to cover an aggregate position, not part of it?
Then you need to open a position (make a trade from the market or a pending trade) in the opposite direction.
I.e. if you have an open long position of 1 lot, you must also open a short position of 1 lot.
PS
Because net-trading is now used, there can only be one position, you don't need a magician.
PPS
if it is a question of closing part of a position for a magic deal then first such deal is found in history (or not in history) and then deal is made in opposite direction on volume of initial deal.
The essence of it is this:!!!!
Suppose the position was opened Buy (from the market) with volume 0.10 (with magic number 1). Some time later the position was averaged with 0.10 pending orders (with magic number 2).
Thus the aggregate position is now 0.20.
If we want to cover the entire current position, we should trade a volume of 0.20 in the opposite direction. I.e. we should open a market or a pending Sell order of 0.20.
As you understand the magik does not matter.
If we need to close only a part of a position (to cut it down) by the volume of the first deal, then we need to find a deal with magic number 1 and determine its volume (0,10 in our case).
Only then perform the opposite transaction with a volume of 0.10.
Where is everything else?
P.S. you can open a real MT5 account on nord.
P.P.S. All missed hmmm... even the nord banner))))
Who the hell came up with all this... not a trader... the language wasn't written for trading, but for programming...
When a stop or profit is triggered, the magik!!!! is lost... I understand that these are separate orders for the exchange, but can't we automatically set a master from the last order that was added to the position?
The thing is, these functions are good only for real and demo accounts, they don't work in the tester (because any time there is a server time).
I wish it was mentioned in documentation...
I'm not the only one who will step on the same rake.