Download MetaTrader 5

Having a Buy and a Sell position simultaniously on the same Symbol (Hedging)

To add comments, please log in or register
Interested in MetaTrader 5 features? Learn more about them!
aleloa
38
aleloa 2011.01.15 08:58 

Hello, im kind of new at this, im developing a simple strategy of hedging, i encountered a problem when i tried to buy when i have a open position of a sell, the system closes my sell position, i starting to read about it and find out that the problem is MT5, is it true?, i mean, how is it posible that it works in MT4 and doesnt work in MT5, i'll be forced to go backwards and run my code in MT4, its very sad.

 

Glad to hear your comments.

 Regards. 

Stephen Njuki
5179
Stephen Njuki 2011.01.15 09:42  
Be ware of FIFO... I think you can still hedge but you would have to use pending orders...
Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Order Properties - Documentation on MQL5
Andrei Moraru
1157
Andrei Moraru 2011.01.15 12:25  

Why would you want to hold Buy and Sell position simultaneously for the same pair? To lose on swaps?
muller
559
muller 2011.01.15 15:13  
ssn:
Be ware of FIFO... I think you can still hedge but you would have to use pending orders...

you might consider the real definition of what is a position, what is an order; that means hedging (MT4 spirit) is over. Some solutions can be tried with virtual orders
aleloa
38
aleloa 2011.01.15 17:33  
enivid:

Why would you want to hold Buy and Sell position simultaneously for the same pair? To lose on swaps?
is just a strategy i use, sometimes my algoritm puts a buy and a sell, the wrong one hits the stop loss and the other one keep the profits running, i only uses it when there is high volatility and some other conditions.
Andrei Moraru
1157
Andrei Moraru 2011.01.16 13:35  
aleloa:
is just a strategy i use, sometimes my algoritm puts a buy and a sell, the wrong one hits the stop loss and the other one keep the profits running, i only uses it when there is high volatility and some other conditions.
Just code it so that when both buy and sell are generated, one of them closes other. Instead of a stop-loss, you set up a pending order that would reopen the desired position. The trading result will be the same (except for the elimination of the possible loss in swaps).
Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Order Properties - Documentation on MQL5
aleloa
38
aleloa 2011.01.17 00:01  
enivid:
Just code it so that when both buy and sell are generated, one of them closes other. Instead of a stop-loss, you set up a pending order that would reopen the desired position. The trading result will be the same (except for the elimination of the possible loss in swaps).

its true, much more coding, but theres no room for laziness in this bussiness. thanks enivid.

 

 

To add comments, please log in or register