I Make an EA Martingale and need some tips

MQL4 Indicadores Asesores Expertos

Trabajo finalizado

Plazo de ejecución 4 días
Comentario del Cliente
It was great to work with Aleksei because in some situations I felt like I had a friend near me who gave me advice. Thanks Aleksei !!!

Tarea técnica

1. how to find the martingale level after a closing and reopening

2. How implement break even (template code)


I have this params:

input string  s1                   = "Last update: 2017/10/11";
input bool    UseMoneyManagement   = false;     //UseMoneyManagement use money management for the trade volume calculation
input double  RiskPercent          = 0.5;       //RiskPercent the percent of the risk for the trade volume calculation
input double  Lots                 = 0.01;      //Lots fixed lot size
input int     NBarsCalcStopLoss    = 4;         //NBarsCalcStopLoss The n. bars for calc Higest (for sell) or Lowest (for buy)
input double  GapStopLoss          = 5;         //GapStopLoss To be added to StopLoss
input double  RRTakeProfit         = 1.0;       //RRTakeProfit Rsk Reward for calc Take profit
input int     MagicNumber          = 1122112223;//Magic number for EA's orders
input int     Slippage             = 70;        //Slippage maximum allowed deviation (in pips) of the price by opening
input int     SpreadLimit          = 12;        //SpreadLimit maximum allowed spread in points
// input int     StrategyN            = 3;         //number of case in FcStrategy.MA routine that is the strategy used to determine the buy or sell

input string  s2                   = "-------------------";
input int     FromTimeHourTrade    = 6;         // Hour from start trade
input int     ToTimeHourTrade      = 19;        // Hour to stop trade
input int     MaxBarsStillTradeOpen= 10;        // Max number of bars where position can be open, after this the operation is closed
input int     PercOfGainForBE      = 0;         // PercOfGainForBE (0=Disalbed) The percentage of gain for apply Break even
input int     PercOfLotsToCloseAtBE= 50;        // The percetange of lots to be close when the PercOfGainForBE is reached
    
input string  s3                   = "-------------------";
input double  MultiplierLot        = 2.0;
input double  MaxLots              = 1.28;
input string  ContRev              = "RCCRCRRCCCRRC"; //C=Continue; R=Reverse; Continue is the versus of first (lose) trade, Reverse is the opposite versus of first (lose) trade



this routine menage break even but don't work

