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
등급
(368)
프로젝트
474
24%
중재
52
60% / 19%
기한 초과
54
11%
로드됨
7
개발자 7
등급
(1)
프로젝트
1
0%
중재
1
0% / 0%
기한 초과
0
무료
8
개발자 8
등급
(284)
프로젝트
459
39%
중재
94
44% / 18%
기한 초과
73
16%
로드됨
게재됨: 2 코드
비슷한 주문
Here's a detailed description of a Trend Following and Mean Reversion strategy-based Expert Advisor (EA): Strategy Overview The EA will implement a hybrid strategy combining trend following and mean reversion techniques. It will identify trending markets, ride the trend, and also capitalize on mean reversion opportunities
Overview Create a MetaTrader 5 (MT5) indicator that: Pulls live sentiment data from multiple broker APIs. Calculates Net Sentiment (Long% – Short%) and plots each broker as a moving average line on the chart. Displays a weighted average line when ≥2 feeds are active. Saves all data to CSV files per broker for efficient historical loading and performance. Supported Brokers Broker Abbr. Color OandaFX
I Have A project done dusted For sale; Title: Strong Reversal Indicator [No Repaint, No Offset, Low Lag] 17 minutes ago MQL5 Indicators Design Forex Trading robot/indicator debugging Strategy optimization Statistics and mathematics Strategy modules Uploading data to a website Specification EN Overview: A professional MT5 reversal indicator designed to detect market turning points with no repainting, no
We are seeking a highly skilled MQL4 developer to complete a very complex EA project. Requirements & Conditions: Strict Timeline: 5 days delivery + 3 days rectification (non-negotiable) Must be free from other jobs and have strong history in complex EA development EA covers advanced features such as: Candle & HMA-based trade restrictions Multi-level breakeven, profit protection & profit trail Standard & Step trailing
Hi Devops, Convert Trading View indicator into MT4/MT5 EA.This EA has simple Buy/Sell trades based on TV indicator.It has basic inputs such as lot size:fixed/adding lot type,tp,SL,magic Number etc.More details will be discussed in private chat
Manage my live forex account with a disciplined, low-risk approach that produces steady monthly income. My priority is capital protection, so each trade must be sized conservatively, anchored by firm stop-loss orders, and designed to keep drawdown minimal. High-risk tactics such as martingale, grid systems, or excessive leverage are off the table; a measured, rules-based strategy is essential. I will connect the
Indicator that finds zones. All details in word document Ask questions if need I’d also like to to change from finding bullish marker and main candles to bearish marker and main candles if price crosses past inputted price The document is showing zones for bullish price action. Id like to also change manually in setting for it to show bearish price action ( it will look for bullish candle markers and main) Zones
I already have an Expert Advisor coded in MQL4, but it refuses to trade anything other than its hard-coded symbol. I want that filter gone so the same strategy can fire on any instrument—forex, indices, metals such as XAUUSD—across any timeframe. The trading logic, money management and inputs must stay exactly as they are; I simply need universal symbol support. After the MT4 file is fixed and compiles cleanly, I
Description: Gildepak is a purchasing cooperative for packaging materials. We need a program to calculate and fairly distribute the annual bonus (received from preferred suppliers) among our member companies (partners and members). The program should work with a set of predefined tables and data flows, and it must be able to import and export Excel files. Main Tables: Member Companies Company ID Company Name Partner
S-ONE ROBOT – MT5 EA Developer Brief 1. Trading Pairs & Timeframes Pair Timeframe Strategy Type Gold (XAU/USD) M15–H1 Scalping + Trend-following + Attacking EUR/USD H1–H4 Swing trading + Attacking Separate configurable parameters per pair (risk %, max trades, SL/TP, indicators). Timeframe Logic: Lower timeframe → precise entries (M15 for Gold, H1 for EUR/USD) Higher timeframe → trend confirmation (M30/H1 for Gold, H4

프로젝트 정보

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