![]() |
Hedge Trade-panel 2 Attachment(s) I know, I know... we've all said it before, hedging is f*** stupid because it costs you double in fees, right? Well that's actually not (always) the case. There's a neat little hidden gem in MT that's almost entirely undocumented and almost never used by developers (ever) that's called OrderCloseBy. What this function does is takes hedged orders and reconciles the transactions as netted. This allows you to do some neat things we'll talk about in a minute, but for now it's important to understand that if you use this method you are not charged double fees since you are instructing the broker server to reconcile the hedge as a netting transaction. eg. Buy 1 lot to open and Sell 1 lot to close. Profit = spread of sell price - buy price. Net commission = 1 lot (not 2). Net Profit = Profit - commission. So why is this important? Well it's about risk management. Let's say you have 20 open positions and you want to close them down instantly. How do you do it? Option 1: Close them one by one whilst crying into your keyboard because your profits are slipping away from waiting for each order to close and confirm....and on......and on........ Option 2: You send in a hedge. Wait until calm markets. Close both and get charged double fees. Option 3: You send in a hedge. Close whenever you damn-well please by instructing the server to reconcile both transactions as net-closed and only get charged once. What about reversing positions? Even if you're reversing a single order you still have to close one.........wait for confirmation.........open another. In the mean-time a full second could have passed and massive slippage accrued in the process. Reversing with hedging is instant when you send an order in that's net_position * 2 in the opposite direction. Then of course you use OrderCloseBy to reconcile the orders as partially closed - costing you nothing in the process. Here is a proof of concept trade panel I made. It's not the prettiest panel out there, but it is the fastest! IMPORTANT: This will not work with brokers that don't support hedging accounts. Features:
Inserted Video HedgeTradePanel.ex4 |
1 Attachment(s) |
This is a superb EA! It is all the manual trader would ever need! ![]() However, they will not understand what you just gave them, I suppose... ![]() You have been around here for over 12 years. I do wonder, why are you throwing pearls to pigs? ![]() |
Thanks for that Nich, Ordercloseby is new to me, will check it out, good job. Pip |
I wonder, what the anti-hedge gurus will have to say now? By hedging, one can catch a direction, which is very hard to catch with one dir trades only. And pay just one commission meanwhile?!? LOL! I wonder what happens now with their stupid theory that hedging just increases the expenses?!? Could it be these false gurus to be an absolute ignorants? And you guys listen to then and follow them?!? Someone here is deadly stupid... Could it be whole majority here?!? I think, YES!:-)) hahahahhaha!!!:-))))? |
https://docs.mql4.com/trading/ordercloseby ordercloseby is/are using ticket(s). not my favorable method in OrderSelect (instead or magic number). for an obvious reason, tickets can be change by broker, but not magic number. btw, it’s a great stuff! ![]() |
![]() |
hedging increase the expenses and in best case its at max same (when you have never hedged orders over rollover point and always merge all orders). point, unbeatable argument by math. rest only did not know math enough or accept that they pay more, thats the easy result . accepting to pay more then other by not knowing it better is ok, but dont tell its not the case, thats a argument thats not possible to defend and many people will misleading by this. |
![]() Lets focus on how hedging CAN BE USEFUL. Why not use two trades instead of just one, if that WOULD HELP in catching the direction? Paying the same fees, as one would have been trading with just one trade, helps obviously. Simply put, one can hedge any given level and with proper flipping techniques to make money out of 30 SL and 30 TP, or 300 SL and 300 TP, whatever. This is very much doable and it does involve a process called... THINKING! ![]() I have tried to help those "interested", but they are lazy and when the time came to try to figure it out on their own, under my supervision, they simply run away... Which shows to me the mentality of the readers here. Most, if not all, will remain complete losers in trading till the last day of their lives. I think they deserve it... ![]() |
what did change? merging was there for many years. why can using 2 orders help catcjhing the direction, its same in best case then 1 orders and clsoing part of this order. its impossibble to defend hedging. there are only 2 possibilities to use, all other you mention is 100% wrong, really: - with hedging you have it easier to program. when you are no good programmer (or more beginner then medium) its gfaster and easy to programm hedging and pay for this unexpereinces the additional fees if neccesary. - with hedging you dont need to learn basics more easy , you simple trade each order alone, and not many orders in 1 order. so looks more easy for others, but isnt ,.netting is only something you need to learn and need to know what trade is open with what goal inside the net trade. i dont understand why you want defend hedging , its by math stupid, point, by useability maybe not hedging is more complex and so not often used by beginners. but no advanced trader hedges, so simple. or if he hedges he is no advanced trader (or he want merge it before rollover time). |
2. The anti-hedge argument about unnecessary cost relates to swap, NOT spreads/commissions. Using OrderCloseBy doesn't change the fact that br0kers charge more swap interest than they pay out, on hedged orders. Hence it will always be cheaper to stay out of the market overnight, and pay nothing. 3. Re the viability of hedging as a *strategy* in itself: Is it possible to make money using hedging? YES. Is it possible to make money using a single position approach? YES. There are profitable -- and losing -- traders in each camp. Very simply, if you're net long while price is rising, and/or net short while price is falling, your account balance increases. Vice versa, it decreases. It's ultimately all about direction and timing, regardless of how many positions you have open. It is not so much about there being a right or wrong way; trading is more about mastering a process in your own way. 4. Reality exists irrespective of the alleged intelligence or stupidity of people. Valid arguments are grounded in provable math and logic. 5. For the trader who prefers to open multiple positions -- whether hedged, or in the same direction -- Mr Nicholishen has developed an indispensable operational tool, and I hope that he gets the gratitude that he deserves, for generously sharing it.
![]() ![]() Many thanks for sharing. |
|
Hedging has been declared as a total waste of everything and certainly has not being truly tried, yet. I will post tomorrow some ongoing hedging examples. It is impossible to trade these one direction only, cause when the rate suddenly turns around (and the rate loves to do that), it will be impossible for me to flip them, without the other, hedged, signal... And according to one direction trading "strategies" I will just have to accept their SLs. And how the traders are losing their money? By just setting the right SLs...
|
he says: with hedging you can win, with not hedging you can win,. true, but he forgot to say: with same strategy with not hedging your win is always much higher or at same level then hedging. always! he simple forget to mention this. its same simple like 1+1 = 2, what is the problem with this simple calculation? you are not a beginner, i really cant see why you dont see this simple math fact. its basic math rule, easy and perfect. hedging is for beginners who dont know math or dont know trading better. later you learn how to save this useless thrown away costs, simple. when you accept the extra costs for hedging all is fine, noone will say anything that win is not possible with hedging, its extrem possible, only some small or big times smaller then same done not hedged (depends on how you merge and how many rollover you take), thats all. you will not find one who is telling hedging trader can not have big wins. that was wrong understanding of the topic, its only about difference in win for using hedging. |
Works well did a few scalps on a live account. I have tried a few panels and this one is very fast to execute orders. Thank you Nicholishen great work simple but handy. |
I like to think of this method as 'netting' instead of hedging. Like hanover says this isn't vindication for hedging strategies which accumulate negative swaps. There is a definite time and place for it, especially with those traders who average into a position and want the option to manually close or reverse in an instant or want to reverse a position with a single limit order... |
In case anyone is interested, here is the logic for reconciling all hedged positions as netting. Inserted Code void ReconcileHedgeOrders() { for(int i=OrdersTotal()-1;i>0&&!IsStopped();i--) { if(OrderSelect(i,SELECT_BY_POS) && OrderSymbol()==_Symbol && OrderType()<2 && (!m_locked_magic || OrderMagicNumber() == MAGIC) ) { int type = OrderType(); int ticket = OrderTicket(); for(int j=i-1;OrderSelect(j,SELECT_BY_POS);j--) { if(OrderSymbol()==_Symbol && OrderType()<2 && OrderType()!=type && (!m_locked_magic || OrderMagicNumber() == MAGIC) ) { if(!OrderCloseBy(OrderTicket(),ticket)) Print("OrderCLoseByError: ",GetLastError()); i=OrdersTotal(); break; } } } } } |
![]() |
|
Anyone know why this was moved from tech to the trading discussion forum? |
© Forex Factory