I am looking for someone who can help me with a simple EA for MQ4 but is kind of different. I hope you can help, Please read below:
Trailing Order EA
What is a Trailing Order?
The traditional pending order (Good Till Cancel Order or Stop Loss) is static and is only triggered at a fixed price set by a user, the Trailing Order is designed to dynamically update the order price as the currency price moves based on a trailing parameter entered by trader.
The Trailing Order is similar to a simple GTC or Stop Loss order, however instead of a fixed order price, the user is required to enter a trailing parameter of X points value above (for Sell Trailing GTC Orders or for Stop Loss Orders linked to Buy position) or below (for Buy Trailing GTC Orders or for Stop Loss Orders linked to Sell position) the market price, thereby creating a moving or trailing trigger order price. Thus the trailing parameter can be entered only in points (or pips) to the current price.
So, &#1072; Trailing order isn't entered at an exact price, but rather, at a specified distance from the price at which the primary order will be filled. For sell Trailing Orders the activation price only moves upward, and for buy Trailing Orders the activation price only moves downward.
For Sell Trailing Orders, your trailing order's trigger sell price, is re-calculated upwards (based on the trailing parameter you entered) each time a new currency price high is reached from the point of order placement. If the price begins to fall and reaches or falls below the calculated order Price, your order will be triggered and executed.
For Buy Trailing Orders, your trailing order's trigger buy price, is re-calculated downwards (based on the trailing parameter you entered) each time a new currency price low is reached from the point of order placement. If the price begins to rise and reaches or exceeds your calculated order Price, your order will be triggered and executed.
For example, you place a «Sell» Trailing GTC with a parameter of 20 points and current market price for EURUSD is 1.2762. The activation price is calculated by taking the current price and subtracting the stop parameter. In this example initial activation price would be 1.2742 (1.2762 minus 20 pips or 0.0020). If the currency never goes higher than 1.2762, the order will be executed when the price hits 1.2742. If the currency goes to 1.2763, the activation price becomes 1.2743 (if 1.2765 ... than 1.2745), and so on (order follow, or "trail", currency price as it rises). So, if the market price rises, the orders rate rises by this amount, but if the market price falls, the orders rate doesn't change. For «Buy» Trailing GTC the activation price is calculated by taking the current price and adding the stop parameter and so on.
1) EA needs to work on all Currency Pairs.
2) EA needs to work on all Time Frames.
3) EA must override brokers minimum or maximum price set for pending orders.
When manually setting a pending order some brokers require a minimum pip distance from your order to the market price. This EA must be able to trail the market price with a very tight distance.
4) Trailing orders must start immediately when placed.
Metatrader has this problem - if you put a 30 pip trailing stop on your open order, once the market moves to a position that your trade is 30 pips up, the trailing stop will kick in, thus moving your Stop Loss to the point you made the trade. The Trailing stop does NOT KICK IN UNTIL PRICE MOVES TO A POSITION IN YOUR FAVOR EQUALING YOUR TRAILING STOP AMOUNT.
This cannot happen with this EA. The trailing pending order must KICK IN immediately whenever an order is filled. For example if a pending trailing sell order that has been set to trial the market price UP at 20 pips is hit because the market price has reversed and started coming down and an actual sell position is placed because of the hit – immediately at the time that position is placed – a trailing buy order is placed 20 pips above the market price, chasing the market price down.
5) This EA can be set to always be in the market.
As soon as a trailing order is hit the EA closes the open order and simultaneously opens another one in the opposite direction. Note: If market price gaps over the trailing order and does not hit the exact price as the trailing order because of the gap, the open position is still closed and a new position is opened. There is no minimum or maximum slippage.
6) This EA can also have a choice of only taking Buy orders or only taking Sell orders.
It trails the market price just like requirement #5 above but can be set to only take one directional orders. For instance, the EA can be set to only take all buy orders – but – each and every buy order would be exactly like the buy orders in requirement #5 above. The only difference would be all sell orders would be ignored. The same for only Sell orders.
7) The trailing order must show on the chart as a visible horizontal line.
(Blue for trailing Buy orders and Orange for trailing Sell orders)
This line should be able to show up on any chart type.
(Candle, Point n Figure, Heiken Ashi, etc..)
It should be able to do this for this EA only tracks the current market price, not (open, close, high, or low in any time frame).
8) All Trailing ‘BUY’ orders need to trail the current ‘ASK’ price (not the close).
9) All Trailing ‘SELL’ orders need to trail the current ‘BID’ price (not the close).
10) If possible, all trailing entry orders should be an actual pending order, not just an indicator line on the chart. This is in case the connection is lost with the server and the EA no longer has control. This will insure the last trailing order is still in place as a static stop loss order and will protect any currently open order. Hopefully this can be accomplished by the EA actually placing pending orders then changing it with every tick as the order needs to trail the price. (if this is too much for the EA then other options can be considered).
EA Input Variables:
Lots per Trade:
(from minimum of 0.01 - to - no maximum)
Default = 1.0
Direction for First Trailing Order:
(one needs to pick if the first trade is a trialing order up to sell when hit - or -
a trailing order down to buy when hit).
1- Trail UP to Sell (Default)
2- Trail DOWN to Buy
Distance to Trail:
(one must pick the pip distance to trail the market price for the trailing order).
Default = 20 pips
Min. to be 2 pips, Max. to be 500 pips
(This EA must work with 5 digit brokers or 4 digit brokers. If this needs to be an input variable that is o.k.)
(One needs to pick what trailing orders will actually be active)
1- Both ‘Buy’ & ‘Sell’ Trailing Orders (Default)
2- ONLY ‘Buy’ Trailing Orders
3- ONLY ‘Sell’ Trailing Orders
That is the trading system. Can you help? I sure hope so.