Please insert function into EA

MQL4 专家

工作已完成

执行时间1 一天
客户反馈
2nd time I used him and very impressed by his work

指定

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

附加的文件:

反馈

1
开发者 1
等级
(180)
项目
301
30%
仲裁
54
24% / 56%
逾期
98
33%
空闲
2
开发者 2
等级
(439)
项目
545
25%
仲裁
21
38% / 38%
逾期
83
15%
空闲
3
开发者 3
等级
(218)
项目
404
60%
仲裁
13
38% / 23%
逾期
160
40%
空闲
相似订单
Hi, I have an indicator from my friend, I want to copy it to my own MT5 can you do that for me. Here is the link
I'm looking for someone to help me create an arbitrage trading robot that can trade on any decentralized exchange and forex market. I already have some source code to a strategy but would like to enhance it to make it profitable and automated
I installed the E.A. into the Experts folder in MT4. When I double click on it nothing happens. When I right click and "attach to chart" nothing happens. The E.A. is not grayed out, it simply will not attach. Any help would be greatly Appreciated
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

项目信息

预算
10+ USD
开发人员
9 USD