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
1410
67%
Arbitraje
121
32% / 40%
Caducado
218
15%
Libre
Ha publicado: 1 ejemplo
2
Desarrollador 2
Evaluación
(620)
Proyectos
971
46%
Arbitraje
32
38% / 34%
Caducado
96
10%
Trabaja
Ha publicado: 6 ejemplos
3
Desarrollador 3
Evaluación
(844)
Proyectos
1443
72%
Arbitraje
117
29% / 47%
Caducado
355
25%
Trabajando
Ha publicado: 3 artículos
4
Desarrollador 4
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
5
Desarrollador 5
Evaluación
(2618)
Proyectos
3313
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
//+--------------------------- ------------------------------ ---------+ //| SniperEA.mq5 | //| Institutional Kill Zone + Daily Profile EA | //+--------------------------- ------------------------------ ---------+ #property strict #property version "1.0" #property description "Sniper Framework EA: Kill Zones, Daily Profiles, Key Opens, PE1-PE4, correlation tracking" #include <Trade\Trade.mqh> // Input parameters
One million gold 100 - 200 USD
//+------------------------------------------------------------------+ //| Expert - Advanced Scalper + Smart Grid (MQL5) | //| Features: News filter (CSV), Spread filter, Session filter | //| Dynamic Lot (ATR), Auto Distance Grid, Max Exposure, Drawdown | //| Volatility filter, Spread explosion block, Night Mode, Timeout | //| Profit Lock, Recovery Time-Out | //| Note: Test extensively on demo before live. |
//+------------------------------------------------------------------+ //| Simple Auto Buy EA for MT5 | //+------------------------------------------------------------------+ #property strict double tpPercent = 0.50; // Take Profit % double slPercent = 0.10; // Stop Loss % void OnTick() { // Open only 1 trade if (PositionsTotal() == 0) { double lot = 0.01; double price =
Scelping trading pro 30 - 100 USD
; General EA Settings InpMagicNumber=888881 InpComment=RajaTradingPRO ; Entry Signal Settings InpSignalTimeframe=1 ; Entry Filter Settings InpUseTrendFilter=true InpTrendTimeframe=1 InpTrendMAPeriod=100 InpTrendMAMethod=0 InpUseTimeFilter=false InpStartTime=09:00 InpEndTime=17:00 InpCloseOutsideTime=false ; Lot & Layer Management InpInitialLot=0.01 InpLotMultiplier=3.0 InpMaxLayers=100000 ; Grid Distance Management
I want an Expert Advisor that is based on core high-frequency scalping strategy. The EA will continuously place pending buy stop and sell stop orders at a fixed distance from the current Bid price, creating a grid around the price action. When price moves and triggers one of these orders, the EA will immediately close the opposite pending order and then place a new pair of buy and sell stop orders around the new
MT4 EA 100 - 300 USD
I need an MT4 EA. It is very simple operate at certain time of market open. I need the EA operate with Asia market open, London market open and New York market open, all market open I just operate a few hours (3 hours), so that need a setting for each market. Function: - Auto update market open - Need martingale - Need Auto lot size - Need Breakeven Signal: Example Asia open: - Using 5 min chart, at the first 5 min
Is it possible to convert an EA based on my strategy I have created into an AI that can work on my smartphone so I can use it for trading
I need to create a EA for MT5. I will share the full specification in the chatbox. I would prefer experienced developer for this project. Please apply experienced developer for this job
Hello. We are looking for a group of developers or a software company to create a website that offers services for forex and futures traders. We need assistance with website development, launching service sales, and monitoring traders' accounts. If you have experience building websites and integrating service sales, please apply for this job
I need to create a EA for MT5. I will share the full specification in the chatbox. I would prefer experienced developer for this project. Please apply experienced developer for this job

Información sobre el proyecto

Presupuesto
30 - 100 USD