//+--------------------------------------------------------------------------------+
//| the function for managing of EA's Break even and max bars trade                |
//+--------------------------------------------------------------------------------+
void do_manageBE( int magicBuySell)
{
   int typ;double lot=0;double profit;
   double tmpLots=0;
   int BuyOrSell=0;
  
   double point = XGetPoint(Symbol());                            // get point value
   int total_ordersB = orders_count(MagicNumber);                 // count of opening orders
   int total_ordersS = orders_count(MagicNumber);                 // count of opening orders
   string symbol = Symbol();
  
   //
   //--- Check the action to do based on the last trade result
   //
   if(((total_ordersB+total_ordersS) > 0) ){                      // Check One order active
      if(nBSOT.LastStartHour!=Time[0]){                           // Check for increment n. of bar trade is active
         // Moved to History() routine --- nBSOT.nBarsStillOpenTrade=iBarShift(NULL,0,OrderOpenTime(),true);//++;
         nBSOT.LastStartHour=Time[0];
      }
      //
      // Manage n. max of bar where the trade must be opened
      //
      if((nBSOT.nBarsStillOpenTrade>MaxBarsStillTradeOpen) && (MaxBarsStillTradeOpen>0)){        // Check the numer of hour active trade exceed the threeshold
         int orders_total = OrdersTotal();                        // Num. tot. orders
         for( int count = 0; count < orders_total; count++ ){     // Cicle for orders
            if( OrderSelect(count,SELECT_BY_POS,MODE_TRADES) && OrderMagicNumber() == MagicNumber ){ // if selected order is active trade and magic ok
               // Print("Close..."+OrderTicket()+":-:"+OrderLots()+":-:"+Bid+":-:"+nBSOT.nBarsStillOpenTrade);
               int ord_type = OrderType();
               double PriceForClose=0.0;
                if( ord_type == OP_BUY  )
                  PriceForClose=Bid;
                if( ord_type == OP_SELL  )
                  PriceForClose=Ask;
               
               XOrderClose(OrderTicket(), OrderLots(), PriceForClose, Slippage);                               // Close order                                   
            }
         }
      }
      //
      // Manage Break Even
      //
      if((PercOfGainForBE>0)){        // Check the break even required by user input
         int orders_total = OrdersTotal();                        // Num. tot. orders
         for( int count2 = 0; count2 < orders_total; count2++ ){     // Cicle for orders
            if( OrderSelect(count2,SELECT_BY_POS,MODE_TRADES) && OrderMagicNumber() == MagicNumber ){ // if selected order is active trade and magic ok
               // Print("Close..."+OrderTicket()+":-:"+OrderLots()+":-:"+Bid+":-:"+nBSOT.nBarsStillOpenTrade);
               int ord_type = OrderType();
               double PriceForClose=0.0;
                if( ord_type == OP_BUY  ){
                  PriceForClose=0.0;
                  if(Bid>=LastTradeBE){    // Check if the LastTradeBE (setted at the order open) is more than Bid price
                     PriceForClose=Bid;    // is time to close order
                  }
                }
                if( ord_type == OP_SELL  ){
                  PriceForClose=0.0;
                  if(Ask<=LastTradeBE){    // Check if the LastTradeBE (setted at the order open) is less than Ask price
                     PriceForClose=Ask;    // is time to close order
                  }
                }
                if(PriceForClose>0.0){
                  XOrderModify(OrderTicket(),PriceForClose,OrderOpenPrice(),OrderTakeProfit(),0,0);         // Modify SL to entry price (Break Even)
                  //if(PercOfLotsToCloseAtBE>0){
                  //   XOrderClose(OrderTicket(), ActualTradePercOfLotsToCloseAtBE, PriceForClose, Slippage);
                  //   return;
                  //}
                  // XOrderClose(OrderTicket(), OrderLots(), PriceForClose, Slippage);                               // Close order                                   
                }
            }
         }
      }
           
     
   }



Han respondido

1
Desarrollador 1
Evaluación
(885)
Proyectos
1409
67%
Arbitraje
121
32% / 40%
Caducado
217
15%
Trabaja
Ha publicado: 1 ejemplo
2
Desarrollador 2
Evaluación
(618)
Proyectos
968
46%
Arbitraje
32
38% / 34%
Caducado
96
10%
Libre
Ha publicado: 6 ejemplos
3
Desarrollador 3
Evaluación
(841)
Proyectos
1438
72%
Arbitraje
117
29% / 47%
Caducado
356
25%
Trabaja
Ha publicado: 3 artículos
4
Desarrollador 4
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
5
Desarrollador 5
Evaluación
(2598)
Proyectos
3280
67%
Arbitraje
77
48% / 14%
Caducado
342
10%
Libre
Ha publicado: 1 ejemplo
6
Desarrollador 6
Evaluación
(14)
Proyectos
22
59%
Arbitraje
2
0% / 50%
Caducado
2
9%
Libre
Ha publicado: 1 ejemplo
Solicitudes similares
I need a MT4 robot to pass FTMO funding tests. It cannot have a maximum daily loss of 5000 euros. And a maximum monthly loss of 10000€. The account will be funded with 100k. I would also like it to generate more than the 10% required to pass the test, as if possible, I'd like 3k or more. Some ideas I have (I've been gathering some information, but I'm not an expert): It should NOT use martingale. NO high
I'm looking for an upgrade of existing 100% working tool (EA) which is NOT opening any positions, neither modifying opened positions, nor closing them. Instead, entire 100% working with zero bugs tool is based on providing alerts from multi time frame analysis I need some additional features to be implemented. Budget can be further negotiable. I look for few upgrades (additions) to my existing tool named Candle
Custom TradingView-to-MT4/MT5 Bridge with Stealth SL/TP Logic Project Title Custom TradingView-to-MT4/MT5 Bridge with Stealth SL/TP Logic (Webhook + EA) Project Description I’m looking for a skilled MQL developer who can build a custom TradingView-to-MT4/MT5 trading bridge that performs the following functions: System Overview 1. ENTRY SYSTEM: - Define a pending order on TradingView (manually or via indicator) and
PLEASE ONLY GENUINE APPLICATIONS! I am looking for a MT5 EA that I can successfully use to pass Prop Firm challenges in reasonable time and successfully trade funded account whilst staying within 4% daily drawdown and 8% max drawdown and profiting ideally 10% or more a month. The EA must: 1) Be suitable for prop firms 2) Stay within daily drawdown of 4% 3) Stay within max drawdown of 8% 4) Consistently profit 10%
I'm currently seeking a profitable automated EA for MT4 that can place orders automatically. My priority is to evaluate its performance in live trading conditions before making any commitments. Would you be willing to grant me access to the EA for testing purposes? If it proves successful and aligns with my trading goals, I’d be happy to discuss future collaboration. Looking forward to your positive response. Best
Description: I need an MT5 Expert Advisor that: Opens buy trades when price breaks above predefined buy-only levels and sell trades when price breaks below predefined sell-only levels. Levels can come from TradingView alerts (webhook/file) or from horizontal lines on chart. Must include: Configurable Stop Loss and Take Profit in pips. Configurable breakeven after X pips, with option to add a buffer (offset for
I need developer to modify a simple mql4 indicator with non-repainting Buy/Sell arrows, selectable timeframe (current or higher), and alerts, push notifications.The indicator mq4 file will be provided as this is a simple change. I will need quick turnover of this work.Please apply if interested
Hello. The strategy is based on analyzing the price difference between three financial instruments that are traded on two different brokers. Two futures (X and Y) are traded on the traditional exchange (available on Trading view, Metatrader 5). The third instrument (Z) is currency contract which is traded on the forex broker (also available on Trading view, Metatrader 5). Please carefully read the tecnhical task to
I need an Expert Advisor (EA) that can trade on Forex pairs, Metals (like XAUUSD), and Crypto coins . Key points: Fixed lot size (configurable). EA should work on multiple asset classes. A simple on-chart control panel to manage EA: Start/Stop trading Enable/Disable strategies Change lot size (buttons +/–) Payout button → closes all profitable trades and adds profit to balance ATR-based option for stop loss /
Calculate the price points corresponding to the maximum unrealized loss and maximum unrealized profit based on the order placement time, opening price, closing time, and closing price of existing orders. Implement this as a REST API to facilitate large-scale asynchronous concurrent calls. If possible, please share your solution in advance. Thank you

Información sobre el proyecto

Presupuesto
30 - 100 USD
IVA (22%): 6.6 - 22 USD
Total: 36.6 - 122 USD
Para el ejecutor
27 - 90 USD