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

MQL4 エキスパート

仕事が完了した

実行時間1 日
依頼者からのフィードバック
Fantastic Guy, went above and beyond, stayed with me until 8.30 pm GMT and finally got it sorted.
開発者からのフィードバック
Brilliant customer - Looking forward to the next project.

指定

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

応答済み

1
開発者 1
評価
(133)
プロジェクト
185
30%
仲裁
77
9% / 73%
期限切れ
77
42%
2
開発者 2
評価
(169)
プロジェクト
218
50%
仲裁
6
17% / 67%
期限切れ
11
5%
3
開発者 3
評価
(106)
プロジェクト
314
49%
仲裁
42
52% / 19%
期限切れ
22
7%
4
開発者 4
評価
(28)
プロジェクト
36
17%
仲裁
5
20% / 40%
期限切れ
17
47%
5
開発者 5
評価
(69)
プロジェクト
76
59%
仲裁
0
期限切れ
12
16%
6
開発者 6
評価
(103)
プロジェクト
205
41%
仲裁
17
29% / 71%
期限切れ
45
22%
7
開発者 7
評価
(6)
プロジェクト
5
0%
仲裁
2
0% / 100%
期限切れ
1
20%
8
開発者 8
評価
(25)
プロジェクト
54
37%
仲裁
4
0% / 50%
期限切れ
22
41%
9
開発者 9
評価
(121)
プロジェクト
134
66%
仲裁
36
25% / 56%
期限切れ
22
16%
10
開発者 10
評価
(130)
プロジェクト
210
40%
仲裁
90
20% / 43%
期限切れ
85
40%
11
開発者 11
評価
(1127)
プロジェクト
1429
62%
仲裁
21
57% / 10%
期限切れ
43
3%
12
開発者 12
評価
(221)
プロジェクト
369
66%
仲裁
10
50% / 0%
期限切れ
46
12%
13
開発者 13
評価
(1853)
プロジェクト
3455
88%
仲裁
73
40% / 15%
期限切れ
265
8%
14
開発者 14
評価
(14)
プロジェクト
15
60%
仲裁
2
0% / 100%
期限切れ
5
33%
15
開発者 15
評価
(46)
プロジェクト
73
16%
仲裁
13
8% / 92%
期限切れ
37
51%
16
開発者 16
評価
(59)
プロジェクト
182
55%
仲裁
31
45% / 16%
期限切れ
103
57%
17
開発者 17
評価
(52)
プロジェクト
133
44%
仲裁
14
50% / 29%
期限切れ
55
41%
類似した注文
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

プロジェクト情報

予算
50 - 100 USD
開発者用
45 - 90 USD
締め切り
最低 3 最高 5 日