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

MQL4 Uzman Danışmanlar

İş tamamlandı

Tamamlanma süresi: 1 gün
Müşteri tarafından geri bildirim
Fantastic Guy, went above and beyond, stayed with me until 8.30 pm GMT and finally got it sorted.
Geliştirici tarafından geri bildirim
Brilliant customer - Looking forward to the next project.

İş Gereklilikleri

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

Yanıtlandı

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

Proje bilgisi

Bütçe
50 - 100 USD
Geliştirici için
45 - 90 USD
Son teslim tarihi
from 3 to 5 gün