Download MetaTrader 5
To add comments, please log in or register
No time to learn MQL5? Order your application from a developer!
LouK
143
LouK 2014.03.22 05:38 

I've read several threads re: OrderCloseBy and I'm sorry to be thick about this but I still don't get it. And I have found the documentation to be no help beyond syntax.

- forex.com at least, does not allow "hedging", opposite positions for the same pair in the same account. If they see both, they close both. I've seen it happen real time. To you who are posting about OrderCloseBy, I don't understand how you can end up with opposite positions for the same pair in the first place.

Q: Can you please explain this? How do you get opposite positions in the same pair? At forex.com, they close both positions if you try to do this.

Q: Is there a time window or a relationship in how the orders are entered, that allows execution of OrderCloseBy for opposite position/same pair?

Q: Would I submit OrderSend for the new position followed immediately by OrderCloseBy, or how would this work?

i've been doing this manually by OrderClose then a market order OrderSend, but if OrderCloseBy really saves a spread, I would like to be able to use it.

Any information is appreciated.

Thanks!

Ian Venner
2583
Ian Venner 2014.03.22 07:11  

No hedging is a US rule so you can probably have opposite positions on the same pair if you do not live in the US but I don't think OrderCloseBy() would save a spread because you had to already open two positions to use it.

Ahmad Mehdiyev
478
Ahmad Mehdiyev 2014.03.22 12:13  

1. You cannot open opposite positions at the same time if your broker is in US. That is true. With other brokers it is possible.

2. The way you get opposite positions (if they are allowed by your broker) is quite simple :). You buy and then sell, or vice versa.

3. The difference in lot size or the time at which each order was opened does not matter as far as OrderCloseBy is concerned.

4. OrderCloseBy is ment to substitute the use of OrderSend, so submitting OrderSend is not required. Simpy use "Close By" or "Multiple Close By" from within the Order Entry window, or use a script if you have one.

5. You do save a spread. But once! Here how it works. When you buy you pay a spread. When you sell you pay a spread. If you close them separately you loose both of those spreads (well they are in your P&L already), but if you do OrderCloseBy you are able to get one of those spreads back since it matches the closing price with opening price of the second trade. Simply put it assumes that when you opened the opposite trade you closed out the first one at the price at the opening price of the matching order.

They way I use OrderCloseBy is when I have a multiple one-sided positions and need to close them all quick I just lock the complete position with one trade, and then OrderCloseBy them with that new matching order. Obviously if you don't have an ability to lock the position you must close the initial multiple positions one-by-one which in a fast market could be quite damaging.

Hope this helps, and I did not simply repeat the things you know already.

<advertising removed by moderator>

LouK
143
LouK 2014.03.24 17:26  

I appreciate the help, but I still don't understand how you can close one ticket with another ticket number, if you can't open that second ticket in the first place.

And as to the hedging rule, why is it that you can hold the opposite positions in separate accounts, just not the same account?

Thanks again!

Ian Venner
2583
Ian Venner 2014.03.24 18:04  

LouK:

I appreciate the help, but I still don't understand how you can close one ticket with another ticket number, if you can't open that second ticket in the first place.

You can't. For the reason you stated, OrderCloseBy() cannot be used by traders subject to the US no hedging rule.
LouK
143
LouK 2014.03.24 18:13  
SDC:
You can't. For the reason you stated, OrderCloseBy() cannot be used by traders subject to the US no hedging rule.

So those I see posting about using it to close same pair/opposite positions are outside US, correct?
Ian Venner
2583
Ian Venner 2014.03.25 02:44  

Either they are or their broker is ....

LouK
143
LouK 2014.03.25 16:15  
SDC:

Either they are or their broker is ....


Thanks again. Seems to me the documentation could mention this in the OrderCloseBy entry.

By the way, can you explain why this is prohibited in a single account, while you can still have opposite positions in two accounts? (Though why you would do this I'm uncertain).

Ian Venner
2583
Ian Venner 2014.03.25 16:53  

Probably because the NFA regulations doesn't say you can't do that...

/
To add comments, please log in or register