Partial Lot Size Close at Floating Loss

Trabajo finalizado

Plazo de ejecución 17 horas
Comentario del Ejecutor
Nice Customer.. thx bro..
Comentario del Cliente
Very prompt in replying and making fixes. I recommend this developer to anyone

Tarea técnica

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)

}





Archivos adjuntos:

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

Han respondido

1
Desarrollador 1
Evaluación
(637)
Proyectos
1009
47%
Arbitraje
33
36% / 36%
Caducado
99
10%
Trabaja
Ha publicado: 6 ejemplos
2
Desarrollador 2
Evaluación
(120)
Proyectos
159
49%
Arbitraje
15
53% / 27%
Caducado
4
3%
Libre
3
Desarrollador 3
Evaluación
(298)
Proyectos
427
26%
Arbitraje
18
61% / 33%
Caducado
26
6%
Libre
Ha publicado: 8 ejemplos
4
Desarrollador 4
Evaluación
(11)
Proyectos
18
28%
Arbitraje
4
50% / 50%
Caducado
1
6%
Libre
5
Desarrollador 5
Evaluación
(10)
Proyectos
4
0%
Arbitraje
11
0% / 82%
Caducado
0
Libre
6
Desarrollador 6
Evaluación
(408)
Proyectos
527
24%
Arbitraje
62
58% / 24%
Caducado
60
11%
Trabaja
7
Desarrollador 7
Evaluación
(1)
Proyectos
1
0%
Arbitraje
2
0% / 50%
Caducado
0
Libre
8
Desarrollador 8
Evaluación
(298)
Proyectos
478
40%
Arbitraje
105
40% / 24%
Caducado
82
17%
Trabajando
Ha publicado: 2 ejemplos
Solicitudes similares
روبوت تداول الذهب MT5 (EA) – عروض المطور مطلوبة أبحث عن شراء روبوت تداول محترف للذهب (XAUUSD) أو استكشاف حل مخصص للتداول الآلي. بيئة التداول منصة التداول: MetaTrader 5 (MT5) أداة التداول: ذهب (XAUUSD) وسيط: فانتاج أسلوب التداول: السكالبينغ أو استراتيجيات آلية مناسبة أخرى ما أبحث عنه أنا منفتح على استراتيجيات وأساليب تداول مختلفة، بما في ذلك السكالبينغ، وتتبع الاتجاهات، والتحليل الذكي للسوق، أو استراتيجيات آلية أخرى
I need an MT5 EA which can identify double EMAs position and their slopes as trading trend and candle closes following the trend after retracement to EMA as trading signal. Buy trend occurs when fast EMA is above slow EMA and their slopes are positive. Sell trend occurs when fast EMA is below slow EMA and their slopes are negative. Buy signal occurs when a bullish candle closes above fast EMA after retracement
Mrwin 30+ USD
//+------------------------------------------------------------------+ //| NATHANIEL SMART TRADER EA v1.0 | //| MetaTrader 5 - MQL5 | //| EMA + RSI + ATR + Risk Management | //+------------------------------------------------------------------+ #property copyright "Nathaniel" #property version "1.00" #property strict #include <Trade/Trade.mqh> CTrade trade; //---
Mrwin 30+ USD
//+------------------------------------------------------------------+ //| NATHANIEL SMART TRADER EA v1.0 | //| MetaTrader 5 - MQL5 | //| EMA + RSI + ATR + Risk Management | //+------------------------------------------------------------------+ #property copyright "Nathaniel" #property version "1.00" #property strict #include <Trade/Trade.mqh> CTrade trade; //--- Trading settings input double RiskPercent = 1.0; input
--- I need an MT5 Expert Advisor (EA) for Forex trading. Strategy: - Trade when fast Moving Average (9) crosses above slow Moving Average (21) = BUY - Trade when fast Moving Average (9) crosses below slow Moving Average (21) = SELL - Only 1 trade at a time Settings I want to change: - Lot size - Stop Loss in pips - Take Profit in pips - Trailing Stop - Trading hours (Start and End time) Risk: - Close all trades at
ICC SMART STRUCTURE EA 50 - 100 USD
DEVELOPMENT REQUIREMENTS Project Title: ICC Smart Structure EA – MT5 Automated Trading System 1. Project Objective I want a fully automated Expert Advisor (EA) for MetaTrader 5 (MT5), based on my Indication–Correction–Continuation (ICC) trading strategy. The EA must identify market structure, Break of Structure (BOS), swing highs and lows, supply and demand zones, corrections and continuation entries across multiple
I want reading tradingviwer signal and want open mt5 account trades. Want reading stop loss size and take a profit size and when signalClosing ! This ea want cancel open trades
برمجة روبوت تداول MQL5 بهدف 50 نقطة مع إدارة مخاطر.مطلوب برمجة خبير تداول آلي يعمل على منصة MQL5، يركز على تحقيق هدف 50 نقطة مع إدارة صارمة للمخاطر وتحديد وقف الخسارة
Hello, I'm looking for a developer who can build an automated trading bot (Expert Advisor) for MetaTrader 5 (MT5). I want a smart trading robot that can scan the markets, identify high-probability trading opportunities, and automatically execute trades. Strategies and indicators I'd like included: RSI (75 overbought / 25 oversold). MACD crossover with strong momentum. 9/21 EMA crossover. 20/50 SMA crossover. Smart
Delete/Remove . Integrate Support & Resistance . Prop Firm Expert. (Expert is Active With a firm's account) . (Tick Volume) spikes specifically when price interacts with pre-defined Support and Resistance zones. [ required ]

Información sobre el proyecto

Presupuesto
30 - 60 USD
Plazo límite de ejecución
de 1 a 3 día(s)