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
136
45%
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
I need to get a trading forex robot based on support and accurate resistance and moving avarage more details will be provided on the video links I want a situation where by once I put the robot on the chart and choose buy or sell and the number to open then it will only buy or sell in that particular direction only
NADGIO 30+ USD
I need a developer that can convert two Buy and Sell indicators into a trading robot. the indicators has an input parameter, this should be made available for adjustment. Features 1. Break Even 2. Trailing Stop 3. Global TP and SL 5. Time Filter 6. News Filter (If possible)
I need a developer who can convert trading view indicator in to mt5 expert advisor with some modifications. The other details will shared once chosen the developer. Looking for someone who has good knowledge of forex, mql5,and pine script
Hello, i hope you all well. I am looking or a good developer who can understand SCM/ICT concepts so that can modify an existing EA to trade against that. The EA is already there with code and it was trading based on Breakouts zones. Now i want the EA to be modified so that it trades based on inducements and liquidity. The EA should use Pending orders on those zones instead. I do not want new developers to apply
EA for index trading using ATR % of 5day 1 Give Average true range for the past 5 day so 5day ATR also for ref use the indicator "atr value indicator " my entries will be based on a % of this NO. NO. TO BE SHOWN IN TOP CORNER The Expert im looking for is 1.AT X TIME (ie 8:am ) 2.IF price moves X % of the 5 day atr( either up or down ) within Y TIME (IE 5MINUTES ) (if PRICE moves say 30% of the 5 day atr down i buy or
I want to create an Expert Advisor (EA) that can be set to open either buy or sell trades, depending on user preference (buy-only or sell-only mode). The EA will initiate trades when the market reaches (or is equal to or less than) a specified DeMarker value (e.g., DeMarker value = 0.3). The user will set both the DeMarker value for starting trades and another DeMarker value to stop opening new trades. - **DeMarker
Create a mql5 expert advisor for forex/commodities trading based on modified candlestick formation. If modified bullish engulfing appears, EA will open buy position at closing of last candle area with martingale until opening of last candle area and set stop loss at open last candle area. Trailing stop appears when half of all buy positions running profit then when all buy positions running profit, and so on. If
I want to grid based robot such like CM Manual Grid for mt 5 Snap of that attached. like The expert Advisor helps set a network of pending orders and collect profit from any price movement. I can use it to trade many grid strategies. I can also use it to track open positions. "Buy Stop — - open a network of pending stop orders for sale "Sell Stop" - open a network of pending stop orders for purchase "Buy Limit" -
I have developed a very strong TradingView strategy in Pine Script but unfortunately, a third-party connector is requiired and in my opinion, I want a more direct connection. I am not brilliant at coding, but I have coded the majority of the MT5 code and I would like you to make sure that the MT5 code matches my TradingView script and executes the same way as the TradingView script
Hi, I would like to have an EA to open trade when 2 time frame met the condition. Need to have ability to select the TF combination, Example: H4 with H1, H1 with M15 etc. PS: Able to lock EA with "Name" or "Account Number" PSS: Able to set trading session for specific pair. Example: US session = EURUSD For Buy #1 Big TF Candle Closed Outside Top BB #2 Big TF Candle touch low MA #3 Got to Smaller TF Candle touch &

Project information

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