Code Needed to Move Market Positions to Breakeven | MQL4 for Metatrader

MQL4 Asesores Expertos

Trabajo finalizado

Plazo de ejecución 1 día
Comentario del Cliente
Fantastic Guy, went above and beyond, stayed with me until 8.30 pm GMT and finally got it sorted.
Comentario del Ejecutor
Brilliant customer - Looking forward to the next project.

Tarea técnica

Hello,

I'm looking for an developer to implement a coding strategy to modify any market order positions to beak even when I profit 100 pips, the current code I have so far is below. However, I'm having trouble getting this to actually modify any orders. There are no errors in the journal so there shouldn't be anything wrong specifically with the code, but clearly one or more conditions are not being met without my knowledge.

If any developer could alter the code to so as my market positions move to breakeven,. this would be much appreciated. 

			for(int s=OrdersTotal()-1;s>=0;s--)
                        {
                        if(OrderSelect(s,SELECT_BY_POS,MODE_TRADES)==true)
                           {
                           double   anAskPrice  =  MarketInfo(Symbol(),MODE_ASK);
                           double   tick        =  MarketInfo(Symbol(),MODE_TICKSIZE);
                           double   anOpenPrice =  OrderOpenPrice();
                           double   aCurrentSL  =  OrderStopLoss();
                           double   aNewSLPrice =  OrderOpenPrice();
                           double   tp          =  OrderTakeProfit();
                           int      pnlPoints   =  int((anOpenPrice - anAskPrice)/_Point);
                           int      stopPoints  =  int((aNewSLPrice - anAskPrice)/_Point);
                           int      stopLevel   =  int(MarketInfo(Symbol(),MODE_STOPLEVEL)+MarketInfo(Symbol(),MODE_SPREAD));
                           int      aTicket     =  OrderTicket();
                           int      breakeven   =  100;   
                           if(OrderType()==OP_SELL)
                           if(pnlPoints>breakeven)
                           if(stopPoints >stopLevel)
                           if(pnlPoints>breakeven)
                           if(anOpenPrice-anAskPrice>breakeven*_Point)
                           if(aNewSLPrice!=aCurrentSL)
                              {
                              SellMod = OrderModify(aTicket,anOpenPrice,anOpenPrice,tp,0,sellcolor);
                              PrintFormat("OrderOpenPrice %7.5f CurrentPrice %7.5f",anOpenPrice,anAskPrice);
                              SendMail("Notification of Order Modification for Ticket#"+IntegerToString(OrderTicket(),10),"Good news! Order Ticket#"+IntegerToString(OrderTicket(),10)+"has been changed to breakeven");
                              SendNotification("Ticket# "+IntegerToString(aTicket,10)+" has been modified to breakeven");
                              if(!SellMod)
                                 {
                                 PrintFormat("OrderOpenPrice %7.5f CurrentPrice %7.5f",anOpenPrice,anAskPrice);
                                 PrintFormat("Order modification for ticket %10d has failed to modify the order under the Error Code# %5d. Check MQL4 Documentation",aTicket,GetLastError());
                                 }
                              }
                            }
                          }
                         
                      for(int b=OrdersTotal()-1;b>=0;b--)
                        {
                        if(OrderSelect(b,SELECT_BY_POS,MODE_TRADES)==true)
                           {
                           double   anBidPrice  =  MarketInfo(Symbol(),MODE_BID);
                           double   anOpenPrice =  OrderOpenPrice();
                           double   aCurrentSL  =  NormalizeDouble(OrderStopLoss(),Digits);
                           double   aNewSLPrice =  NormalizeDouble(OrderOpenPrice(),Digits);
                           double   tp          =  OrderTakeProfit();
                           int      pnlPoints   =  int((anBidPrice - anOpenPrice)/_Point);
                           int      stopPoints  =  int((anBidPrice - aNewSLPrice)/_Point);
                           int      stopLevel   =  int(MarketInfo(Symbol(),MODE_STOPLEVEL)+MarketInfo(Symbol(),MODE_SPREAD));
                           int      aTicket     =  OrderTicket();
                           int      breakeven   =  100;   
                           if(OrderType()==OP_SELL)
                           if(pnlPoints>breakeven)
                           if(stopPoints >stopLevel)
                           if(pnlPoints > breakeven)
                           if(anBidPrice-anOpenPrice>breakeven*_Point)
                           if(aNewSLPrice!=aCurrentSL)
                              {
                              SellMod = OrderModify(aTicket,anOpenPrice,aNewSLPrice,tp,0,sellcolor);
                              SendMail("Notification of Order Modification for Ticket#"+IntegerToString(OrderTicket(),10),"Good news! Order Ticket#"+IntegerToString(OrderTicket(),10)+"has been changed to breakeven");
                              SendNotification("Ticket# "+IntegerToString(aTicket,10)+" has been modified to breakeven");
                              if(!SellMod)
                                 {
                                 PrintFormat("Order modification for ticket %10d has failed to modify the order under the Error Code# %5d. Check MQL4 Documentation",aTicket,GetLastError());
                                 }
                              }
                            }
                          }

Han respondido

