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
Why would you want to hold Buy and Sell position simultaneously for the same pair? To lose on swaps?
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
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.
Why would you want to hold Buy and Sell position simultaneously for the same pair? To lose on swaps?
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).
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.
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
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).
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.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
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.