Partial Lot Size Close at Floating Loss

작업 종료됨

실행 시간 17 시간
고객의 피드백
Very prompt in replying and making fixes. I recommend this developer to anyone
피고용인의 피드백
Nice Customer.. thx bro..

명시

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)

}





파일:

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

응답함

1
개발자 1
등급
(618)
프로젝트
968
46%
중재
32
38% / 34%
기한 초과
96
10%
작업중
게재됨: 6 코드
2
개발자 2
등급
(120)
프로젝트
159
49%
중재
15
53% / 27%
기한 초과
4
3%
무료
3
개발자 3
등급
(298)
프로젝트
427
26%
중재
18
61% / 33%
기한 초과
26
6%
무료
게재됨: 8 코드
4
개발자 4
등급
(11)
프로젝트
18
28%
중재
3
67% / 33%
기한 초과
1
6%
무료
5
개발자 5
등급
(10)
프로젝트
4
0%
중재
11
0% / 82%
기한 초과
0
무료
6
개발자 6
등급
(370)
프로젝트
476
24%
중재
52
62% / 19%
기한 초과
55
12%
로드됨
7
개발자 7
등급
(1)
프로젝트
1
0%
중재
1
0% / 0%
기한 초과
0
무료
8
개발자 8
등급
(286)
프로젝트
461
39%
중재
96
43% / 19%
기한 초과
73
16%
바쁜
게재됨: 2 코드
비슷한 주문
Hello Developers, This is buy side/sell side order for an EA that consist of 3 common indicators with 4 conditions to trigger a buy or sell with added stop loss and take profit. Please send your qualifications for a decision tomorrow. Thanks
Hello , I am looking for a skilled developer who works fast. I need a simply EA which will only open trades when the arrow, notification is being sent by the indicator from mql5.com. The indicator is a paid one, so I will give the developer the access to VPS where it will be downloaded. I have another EAs which will manage the trade so the one I am asking for must only open buy or sell trade in the indicated by me
I'm looking for a highly experienced MQL5 developer (4.5-5.0 stars, solid reputation, and proven track record) to finalize and fully optimize my Expert Advisor, Beging ULTRA v7.9. The EA is already 95% complete and fully functional. It includes a multi-asset scanner, dynamic SL/TP, partial close, breakeven, trailing logic, ATR-based limits, and a full visual overlay panel. ✅ Tasks to be completed: Fix the remaining
Hola, deseo coviertir el siguiente codigo mql5 del indicador RSI con alertas en un robot (expert advisor) 100% automatico. Es decir, que siempre que envie la senal de compra o venta se ejectute la orden de forma automatica. Que tenga encuentas niveles de soporte en temparalidades H1, H4 y D1 para entrar en compras y de resietncias H1, H4 y D1 para entrar en ventas. Que salga de las opereaciones cuando el RSI toque o
What I need: A simple protective bot that monitors the entire trading account and automatically closes all positions at preset profit/loss limits. Required features: Monitor all open positions , regardless of who/what opened them Automatically close ALL positions when: Total profit reaches a set value (e.g., +€30) Total loss reaches a set value (e.g., -€20) Block new trades after closing positions — to prevent other
I’m interested in having you build a NinjaTrader 8 strategy based on a fractal model concept (similar to the TTrades fractal strategy). Before ordering, I want to confirm whether this logic fits within your “10 entry and exit condition” limit. Here’s the logic summary: 1. On the 4H timeframe, detect a Candle 2 or Candle 3 structure formation. 2. On the 15M timeframe, confirm a CISD (change in structure direction). 3
//@version=5 indicator("Enhanced SMA Crossover with RSI Confirmation", shorttitle="SMA Cross RSI", overlay=true) // Define the length of the short-term and long-term moving averages shortLength = input.int(9, title="Short-term Moving Average Length") longLength = input.int(21, title="Long-term Moving Average Length") rsiLength = input.int(14, title="RSI Length") rsiOverbought = input.int(70, title="RSI Overbought
Work on currency , stocks pairs , trade with trend & hedge. trail SL with last low & highs of market with control of lot size daily target.SL i want to control it with Breakeven , trailing on last lows & highs. news filter & time setting to trade. No martingale base
I'm making an EA that combines multiple indicators. The indicators take a long time to complete and I don't know the fixed values. I can send the original files and screenshots for reference. If there are technicians who can help me improve it, the price is negotiable. Thank you. I'm Chinese, so I need Chinese
Got it. Here’s a clean, developer-ready Genesis X / Retail AI Specification that captures everything we locked. It’s written so a dev (or you) can implement the logic and infrastructure without exposing proprietary internals. No code—just exact behavior, numbers, and guardrails. WealthFoundryX – Trading AI Spec (Developer Handoff) 0) Scope & Roles Products: Genesis X (Institutional) – seed/master, not sold. Retail

프로젝트 정보

예산
30 - 60 USD
개발자에게
27 - 54 USD
기한
에서 1  3 일