Please insert function into EA

MQL4 Experts

Job finished

Execution time 1 day
Feedback from customer
2nd time I used him and very impressed by his work

Specification

Hi 

 

I wanted to add the function into my EA.The code does a partial close on an order that has x amount of pips in the negative 

 

void CheckNewOrderClosed()

  {

   for(int i=OrdersHistoryTotal()-1;i>=0;i--) // check for closed orders

   {

    bool select=OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);

    if(OrderSymbol()==Symbol())               // if order with the same symbol 

    {

     if(OrderProfit()<0||OrderCloseTime()<LastCheckedTime)return;  // if order profit is in loss or order checked before then stop

     else if(GetBiggestLossOrderTicket()>0)                   // else proceed to close partial lot if there is order with -500 loss

     {

      select=OrderSelect(GetBiggestLossOrderTicket(),SELECT_BY_TICKET,MODE_TRADES);      // select biggest loss order with ticket number

      double partialLotToClose=0.01;

      bool closePartial=OrderClose(OrderTicket(),partialLotToClose,OrderClosePrice(),3);

      LastCheckedTime=TimeCurrent();

     }

    }

   }

  }

  

  

  

  

  int GetBiggestLossOrderTicket()   // function to get ticket number for biggest loss order 

  {

   int ticket=0;

   double pips,MaxStoredLoss;

   for(int i=OrdersTotal()-1;i>=0;i--)      // check for opened orders

   {

    bool select=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);

    if(OrderSymbol()==Symbol())

    {

     if(OrderType()==OP_BUY)

     {

      pips=(Bid-OrderOpenPrice())/point;  // calculate order pips profit

     }

     else if(OrderType()==OP_SELL)

     {

      pips=(OrderOpenPrice()-Ask)/point;  // calculate order pips profit

     }

     

     if(pips<=-20)   //if pips less than -500 pips then store the order info

     {

      if(pips<MaxStoredLoss) // store there is multiple orders with loss then store max loss order

      {

       MaxStoredLoss=pips;    // set max loss stored as the new order loss 

       ticket=OrderTicket();  // store order ticket

      }

     }    

    }

   }

   return(ticket);

 

 

 

 

The EA is attached with default setting.Place it in the strategy tester to see what it does.It basically places 8 pending order on a price level at set intervals.4 long and 4 short.

The orders have no SL only TP and then it closes all open orders when a certain profit level is reached.Please ask if unsure.

 


 

I want to have external setting for it please

 

Lots to be closed = ;

Distance to start partial closes  = ;

 

Please let me know if you want to the job

 

Thank you for your time

Files:

Responded

1
Developer 1
Rating
(180)
Projects
301
30%
Arbitration
54
24% / 56%
Overdue
98
33%
Free
2
Developer 2
Rating
(439)
Projects
545
25%
Arbitration
21
38% / 38%
Overdue
83
15%
Free
3
Developer 3
Rating
(218)
Projects
404
60%
Arbitration
13
38% / 23%
Overdue
160
40%
Free
Similar orders
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

Project information

Budget
10+ USD
For the developer
9 USD