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

MQL4 专家

工作已完成

执行时间4 天
客户反馈
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.
员工反馈
Happy to work with you Oscar, hope we can do it again next time.

指定

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. 

反馈

1
开发者 1
等级
(121)
项目
134
66%
仲裁
36
25% / 56%
逾期
22
16%
空闲
2
开发者 2
等级
(53)
项目
74
26%
仲裁
30
10% / 63%
逾期
22
30%
空闲
3
开发者 3
等级
(12)
项目
17
29%
仲裁
6
17% / 67%
逾期
4
24%
空闲
4
开发者 4
等级
(258)
项目
395
28%
仲裁
69
19% / 49%
逾期
120
30%
空闲
5
开发者 5
等级
(107)
项目
149
36%
仲裁
29
3% / 55%
逾期
35
23%
空闲
6
开发者 6
等级
(97)
项目
121
25%
仲裁
5
20% / 60%
逾期
17
14%
空闲
7
开发者 7
等级
(76)
项目
136
45%
仲裁
11
27% / 64%
逾期
26
19%
空闲
8
开发者 8
等级
(89)
项目
137
24%
仲裁
35
9% / 40%
逾期
52
38%
空闲
相似订单
All information is detailed in the attached EA diagram. I need a risk management EA build that calculated % amounts based on a snapshot of the starting balance each day, the initial balance and the floating balance. I then need to close positions based on this targets and also disable/enable algo trading. Quite basic ideas. Please see the attached image for all/more details and please let me know what you think/your
Halo These ACS&Csdash indicators work in the same way but provide signals of different currency pairs. And Either of these two ACS indicators should be selected any one and set to trade. It provides signals of multiple currency pairs in the interface So the EA should work like that to trade multiple currency pairs on one chart. CsDash should analyze whether it is a strong signal to show on the dash board and make a
Hello, Please I need help to connect a script to crypto Triangular Arbitrage to binance api to buy sell sell and buy buy sell step A Step B Step C minimum profit 0,3 and minimum 100 usdt , bnb in value 100 usdt and eth in value 100 usdt .Thanks
RSI 9 level 90/10 EA Indicators are 1. PSAR with step 0.01 max 0.02 2. Zigzag 3. SwR 1. At the close of candle at 0630 Pacific Standard Time. draw up and down of candles at 0625 and 0630 including the wick (allow in input) 2. Allow a breakout of either trend on up for buy and down for sell 3. Before buy. Ensure PSAR is in the buy position of candles above the PSAR line dot (Allow entry in input for setting) 4. TP1 on
I need a gold scalper EA which can trade in real environment. EA should open trades based on candlesticks close. Must have TP, Open SL, and should have DD control settings. If you can do just let me know. I may meed a test to make sure it opens real trades
Good morning. I would like to create HFT bot to trade on Prop Firm without breaking the rules. It should scalp. EA should have SL, TP, BE and even Trail Loss inputs. The EA should also have daily loss and profits target so when met the EA stops for the day
EA improvements 60+ USD
Hi, I want to improve an existing EA Ability to modify the main time frame and indicators settings. I will give you clear specifications and I will send you the source code. Best regards
Basil 50+ USD
thanks alot Very nice concept , but if I want to write a price action indicator with multiple prices (high,low,close,open)which calculates indicator value based on i.e difference of high and low there is a problem of having only one array of data (m_source_data in CIndicator class),is there a way to work around this or do you suggest to modify the CIndicator class and make the m_source_data an array of (mqlRates or
I want to deal in triangular forex arbitrage trading. I want an automated trading robot for the same. It is also expected that the developer advises me about the setting up the operations. I live in India, so he/she must know the ethical way to do it, be it international broker account or whatever. I just need to start this sooner but in the efficient way. The developer is expected to have some experience and should
Alex 30+ USD
//+------------------------------------------------------------------+ //| PriceAction.mq4 | //| Copyright 2023, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "2023" #property link " https://www.mql5.com " #property version "1.00" #property indicator_separate_window #property indicator_buffers 2 #property

项目信息

预算
10 - 50 USD
开发人员
9 - 45 USD
截止日期
 1  3 天