Partial Lot Size Close at Floating Loss

Job finished

Execution time 17 hours
Feedback from customer
Very prompt in replying and making fixes. I recommend this developer to anyone
Feedback from employee
Nice Customer.. thx bro..

Specification

Hello , I need to Modify an expert advisor (Trade Manager for other EAs) to add new functionality :

1) Partial Lot Size Close at Floating Loss Amount:

  • Close % Partial Lot-size if Loss reached a defined amount (Note: Closing Priority will lead it the orders orders being closed first)
  • Close All Modify Take Profit of Remaining Lots to Breakeven (Dollar profit of Zero when taking into account Commission)

BONUS: For the Advanced Coders, I am willing to increase my budget if you are able to achieve the configuration that is shown in the Screenshot "Part 2"  . I can elaborate on this more, if you are interested/able to achieve this request.


This will require the following adjustment, modify the Magic Number the Open Orders so that the EA is able to manage them.

Here is an example of some source code that is able to achieve this, however it is not viable for my EA as it modifies the take profit of individuals orders and not the weighted average lot size of the orders for a specific symbol within a sequence.

void OnTick()
{
        for ( int z = OrdersTotal() - 1; z >= 0; z -- )
        {
                if ( !OrderSelect( z, SELECT_BY_POS, MODE_TRADES ) )
                {
                        Print( "OrderSelect( ", z, ", SELECT_BY_POS, MODE_TRADES ) - Error #", GetLastError() );
                        continue;
                }
                if ( MagicNumber != -1 && OrderMagicNumber() != MagicNumber ) continue;
                if ( OnlyCurrentSymbol && OrderSymbol() != _Symbol ) continue;

                int D = getDigits( OrderSymbol() );
                double P = getPoint( OrderSymbol() );

                if ( TakeProfit_B > 0.0 && OrderType() == OP_BUY )
                {
                        double correct_tp = NormalizeDouble( OrderOpenPrice() + TakeProfit_B*P, D );
                        if ( fabs( OrderTakeProfit() - correct_tp ) > P/20.0 && !AlreadyModified() )
                        {
                                Print( "Modifying TP of buy-order #", OrderTicket(), " (", 
                                                        DoubleToString( OrderTakeProfit(), D ), " -> ", DoubleToString( correct_tp, D ), ")..." );
                                if ( !OrderModify( OrderTicket(), OrderOpenPrice(), OrderStopLoss(), correct_tp, 0 ) )
                                        Print( "OrderModify failed with error #", GetLastError(), "!" );
                                else
                                        OrderSave();
                        }
                }
                if ( TakeProfit_S > 0.0 && OrderType() == OP_SELL )
                {
                        double correct_tp = NormalizeDouble( OrderOpenPrice() - TakeProfit_S*P, D );
                        if ( fabs( OrderTakeProfit() - correct_tp ) > P/20.0 && !AlreadyModified() )
                        {
                                Print( "Modifying TP of sell-order #", OrderTicket(), " (", 
                                                        DoubleToString( OrderTakeProfit(), D ), " -> ", DoubleToString( correct_tp, D ), ")..." );
                                if ( !OrderModify( OrderTicket(), OrderOpenPrice(), OrderStopLoss(), correct_tp, 0 ) )
                                        Print( "OrderModify failed with error #", GetLastError(), "!" );
                                else
                                        OrderSave();
                        }
                }
        }
}

As a result you may want to use some snippets from this code:

   void ModifyTP(int m)
{
   int i,r;
   double tpnya,dtp,bbep,sbep,ssize,bsize;
   tpnya=0;dtp=0;bbep=0;sbep=0;ssize=0;bsize=0;
   for (i=0; i<OrdersTotal();i++) 
   { 
      if (!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue;
      if (OrderSymbol() != Symbol()|| OrderMagicNumber() != MagicNumber || OrderType()!=m) continue;
         tpnya=OrderTakeProfit();
         if (m==0) {bbep += OrderOpenPrice()*OrderLots(); bsize= bsize+OrderLots();}
         if (m==1) {sbep += OrderOpenPrice()*OrderLots(); ssize= ssize+OrderLots();}
               
   }
   if (bbep>0) { bbep/=bsize; tpnya=NormalizeDouble(bbep + TP*pt,Digits); }
   if (sbep>0) { sbep/=ssize; tpnya=NormalizeDouble(sbep - TP*pt,Digits); }
      
   for (i=OrdersTotal()-1; i>=0; i--) 
   {
      if (!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue;
      if(OrderSymbol() != Symbol()|| OrderMagicNumber() != MagicNumber|| OrderType()!=m) continue;
         dtp=OrderTakeProfit();
         //if (m==0) {bbep += OrderOpenPrice()*OrderLots(); bsize= bsize+OrderLots();}
         //if (m==1) {sbep += OrderOpenPrice()*OrderLots(); ssize= bsize+OrderLots();}
         Print("tpnya",tpnya,": ",i);
         Print("dtp",dtp,": ",i);
         if( MathAbs(tpnya-dtp)>=pt &&  OrderType()==m)
         r  =  OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), tpnya, 0, CLR_NONE); 
   }
   //if (bbep>0) bbep/=bsize; dtp=bbep;
   //if (sbep>0) sbep/=ssize; dtp=sbep;  
}
   

The key inputs would be as follows:

