Please insert function into EA

MQL4 Esperti

Lavoro terminato

Tempo di esecuzione 1 giorno
Feedback del cliente
2nd time I used him and very impressed by his work

Specifiche

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

File:

Con risposta

1
Sviluppatore 1
Valutazioni
(180)
Progetti
301
30%
Arbitraggio
54
24% / 56%
In ritardo
98
33%
Gratuito
2
Sviluppatore 2
Valutazioni
(453)
Progetti
566
26%
Arbitraggio
24
42% / 38%
In ritardo
85
15%
Gratuito
Pubblicati: 6 codici
3
Sviluppatore 3
Valutazioni
(221)
Progetti
412
61%
Arbitraggio
13
38% / 23%
In ritardo
163
40%
Gratuito
Pubblicati: 51 articoli, 1 codice
Ordini simili
Description: Hello, I need a professional, high-quality optimization of the"Ultimate SMC" Expert Advisor for MetaTrader 5. The primary objective is to create robust and safe configuration files(.set files) tailored specifically to pass the Funding Pips prop firm challenge using a cosnservative risk model. Assets and Timeframes:1.Currency Pairs: EURUSD and GBPUSD (Upon completion, I require 2 separate,independent .set
​​ Title: ​Create a Combined Indicator from 3 EX4 Indicators + Fully Automatic Trading EA (MT4) ​ Description: ​Hello, ​I need an experienced MQL4 developer to build a custom trading system based on 3 existing .ex4 indicators. ​ Project Requirements: ​ Combined Custom Indicator: ​Read and merge signals from 3 specified .ex4 indicators via buffer reading (iCustom). ​Generate a consolidated BUY or SELL arrow/signal
EA the profit 30+ USD
I need a robot that trade on command and stop-loss and take profit when need to , able to trade on all plate form follow profitable strategies or signal , want a winning streak with fast profits making
Hi I'm looking for this EA or Similar EA with optimizated set file. This bot is an automated trading robot, operating 24/7, and capable of trading all currency pairs. Compatible with all brokers. Features: Analysis of price action charts, trends, and support and resistance levels on any timeframe. The bot integrates stop-loss (SL), stop-loss (TP), and trailing stop-loss (SL) orders. Works on MT5 getshared . c o m
I wish to create 2 different Tradingview strategies to MT5 ea-s! Anyone? One is based on Heiken Ashi...the other based on different combination of my strategy. It is for 1 minute charts
نازدك 30+ USD
Specify your Requirements Specification here point by point. Try to describe your requirements briefly and clearly, so that your potential developer is able to correctly assess its complexity and cost, as well as the required execution time. A bad or too generic description will result in your order being ignored, or you will spend a lot of time negotiating the details with each applicant. Remember: It is better to
**IMPORTANT: PLEASE DISREGARD THE PREVIOUS SPECIFICATION TITLED "FULL TRADING PLATFORM – APPLICATION FLOW REQUIREMENTS."** I no longer need the complete trading platform outlined in my previous **"FULL TRADING PLATFORM – APPLICATION FLOW REQUIREMENTS"** specification. Originally, I considered building a complete trading platform with educational materials, training systems, user accounts, subscription features
I have indicators on my Trading view which will create zones automatically on H4 Candle confirmation. I am getting an alert also that specific zone is created. I want them to shift in automated trading like once zone is created, limits should be place automatically on basis of that zone with given lot size, number of layers and with TP and SL. I have checked on AI to convert this in auto but they need zone in numbers
I am looking for an experienced MQL5 developer to recreate my existing MT5 Expert Advisor (DSTR Novaa). I have the original compiled EX5 file, Vantage MT5 live trading history and original Strategy Tester report. Required Trading Logic: EMA Period: 3. BUY when price crosses below EMA 3. SELL when price crosses above EMA 3. Starting Lot: 0.01 (configurable). Martingale Multiplier: 2.0. Maximum Martingale Cycle: 9
I need an ready-made MT5 profitable EA for Gold. 5/7% daily I need. Before applying please make sure you have one with proven ROI, Drawdown and Live performace result. I will Pay $500 for it but I need as I want. Must needs to supply Source code if I like it. Before I purchase I will test 7 days on my live account. If It's okay then apply othersie please pass this project. Hope you will respect the time for both of

Informazioni sul progetto

Budget
10+ USD