Trade Hedger EA

Posted by admin8277 on September - 22 - 2016
Spread the love

Expert Advisor

 

Purpose:

To hedge existing trades either with pending or market order hedging trades.  With pending hedge trades the entry price may optionally be made to trail your existing open orders.  There is also an option for a breakeven and trailing of the hedge trade’s stop.

Buy trade with pending Sell Stop hedge trade

Buy trade with pending Sell Stop hedge trade – click to enlarge

 

Inputs:

  • HedgeMode – specifies which trades will be hedged
    • ALL_TRADES – All trades on a chart are hedged regardless of their magic number or lack thereof
    • PER_MAGIC – Only trades on the chart whose magic number matches the magic number specified by TgtMagicNum will be hedged
  • TgtMagicNum – if HedgeMode equals PER_MAGIC, the EA will only Hedge those trades whose magic number equals the magic number specified with the TgtMagicNum input
  • UsePendingHdg – if true open Buy trades are hedged with pending Sell Stop trades and open Sell trades are hedged with pending Buy Stop trades
  • HedgeDist – offset distance to pending stop orders.  For example a Buy order would be hedged with a Sell Stop order placed HedgeDist pips below the Buy order’s entry price
  • HedgeStop – distance in pips used for a hedge trade’s Stop.  If this value is zero, than the hedge trade will have no stop
  • HedgeTP  – distance in pips to a hedge trades Take Profit.  If this value is zero, hedge trades will have no take profit
  • UseTrailingTrade – if true, than any pending hedge trades entry price will be made to trail the current price
  • UseTrailingStop – if true, than hedge trades will have a breakeven distance and a trailing stop.  A profit lockin distance will be applied when the breakeven adjustment is made
  • Breakeven – When UseTrailingStop is true any open hedge trade that reaches Breakeven pips in profit will have it’s stop adjusted to the hedge trades entry price plus Lockin pips in profit
  • Lockin – Lockin profit pips.  Applied when Breakeven adjustment is reached.  See Breakeven
  • MagicNumber – hedge trade magic number

 

User Notes:

The Trade Hedger EA lets you hedge all trades for a particular currency pair; or only hedge trades with a specific magic number for that currency pair.  The currency pair is whatever the currency pair of the chart that you load the EA on.

The hedge trades themselves can optionally be market orders or pending stop orders.  Pending stop orders only become open if the prices moves against the already existing open order and hits the entry price of the pending stop order.

The hedge trades can have their own Stop and Take Profit points.  Further options include a Breakeven with or without Lockin profit pips.  Following the Breakeven adjustment, the hedge trade’s stop will become a trailing stop.

 

System Requirements
To run Metatrader 4 you should be using Windows 2000 or later, with a 2.0 GHz or faster CPU, and at least 512 MB RAM (although 1 GB is recommended). You should have a screen resolution of 1024 x 768 or higher, and an internet connection speed of 56 kbps or faster.

 

8 Responses so far.

  1. RAJESH BALACHANDRAN says:

    hi,
    will you provide the details of how to install and set the EA if i purchase the advisor from you??

    • admin8277 says:

      Hi Rajesh,

      To install the Trade Hedger EA you would Access the metatrader folders through the File->Open Data folder menu item on your MT4 platform.
      (don’t try and browse directly from C: because Metatrader uses virtual and hidden folders)

      Files and where they go:
      ————————
      – Trade Hedger.ex4 – put in ..MQL4\Experts folder
      – mt4algo sm logo.bmp – put in ..MQL4\Images folder

      use contact form on mt4Algo.com with any questions and I can go into more detail and provide pictures.

      Also if you Google or search on Youtube “install EA on Metatrader 4 platform”, you will find various guides and videos.

      Thanks,

      Chris

  2. Chief Marck De Castro says:

    Does this EA has option of compounding the lots for the next pending hedge trades? Also, does this automatically create new pending hedge orders based on the previous one once the previous pending order has been activated? Thanks.

    • admin8277 says:

      Hi Marck De Castro,
      In terms of lot size, the EA only creates a “hedge trade” whose lot size matches the lot size of the trade being hedged.
      If a pending hedge trade is activated, the EA does Not create a new pending hedge order. It will only hedge non-hedge trades.
      Thanks,
      Chris

  3. Cyran Cheung says:

    Hi Chris,

    may I ask if this EA can function as below?

    1. calculate all open orders lot-size in the currency. If the original positions are martingale orders, eg 0.01 0.02 0.04 0.08, could it calculate all open positions and set one hedging sell stop orders with 0.15 lots automatically?
    (or can I set the hedge trade at 0.15 lot in the beginning?)

    2. if the hedge sell order reach the breakeven point, it is closed. when the market price further goes down again, will it reopen the hedge sell order again?

    3. can it work for XAU and Index?

    • admin8277 says:

      Hi Cyran,
      Thanks for your post
      To answer your first bullet point, the Trade Hedger EA would open a hedge trade for each of the (martingale) trades that were currently open. So in your example, the EA would open 4 hedge trades one for each of your martingale trades.
      On your second bullet point, if an open “hedge” trade (not pending), reaches a point where it is floating a profit equal to it’s breakeven pips, then it will adjust its’ stop to be equal to its’ entry price (+/- any lockin pips).
      On your 3rd bullet point, the EA would run on any chart your Metatrader platform supports.

      Let me know if any questions.

  4. Howard King says:

    Hi Chris,

    Is this a one time purchase.?
    Are there any re occurring costs with this EA ?

    If I already have an EA running that places automatic trades can I run your hedge EA on the same pair but use a separate extra chart. ?

    Will the hedge EA find the trades that are being placed by my own auto trade EA ?

    Regards,

    Howard

    • admin8277 says:

      Hi Howard,

      Thank you for your interest in the Trade Hedger EA.

      To answer your questions:
      – Is this a 1-time purchase? Yes

      – If I already have an EA running on a particular currency pair chart can I run the Trade Hedger EA on another chart of the same currency pair? And will it then control any trades of that currency pair? Yes to both

      – Will the Trade Hedger EA find the trades placed by my own EA? Yes

      Hope that answers your questions. Let me know if not.

      – Chris