input    string      CHART_MANAGEMNET1= "====== Trade Managerment ======";
input    string      symbol1          = "EURUSD";    // Symbol //Symbol that the modification would occur for
int                     MagicNumber                                             = -1;                           // * MagicNumber (-1 - modify all) - this is the magic number that the EA would change the Open Orders to
input double      TakeProfit           = 0.0;         //Breakeven amount in dollars (excluding commission) - this would be the modification amount in dollars taking into account commision (Note: I don't want pips as I will use this on other symbols that are not just forex)
^//Forgot to add this 

input double      PartialClose           = .3;         //Partial close percentage of lots when floating loss is reached on symbol 

EXAMPLE 1:

extern bool Partial_Close= true;

IF_LOSS = -500  ( $ )

{

Close 30% of Symbol in Loss 

Modify Take Profit to breakeven in dollars (taking into account Commission)

}





Files:

PNG
Part_1.PNG
78.0 Kb
PNG
Part_2.PNG
99.5 Kb

Responded

1
Developer 1
Rating
(618)
Projects
968
46%
Arbitration
32
38% / 34%
Overdue
96
10%
Free
Published: 6 codes
2
Developer 2
Rating
(120)
Projects
159
49%
Arbitration
15
53% / 27%
Overdue
4
3%
Free
3
Developer 3
Rating
(298)
Projects
427
26%
Arbitration
18
61% / 33%
Overdue
26
6%
Free
Published: 8 codes
4
Developer 4
Rating
(11)
Projects
18
28%
Arbitration
3
67% / 33%
Overdue
1
6%
Free
5
Developer 5
Rating
(10)
Projects
4
0%
Arbitration
11
0% / 82%
Overdue
0
Free
6
Developer 6
Rating
(368)
Projects
472
24%
Arbitration
52
60% / 19%
Overdue
53
11%
Busy
7
Developer 7
Rating
(1)
Projects
1
0%
Arbitration
1
0% / 0%
Overdue
0
Free
8
Developer 8
Rating
(284)
Projects
459
39%
Arbitration
94
44% / 18%
Overdue
73
16%
Loaded
Published: 2 codes
Similar orders
The EA will have 3 moving average and trade are executed upon cross over.The EA will finally be in MQL4 and MQL5. The EA will also be protected with a password. Further description will be given after agreement
I need a good programmer who will build a forex EA with exact specifications. The EA parameters should be easily activated by on/off clicks... It's so multiple timeframe filters, monthly, weekly, daily and a H4 entry. Using Moving averages, RSI, %R, and candlestick ranges
Technical Skills: - Programming Languages: Proficiency in low-latency programming languages like C++ is crucial for developing high-speed trading algorithms. - Algorithmic Trading: Experience with algorithmic trading strategies, including market making, statistical arbitrage, and trend following. - Market Data Analysis: Ability to analyze large datasets and extract meaningful insights to inform trading decisions
I need a trading robot expert advisors/EA on MQL5. With the following strategies. Trend Following and Mean Reversion/Scalping and Range Trading* 1. *Trend Following and Mean Reversion*: Capture trends and profit from mean reversion opportunities. 2. *Scalping and Range Trading*: Profit from short-term price movements and range-bound opportunities. *Trend Following and Mean Reversion* - *Indicators:* - Moving
Hi guys Does anyone have experience with K-Means and MQL5? I would like to get an include file which I can use in my EAs. I would need to work with an ML Engineer who has deep understanding with K-Means. The include file should be used for regime detection. I can drop more information about my EA once I see that you qualify for the job :-) Cheers
Please translate the FX Blue copy trading EA into Chinese EA. Additionally, the software must centrally manage newly installed and uninstalled MT4/MT5 platform directories to uniformly manage the association between multi-terminal login trading accounts and copy trading accounts. Existing program solutions are preferred; candidates with relevant project development experience will be given priority consideration
READ CAREFULLY And if you have done 50 projects before then apply others i will reject SEPARATE LOGIC MUST BE SEPARATE AND ALL INPUTS MUST BE VISIBLE WITH FALSE TRUE OPTION TO ON OFF FUNCTION 🔺 BUY Signal (Boom Market) ✅ Pattern Formation (Spike-Based Buy Setup) First Spike : Large bullish spike candle . Mitigation Candle : Small bearish candle inside or partially inside the bullish spike. Second Spike
Hello Developers, I am looking for an already profitable binary options trading bot that works specifically on the IQ Option broker . I don’t want a new development from scratch, but rather a tested and proven system with consistent results. 🔎 Requirements: •The bot must be able to run on IQ Option smoothly. •Should be profitable and reliable (not experimental). •Full access to use the bot without restrictions
Job Description I am looking for a highly skilled MQL5 DEVELOPER and A TRADER to work on an MT5 Expert Advisor (EA) project. The main tasks will include: 1. Code Compilation & Optimization – Reviewing, compiling, and streamlining the existing EA code to ensure efficiency and stability. 2. Backtesting Setup & Execution – Running professional backtests to ensure the EA produces consistent, gradual profit growth curves
Ultra-High-Speed Trade Replication (Low Latency) Supports MT4 and MT5 Simple Setup, User-Friendly Interface Contact me for detailed specifications and standard documentation Priority given to candidates with experience developing similar copy-trading software

Project information

Budget
30 - 60 USD
For the developer
27 - 54 USD
Deadline
from 1 to 3 day(s)