Forex Factory (https://www.forexfactory.com/forum.php)
-   Trading Discussion (https://www.forexfactory.com/forumdisplay.php?f=11)
-   -   Hedge Trade-panel (https://www.forexfactory.com/showthread.php?t=701784)

Nicholishen Sep 22, 2017 4:13pm | Post# 1

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:

  1. One-click trading
  2. Set TP and SL by points
  3. Add or subtract incremental positions at will to manage overall net exposure
  4. Reverse net position instantly
  5. Close net position instantly
  6. Lock order management to Panel orders only so you won't interfere with other orders (like alt EA orders)
  7. Order Maintenance button to reconcile transaction on your schedule so it won't slow down rapid scalping in a fast market
  8. Status in window. Includes last action status with order latency and slippage reporting as well as the overall net position.
  9. Move window anywhere on screen for convenience

Attachment 2491994

Inserted Video

HedgeTradePanel.ex4

Nicholishen Sep 22, 2017 4:45pm | Post# 2

1 Attachment(s)
Getting creative with limit orders:

Now we can set limit orders to take partial profits and reverse orders without accruing extra costs. (swaps are net so make sure to use the order maintenance before rollover!)

Click to Enlarge

Name: creative limits.png
Size: 61 KB

MoneyZilla Sep 23, 2017 5:26am | Post# 3

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?

pipatronic Sep 23, 2017 11:29am | Post# 4

Thanks for that Nich, Ordercloseby is new to me, will check it out, good job.
Pip

MoneyZilla Sep 23, 2017 11:55am | Post# 5

Ordercloseby is new to me, will check it out, good job.
Order close by is in mt4 for many years already. Now professionally presented by mr.Nich!

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!!!:-))))?

Hairi Sep 23, 2017 1:28pm | Post# 6

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!

pipatronic Sep 23, 2017 4:07pm | Post# 7

{quote} Order close by is in mt4 for many years already. Now professionally presented by mr.Nich! 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...
I like your style

dukas_trader Sep 23, 2017 4:34pm | Post# 8

{quote} Order close by is in mt4 for many years already. Now professionally presented by mr.Nich! 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...
dont say it to loud. this merging was there all the time. even then hedging is in all best case at max same like not hedging, can never be better, but in many cases is much more expansive. its really easy by math, you cant fight against 100% sure math.

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.

MoneyZilla Sep 24, 2017 1:49am | Post# 9

{quote}even then hedging is in all best case at max same like not hedging, can never be better, but in many cases is much more expansive.
OK, now we see hedging is NOT more expensive than non-hedging. That is good step 1! Non-hedgers defeated. I like that!

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...

dukas_trader Sep 24, 2017 8:23am | Post# 10

{quote} OK, now we see hedging is NOT more expensive than non-hedging. That is good step 1! Non-hedgers defeated. I like that! 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...
when? hedging is only not more expensive, when orders are merged (all) and no hedged order hold over rollover time. so for many ist much more expansive.

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).

hanover Sep 24, 2017 3:00pm | Post# 11

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?!?
OK, now we see hedging is NOT more expensive than non-hedging. That is good step 1! Non-hedgers defeated. I like that!
1. If I understand correctly, Mr Nicholishen's ingenious EA does not employ, let alone vindicate, any particular hedging *strategy*. It simply uses a temporary hedge, and then OrderCloseBy, as an operational means of closing multiple positions efficiently without slippage or additional cost. A very different proposition.

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.

I know, I know......
Excellent work, as always.
Many thanks for sharing.

MoneyZilla Sep 24, 2017 5:55pm | Post# 12

{quote} {quote} 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.
I have read many of your posts where you are "defeating" hedging as useless, especially from an expense point of view. Not to speak from a strategy point of view. And it was not just the swap, as an argument not to use hedging... But this does not matter anymore, cause you have just said hedging might be profitable. What's in the past, stays there. Lets move on.
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.
This I see for a first time here at FF (from you). This is a great 180 flip of an original position of yours towards hedging. Admitting hedging works is a good step for you to become a great trader one day. I know only 1 in 10,000 hobby traders does not lose money. Probably this guy knows how to hedge properly, I guess... If you do not trust me, maybe you can ask your friends from pepperstone about some details on the matter? I know details from a big EU LP. FF already banned one of my posts, like totally deleted it, when I have shared what the real situation with the hobby traders is...

MoneyZilla Sep 24, 2017 6:12pm | Post# 13

{quote} 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.
We see that all hobby traders are "thought" to trade with just one direction trades (i.e. not to hedge). And what is the outcome of this "teaching process". Ask any LP for details. You know the answer of my question perfectly well. This is how good the one direction trading strategies are...

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...
but no advanced trader hedges, so simple. or if he hedges he is no advanced trader (or he want merge it before rollover time).
I do not know about that. Maybe you are right. As a hobby trader, all I know is hedging can be profitable. Might engage in more expenses. Surely, sometimes it will. So what? High expenses does not bother me, when the income is higher.

dukas_trader Sep 24, 2017 6:23pm | Post# 14

{quote} I have read many of your posts where you are "defeating" hedging as useless, especially from an expense point of view. Not to speak from a strategy point of view. And it was not just the swap, as an argument not to use hedging... But this does not matter anymore, cause you have just said hedging might be profitable. What's in the past, stays there. Lets move on. {quote} This I see for a first time here at FF (from you). This is a great 180 flip of an original position of yours towards hedging. Admitting hedging works is a good step for you...
no, hanover was not exactly in his post, thats why you did understand it not correct,

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.

Pipstrumpf Sep 24, 2017 7:00pm | Post# 15

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.

Nicholishen Sep 24, 2017 7:03pm | Post# 16

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...

Nicholishen Sep 24, 2017 7:14pm | Post# 17

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;
            }
         }
      }
   }  
}

Nicholishen Sep 24, 2017 7:20pm | Post# 18

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!
See the logic I posted above. This goes by magic number and symbol and resets the loop every time it closes an order since they change.

hanover Sep 24, 2017 8:16pm | Post# 19

I have read many of your posts where you are "defeating" hedging as useless, especially from an expense point of view. Not to speak from a strategy point of view. ........This is a great 180 flip of an original position of yours towards hedging.
It certainly doesn't feel like I've made a 180 flip. Here (and here) is what I've always maintained about hedging (and still do), with links to posts written several years ago. Feel welcome to read these again if you wish.

Nicholishen Sep 24, 2017 9:29pm | Post# 20

Anyone know why this was moved from tech to the trading discussion forum?


© Forex Factory