1
Desarrollador 1
Evaluación
(133)
Proyectos
185
30%
Arbitraje
77
9% / 73%
Caducado
77
42%
Libre
2
Desarrollador 2
Evaluación
(169)
Proyectos
218
50%
Arbitraje
6
17% / 67%
Caducado
11
5%
Libre
3
Desarrollador 3
Evaluación
(106)
Proyectos
314
49%
Arbitraje
42
52% / 19%
Caducado
22
7%
Libre
4
Desarrollador 4
Evaluación
(28)
Proyectos
36
17%
Arbitraje
5
20% / 40%
Caducado
17
47%
Libre
5
Desarrollador 5
Evaluación
(69)
Proyectos
76
59%
Arbitraje
0
Caducado
12
16%
Libre
6
Desarrollador 6
Evaluación
(103)
Proyectos
205
41%
Arbitraje
17
29% / 71%
Caducado
45
22%
Libre
7
Desarrollador 7
Evaluación
(6)
Proyectos
5
0%
Arbitraje
2
0% / 100%
Caducado
1
20%
Libre
8
Desarrollador 8
Evaluación
(25)
Proyectos
54
37%
Arbitraje
4
0% / 50%
Caducado
22
41%
Libre
9
Desarrollador 9
Evaluación
(121)
Proyectos
134
66%
Arbitraje
36
25% / 56%
Caducado
22
16%
Libre
10
Desarrollador 10
Evaluación
(130)
Proyectos
210
40%
Arbitraje
90
20% / 43%
Caducado
85
40%
Libre
11
Desarrollador 11
Evaluación
(1127)
Proyectos
1429
62%
Arbitraje
21
57% / 10%
Caducado
43
3%
Libre
12
Desarrollador 12
Evaluación
(221)
Proyectos
369
66%
Arbitraje
10
50% / 0%
Caducado
46
12%
Libre
13
Desarrollador 13
Evaluación
(1853)
Proyectos
3455
88%
Arbitraje
73
40% / 15%
Caducado
265
8%
Libre
14
Desarrollador 14
Evaluación
(14)
Proyectos
15
60%
Arbitraje
2
0% / 100%
Caducado
5
33%
Libre
15
Desarrollador 15
Evaluación
(46)
Proyectos
73
16%
Arbitraje
13
8% / 92%
Caducado
37
51%
Libre
16
Desarrollador 16
Evaluación
(59)
Proyectos
182
55%
Arbitraje
31
45% / 16%
Caducado
103
57%
Libre
17
Desarrollador 17
Evaluación
(52)
Proyectos
133
44%
Arbitraje
14
50% / 29%
Caducado
55
41%
Libre
Solicitudes similares
I have an EA and want to add few new logic to fetch profit taking factors and other values from an external master data and use it in existing EA
Hello Every one, Good day, I want from someone professional to create an EA is working on Mt5, This EA is working by depend on some indicators, and all those indicators must be working on MACD window, not on the chart, for more details please read my attached pdf file carefully. Many Thanks
I'm looking for an expert MQL5 developer that can create an EA that's based on my price action trading strategy with no indicators. The EA must analyze trades based on my price action rules, enter trades based on my price action rules, manage trades based on my price action rules and exit trades based on my price action rules
hi hi there i have an strategy on tradingview and i want to automate it like metatrader EA so i want the strategy to open and close trade automaticlly on tradingview
We are looking for an experienced Expert Advisor Developer who can build a customized MT5 Expert Advisor for us. The Expert Advisor would use two built-in indicators as entry/exit signals and our own risk management strategy with customizable inputs. The goal is to create a reliable and efficient trading tool that can automate our trading process on the MT5 platform. Skills required: - Strong understanding of
I need stochastic div (hidden &regular ea) that should perform task in all tf's ..divergence is a repaint stly so i want to use it with candlestick flips .. so bet for it
Hello, I have an indicator from a friend and I'd like to replicate it on my own TradingView or MT5 platform. Could you assist me with that?. Here is the link
so basically I have an EA(mql5), AI script(python), flask server and socket server both on python. Now this is an experimental script as I am trying to learn. However the EA is not entering any trades. How much would it cost for you to troubleshoot this for me? Thank you in advance
NEW FUNCTION 50+ USD
La idea es la siguiente, sería un EA semi automático. Yo como trader opero en zonas. En adelante las vamos a denominar ``zonas calientes´´. El EA debe que necesito debe operar conforme a 4 zonas calientes que yo configure en el mismo. ¿Qué hará el EA en cada una de esas zonas calientes que yo he configurado? En cada una de estas zonas el EA debe realizar hedging (crear un rango en el cual el EA entrara en sell o en
I have the bot just over half made, from another developer who let me down and decided they no longer wished to finish the project, so I have a basic example of the fundamentals of what it could look like, although multiple functions I require do not work, but I can show this to you on request. There are multiple features that I require, so please read the in depth requirement sheet on the attachment. Function: To

Información sobre el proyecto

Presupuesto
50 - 100 USD
Para el ejecutor
45 - 90 USD
Plazo límite de ejecución
de 3 a 5 día(s)