HEDGE BASKET EA Hedging then Averaging Down Money Management EA Budget 100 USD Deadline 3 days I need someone to compile the following MT4 Expert Advisor for me. I'd like the source code to be provided at the end of the job. The EA is to be a Trade Manager and should not be opening entry trades. It should manage opened trades ,doesn't matter what size, that are opened manually or by another EA and manage each and every trade. When I drag it onto a chart it goes into effect immediately. I’d like it to be able to work on any build of MT4. I need an EA that automatically places a hedge on ALL open orders when dragged onto the chart. Then, if the hedge fails, open a basket of 'averaging down' trades to try and recoup losses. Trade scenario 1: 1. I open a manual buy market order at 1.6600 with 0.1 Lots and TP =10 pips/100 points and SL =10 pips/100 points. 2. The EA must automatically open a SELL STOP order (say with 1.0 lot size) where the original buy order's Stop Loss is, i.e. Sell order at 1.6500. Let's call this hedge order HEDGE 1. 3. The buy trade closes in 10 pips/100 points profit and is closed. 4. The EA should instantly close the SELL STOP order or HEDGE 1. Trade scenario 2: 1. I open a manual buy market order at 1.6600 with 0.1 Lots and TP =10 pips/100points and SL =10 pips/100 points. 2. The EA must automatically open a SELL STOP order (say with 1.0 lot size) where the original buy order's Stop Loss is at 1.6500. Let's call this hedge order HEDGE 1. 3. The buy trade closes in 10 pips/100 points loss and is closed. 4. The SELL STOP order or HEDGE 1 meanwhile is opened at 1.6500. If it had a STOP LOSS, it has to be removed. 5. The EA must now instantly open a BUY ORDER or HEDGE 2 where the original buy market order was at 1.6600. (with size of my choosing) 6. The Sell order or HEDGE 1 closes in profit. 7. The EA must then instantly close HEDGE 2 as well. Trade scenario 3: 1. I open a manual buy market order at 1.6600 with 0.1 Lots and TP =10 pips/100points and SL =10 pips/100 points. 2. The EA must automatically open a SELL STOP order (say with 1.0 lot size) where the original buy order's Stop Loss is at 1.6500. Let's call this hedge order HEDGE 1. 3. The buy trade closes in 10 pips/100points loss and is closed. 4. The SELL STOP order or HEDGE 1 is opened at 1.6500. If it had a STOP LOSS, it has to be removed. 5. The EA must now instantly open a BUY ORDER or HEDGE 2 where the original buy market order was at 1.6600. (with the exact same lot size as HEDGE 1) 6. The Sell order or HEDGE 1 goes against me and reaches 1.6600 but stays open. If it had a STOP LOSS, it had to be removed. 7. The buy order or HEDGE 2 at 1.6600 is opened, thus LOCKING the buy and sell trades. In other words, they have the same lot size so they are now 'locked'. THIS IS WHEN THE EA has to 'average down' these open hedged trades. 1. We have a buy at 1.6600 and a sell at 1.6500. 2. We now wait until either the buy or the sell closes at it's Take Profit. 3. Let's say the buy goes to it's Take Profit at 1.6610 and gives $100 in profit. The buy trade is closed and the sell remains open. 4. The EA must then open another SELL trade at 1.6610 where the buy trade was closed. The lot size is going to be chosen by the EA input. 5. So, we have a SELL at 1.6500 and a SELL at 1.6610. 6. The two sell trades together reach a profit level that covers the original loss {the loss buy trade at 1.6600 of 0.1 lot size + spread + commission + swaps} and the whole basket is closed. 7. If the SELL at 1.6500 and a SELL at 1.6610 runs against me and reaches 1.6620, another SELL is opened. 8. The three sell trades together reach a profit level that covers the original loss {the loss buy trade at 1.6600 of 0.1 lot size + spread + commission + swaps} and the whole basket is closed. HEDGE BASKET EA INPUTS or PARAMETERS Magic - the magic number of the HEDGE BASKET EA's pending orders. Slippage maximum allowable price slippage in points when opening and closing positions. Symbol Monitoring On/Off ON/OFF If off, then only monitor by Magic Number and /or Ticket Number Symbol Monitoring pairs ALL_SYMBOLS = monitoring all currency pairs and all trades on the account, so even if you launch the Expert Advisor on any currency pair chart, it will monitor all currency pairs. If only three currency pairs have to be monitored, for e.g., then specify them separated by commas. E.g. EURUSD, GBPUSD, USDCHF Magic Number Monitoring On/Off ON/OFF If off, then only monitor by Symbol and /or Ticket Number If both Symbol Monitoring On/Off and Magic Number Monitoring On/Off is off, then ONLY monitor TICKET NUMBERS. Magic Number Monitoring (should be able to use in conjunction with Ticket # Monitoring) This is the parameter that regulates the magic number of the open trades that the expert will analyze. -1 = means all magic numbers will be monitored 777 for example = means that it will only analyze transactions with magic number 777.If more than one magic number, then specify multiple values separated by commas. 0 = means that it will analyze only the manual transactions Ticket #_Monitoring (should be able to use in conjunction with Magic Number Monitoring) -1 = means all ticket numbers will be monitored If a ticket number is put in here, for example, 109258793, then the EA must only monitor that particular trade. If more than one ticket number, then specify multiple values separated by commas. Hedge 1 Distance in pips 0.0 pips. This is the distance from the original market order or opened trade. If 0, then the original market order or opened trade's Stop Loss is where Hedge 1 must place a pending order. Hedge 1 Lot size 0.0 The size of the pending order or Hedge 1 Hedge 1 Stop Loss 0.0 in pips. Default is NO stop loss at all. Hedge 1 Take Profit 0.0 in pips. Default is NO Take Profit at all. Hedge 2 Distance in pips 0.0 pips. This is the distance from Hedge 1. If 0, then this is where the original market order or opened trade was. Hedge 2 Lot size 0.0 The size of the pending order or Hedge 2. Default = same lot size as Hedge 1 Hedge 2 Stop Loss 0.0 in pips. Default is NO stop loss at all. Hedge 2 Take Profit 0.0 in pips. Default is NO Take Profit at all. Remove TAKE PROFIT of Hedge 1 if Take Profit Active TRUE/FALSE- delete the take profit of Hedge 1 upon the activation of Hedge 2 pending order. Remove STOP LOSS of Hedge 1 if Stops Active - TRUE/FALSE-delete the stop loss of Hedge 1 upon the activation of Hedge 2 pending order. Average Down when Hedge is broken (HEDGE 1 closes or HEDGE 2 closes and one is left open) TRUE/FALSE If FALSE then begin averaging down even while hedge is on (HEDGE 1 and HEDGE 2 still open) Average Down Max Orders Open the maximum number of opened orders, 0 = unlimited. Average Down Take Profit ALL 0.0 in pips. This is the total take profit of all 'averaging' trades, including Hedge1 and/or Hedge 2 (whichever is still open). For example, 10.0 pips, then if all open orders = 10 pips in profit, close them all Average Down Take Profit in $ 0.00 in $ or the broker's currency. This is the total take profit of all 'averaging' trades, including Hedge1 and/or Hedge 2 (whichever is still open). If there are values for both Average Down Take Profit ALL and Average Down Take Profit in $, then take whichever comes first. E.g. I put Average Down Take Profit ALL =10.0 pips and Average Down Take Profit in $ = $3 and the total basket's profit reaches $3 before reaching 10 pips, then close all open trades in this basket for $3. Average Down Stop Loss ALL 0.0 in pips. This is the total drawdown in pips of ALL averaging orders together. Once this is hit ALL orders in the 'averaging' basket must be closed. Average Down Distance 0.0 in pips. The distance for the opened grid positions for opening 'averaging' trades. If 10.0 pips, then each 'averaging' order must be placed 10 pips apart. Average Down Lot Size 1.0 (default 1.0 = same lot size as HEDGE 1 or HEDGE 2) Lot Size increase multiplier for the grid of positions being 'averaged down'. If, for example, 1.0, then all 'averaging' grid orders are the same size as the HEDGE or HEDGES. If, for example, 1.5, then 1.5 on first 'averaging' order and 2.25 on the one after that, etc. So it gets progressively higher until the whole basket is closed. If for example, 2.0, then double HEDGE 1 or HEDGE 2 lot size and keep doubling until the whole 'basket' is closed