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

MQL4 Asesores Expertos

Trabajo finalizado

Plazo de ejecución 4 días
Comentario del Cliente
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.
Comentario del Ejecutor
Happy to work with you Oscar, hope we can do it again next time.

Tarea técnica

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. 

Han respondido

1
Desarrollador 1
Evaluación
(121)
Proyectos
134
66%
Arbitraje
36
25% / 56%
Caducado
22
16%
Libre
2
Desarrollador 2
Evaluación
(53)
Proyectos
74
26%
Arbitraje
30
10% / 63%
Caducado
22
30%
Libre
3
Desarrollador 3
Evaluación
(12)
Proyectos
17
29%
Arbitraje
6
17% / 67%
Caducado
4
24%
Libre
4
Desarrollador 4
Evaluación
(258)
Proyectos
395
28%
Arbitraje
69
19% / 49%
Caducado
120
30%
Libre
5
Desarrollador 5
Evaluación
(107)
Proyectos
149
36%
Arbitraje
29
3% / 55%
Caducado
35
23%
Libre
6
Desarrollador 6
Evaluación
(97)
Proyectos
121
25%
Arbitraje
5
20% / 60%
Caducado
17
14%
Libre
7
Desarrollador 7
Evaluación
(76)
Proyectos
136
45%
Arbitraje
11
27% / 64%
Caducado
26
19%
Libre
8
Desarrollador 8
Evaluación
(89)
Proyectos
137
24%
Arbitraje
35
9% / 40%
Caducado
52
38%
Libre
Solicitudes similares
hello here am looking for someone that can assist me in removing validation form my demo file and if anyone is interested dm the for more details i will be waiting to get any reply by some on that can assist me with this
I need an expert to trade Heiken Ashi candles according to the conditions in which Doji candles appear until signs of buying or selling appear, and to enter into trades after the Heiken Ashi candle above, using the scalping method, especially for gold and currency pairs with high liquidity. I have more details for those who want to prepare an expert
Current EA Description: I have an MT4 Expert Advisor (EA) named "Pending Orders" that manages virtual pending orders based on specific trade conditions. The EA can place either a buy limit, buy stop, sell limit, or sell stop order based on the chosen trade type and market price. The EA features include: Pending Order Placement: It places pending orders (buy/sell limit or buy/sell stop) based on the input price and
1. Trading behaviour: If blue supertrend is >= lower round number and <= the higher round number, EA will place a buy pending order at the higher round number. If red supertrend is <= higher round number and >=lower round number, EA will place sell pending order at the lower round number. EA should place the pending limit order ONLY when the current price is about 10 points above the limit order level. Check the
Hey developers! It is my pleasure to meet you. I am looking for a developer to help meet build and develop a simple EA robot that works based on EMAs. If you are a professional and expierenced MT4 programmer looking to work on this project, do bid for this project so that we can proceed and work on it. Thank you
Trading robots are programs, which operate according to underlying algorithms. An algorithm is a set of actions that need to be performed in response to certain events. For example, the most common task in algo trading is the identification of the "New bar" event. When the event occurs, the robot checks the emergence of trading signals and acts accordingly. Before you decide to program or order a trading robot, you
Hello, I am looking for developer who develops me a renko trading robo with following requirement Time :1 sec Box assignment method : Percentage change LTP Source : Close/OHLC Auto Break-even setup option after certain box Trialling Profit Pips after certain box profit with auto Sl set in PIPs Auto open reverse trade after hitting Sl with given conditions . It is very simple trading tool
At bot 30+ USD
Help me to trade create orders for me and analyze the markets and decide when is a good time to buy or sell. Determine which pairs are best to use to trade with and indicate trading signals to me
I currently have a Forex trading script in .txt format that I want to be converted to a functional/working robot (in .mq4), without altering the strategy of the script. The strategy of the script is already in and shouldn't be changed unless with mutual understanding
Hey greetings, It my pleasure to met you . I need a MT4 develop that can develop an EA based on alert . If you are a professional MT4 programmer you can kindly bid for this project and let proceed

Información sobre el proyecto

Presupuesto
10 - 50 USD
Para el ejecutor
9 - 45 USD
Plazo límite de ejecución
de 1 a 3 día(s)