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

MQL4 Esperti

Lavoro terminato

Tempo di esecuzione 1 giorno
Feedback del cliente
Fantastic Guy, went above and beyond, stayed with me until 8.30 pm GMT and finally got it sorted.
Feedback del dipendente
Brilliant customer - Looking forward to the next project.

Specifiche

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());
                                 }
                              }
                            }
                          }

Con risposta

1
Sviluppatore 1
Valutazioni
(133)
Progetti
185
30%
Arbitraggio
77
9% / 73%
In ritardo
77
42%
Gratuito
2
Sviluppatore 2
Valutazioni
(169)
Progetti
218
50%
Arbitraggio
6
17% / 67%
In ritardo
11
5%
Gratuito
3
Sviluppatore 3
Valutazioni
(106)
Progetti
314
49%
Arbitraggio
42
52% / 19%
In ritardo
22
7%
Gratuito
4
Sviluppatore 4
Valutazioni
(28)
Progetti
36
17%
Arbitraggio
5
20% / 40%
In ritardo
17
47%
Gratuito
5
Sviluppatore 5
Valutazioni
(69)
Progetti
76
59%
Arbitraggio
0
In ritardo
12
16%
Gratuito
6
Sviluppatore 6
Valutazioni
(103)
Progetti
205
41%
Arbitraggio
17
29% / 71%
In ritardo
45
22%
Gratuito
7
Sviluppatore 7
Valutazioni
(6)
Progetti
5
0%
Arbitraggio
2
0% / 100%
In ritardo
1
20%
Gratuito
8
Sviluppatore 8
Valutazioni
(25)
Progetti
54
37%
Arbitraggio
4
0% / 50%
In ritardo
22
41%
Gratuito
9
Sviluppatore 9
Valutazioni
(121)
Progetti
134
66%
Arbitraggio
36
25% / 56%
In ritardo
22
16%
Gratuito
10
Sviluppatore 10
Valutazioni
(130)
Progetti
210
40%
Arbitraggio
90
20% / 43%
In ritardo
85
40%
Gratuito
11
Sviluppatore 11
Valutazioni
(1127)
Progetti
1429
62%
Arbitraggio
21
57% / 10%
In ritardo
43
3%
Gratuito
12
Sviluppatore 12
Valutazioni
(221)
Progetti
369
66%
Arbitraggio
10
50% / 0%
In ritardo
46
12%
Gratuito
13
Sviluppatore 13
Valutazioni
(1853)
Progetti
3455
88%
Arbitraggio
73
40% / 15%
In ritardo
265
8%
Gratuito
14
Sviluppatore 14
Valutazioni
(14)
Progetti
15
60%
Arbitraggio
2
0% / 100%
In ritardo
5
33%
Gratuito
15
Sviluppatore 15
Valutazioni
(46)
Progetti
73
16%
Arbitraggio
13
8% / 92%
In ritardo
37
51%
Gratuito
16
Sviluppatore 16
Valutazioni
(59)
Progetti
182
55%
Arbitraggio
31
45% / 16%
In ritardo
103
57%
Gratuito
17
Sviluppatore 17
Valutazioni
(52)
Progetti
133
44%
Arbitraggio
14
50% / 29%
In ritardo
55
41%
Gratuito
Ordini simili
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

Informazioni sul progetto

Budget
50 - 100 USD
Per lo sviluppatore
45 - 90 USD
Scadenze
da 3 a 5 giorno(i)