Hedge function for existing EA & Trailing stop for open positions if TP level is reached.

MQL4 Experts

Job finished

Execution time 4 days
Feedback from customer
My first time working with a freelancer here, Billy was a pleasure to work with. Very fast and highly skilled. My EA is greatly improved. Will work with him again and I can highly recommend him.
Feedback from employee
Happy to work with you Oscar, hope we can do it again next time.

Specification

Dear all,

I'm new to, but learning, MQL4 coding. I've created a very simple EA that I'm quite happy with. But I'd like to pay for some help with a few more complicated (at least for me) functions. I really want to improve my coding skills so I'd appreciate well-commented code. That way I can learn.

Please note that this EA is only aimed at short positions

What I'm looking for is to extend my EA with the following:

1 - Hedging short positions

  • I wish to prevent margin calls and negative liquidity/ equity fluctuations if a short position temporarily moves against me. 
  • I'd like to profit from the hedge position if my short position gets stopped out and the price keeps moving up. 

Specifically: 

  1. I'd like to have an input variable called something like "input double HedgeCost=10.0;"
  2. Every time my EA opens a short position, I'd like a buystop order to be placed at a level of the OpenSell price + HedgeCost. In this example, the buystop order would be triggered when the bid price reaches 10.0 PIP's above the OpenSell price).
  3. When the price moves down, I'd like the hedge position to be closed at OpenSell price - HedgeCost. And again, another BuyStop order should be placed, at OpenSell price + HedgeCost. So if the price moves up again, my short position will be hedged again.
  4. When my short position is closed by Take Profit or any reason except Stop Loss, I want the BuyStop order to be canceled.
  5. If my short position is closed due to a stop loss, the hedge position should be modified and a trailing stop should be placed at the exact level of where my short position got stopped out.

I also would like this hedge function to really attach to the ticket number. Because in the future, my EA may open several positions, and all of these need to be hedged. So it won't work if the hedge order is triggered by looking at the total open orders, it has to really check any open short position that hasn't got a hedge Buystop attached to it. And then hedge those that don't. 

 

2 - Trailing stop when TP is reached

I think this is relatively simple. Again I'd like to learn how to do this, based on your code.

  1. I'd like an input variable called something like "input int TrailingRange=3"
  2. When my short position almost reaches it's TP level, I'd like an OrderModify to happen so that the TP is removed and a trailing stop loss is put into place at the TP - TrailingRange level.
Thank you in advance and I look forward to your offer/ reply.

Best regards,

Oscar. 

Responded

1
Developer 1
Rating
(121)
Projects
134
66%
Arbitration
36
25% / 56%
Overdue
22
16%
Free
2
Developer 2
Rating
(53)
Projects
74
26%
Arbitration
30
10% / 63%
Overdue
22
30%
Free
3
Developer 3
Rating
(12)
Projects
17
29%
Arbitration
6
17% / 67%
Overdue
4
24%
Free
4
Developer 4
Rating
(258)
Projects
395
28%
Arbitration
69
19% / 49%
Overdue
120
30%
Free
5
Developer 5
Rating
(107)
Projects
149
36%
Arbitration
29
3% / 55%
Overdue
35
23%
Free
6
Developer 6
Rating
(97)
Projects
121
25%
Arbitration
5
20% / 60%
Overdue
17
14%
Free
7
Developer 7
Rating
(76)
Projects
134
44%
Arbitration
11
27% / 64%
Overdue
26
19%
Free
8
Developer 8
Rating
(89)
Projects
137
24%
Arbitration
35
9% / 40%
Overdue
52
38%
Free
Similar orders
Trade Notification EA 30 - 150 USD
Hello, I require an Expert Advisor (EA) for MetaTrader 5 (MT5) with the following features: Trade Notification : Whenever a new trade is opened or closed, the EA should send the trade information through HTTP push. Periodic Trade Information : Every 30 seconds, the EA should send information about the trades opened and closed in the last minute through HTTP push. Account & Equity Information : Every 5 minutes, the EA
PLEASE STATE YOUR BUDGET FOR INDIVIDUAL SECTIONS AND AS A WHOLE> SECTION 1 I want you to show me trade information Simple or complex MT4 Trade Dashboard=Show me what you have please by picture or file Win-rate Open Trades Closed Trades Profit Factor Risk % Daily, Weekly and Monthly Profit SECTION 2 Money Management & Trade Management It uses Fibonacci Calculations to trigger next trade sizes What I want to use is
Hello programmer this job basically work on between two EA ... primary EA which runs on MT4 and the secondry EA which can copy Data from Primary EA where multi clients can runs on Different MT4 without get Primary EA
Make EA 30+ USD
i can pay 40usd if completed by the end on today uk time this indicator will make a good ea but the aggressive entry moves and conservative entry is stationary and target tp2 which will make it a 0.3:1 aggressive entry is around a 1:1 with Tp 2 I want conservative entry and do aggressive entry pls do that too with the option too switch in the settings I want sl tp and trailing stop time filter and auto lots fixed lot
hello i need to modify my existing mt5 ea with some modifications step by step, we can discuss more details on message i will choose the best bid after discuss the details
Simple EA MT5 30+ USD
Hello i need EA can buy or sell multi symbols from 1 to 15 symbols in same time in specific time, for example I selected 2 symbols, The EA strat time in 10AM the EA for selected symbol let's say AUDUSD now above daily pivot the EA should execute buy position,And for second symbol let's say USDJPY now under daily pivot the EA should execute SELL position, And when the profit reach some profit the EA must close all
Hello, I have an indicator that counts days and plots vertical lines after specific interval days from specific dates. I want to convert it for my trading view following all the inputs and settings
Indicators are SMA, Support and Resistance with ZIgzag The steps are 1. At close of candle at 6:30am Pacific Standard Time2. Draw trend line from the top and bottom of the wick for the candles closed 6:25am PST and 6:30am PST. extending them forward 3. Draw second trend line from the top and bottom of the wick for the candles closed 6:30am PST and 6:35am PST. extending them forward 4. Look for a break in either
Smithdrift Ea 35+ USD
Ii have a manual trading trading I use to trade profitable Two time frame is use Indicators are Moving averages ,,macd,,and stochastic The strategy goes as follows ....on higher time frame window stochastic is concidered ... example 30 min time frame is use for this example ... stochastic on 30 min diverge. Main line dross signal line ()above that is a buy signal (2) 1 min chart is concider as filter ...macg default
You must read English..........no exceptions You must write English..........no exceptions You must understand English..........no exceptions You must speak English..........no exceptions. you will also have to work best in Eastern Standard Time. This will be a trading robot for MetaTrader 5. the strategy consist of bollinger bands , a couple of Moving Averages and price actions

Project information

Budget
10 - 50 USD
For the developer
9 - 45 USD
Deadline
from 1 to 3 day(s)