I Make an EA Martingale and need some tips

MQL4 Indicateurs Experts

Tâche terminée

Temps d'exécution 4 jours
Commentaires du client
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 !!!

Spécifications

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                                   
                }
            }
         }
      }
           
     
   }



Répondu

1
Développeur 1
Évaluation
(879)
Projets
1392
67%
Arbitrage
117
32% / 42%
En retard
215
15%
Gratuit
2
Développeur 2
Évaluation
(589)
Projets
921
46%
Arbitrage
31
39% / 29%
En retard
93
10%
Travail
3
Développeur 3
Évaluation
(801)
Projets
1372
72%
Arbitrage
112
29% / 48%
En retard
341
25%
Travail
4
Développeur 4
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
5
Développeur 5
Évaluation
(2423)
Projets
3046
66%
Arbitrage
77
48% / 14%
En retard
340
11%
Gratuit
6
Développeur 6
Évaluation
(14)
Projets
22
59%
Arbitrage
2
0% / 50%
En retard
2
9%
Gratuit
Commandes similaires
Looking for someone to modify My BUY and SELL Arrow Expert Advisor. I ordered it here with one developer but it is not working well. It is missing BUYs and SELLs entries sometimes. I have the Mql4 file. Thank you
Hi I need a experience programmer to build me bullish and bearish ENGULFING pattern reversal and continuation scanner EA that send alert with arrow on screen without open trades Multiple times frame H4 D1 W1 MN multiple currency pairs and i want to see all historical patterns that already happened
I 'm looking for a bot to take trades . I have questions 1 . What is the win rate? It could be ! 2 . Any guarantee if the bot does not take a win trade
I am looking to have a tool developed that can connect and copy trade from Quantower on machine A to Quantower on machine B. I am aware that Quantower has a built in trade copier but I need to get the trades over to a different instance of QT on a separate machine. Is this possible and something you could help with? All orders for entry and exit would be market orders so do not need any targets or stop losses copied
I’m looking for a developer that has understanding of scalping and HFT strategies that can make an algo that works for all brokers and prop firm LIVE accounts (like STP, ECN, DMA, Money Makers, NDD, Fast Server etc.,). I want someone that has understanding and insight in different scalping and HFT strategies, preferably something like momentum based strategies. The EA has to work on all Brokers and Prop firms like
I'm looking for professional developer for my project.I'm having indicators source code , i want to convert it into MT4 EA .it is having some basic inputs such as lot size,TP,SL,B.E,trailing,News filter features along with some special inputs.detailed strategy will be discussed in chat room.i prefer Indian developers who speaks hindi
Good Day I would like to create a trading bot that is able to link to my news provider. The bot will execute trades based on the actual news release data as soon as the data is released. I will need to input parameters that would automatically trigger once the actual data is released (Need to know what format you will require or other recommendations) Execution speed will be a crucial factor in this regard. Adding to
The strategy uses a grid trading system where trades are placed at set intervals (grid levels) and are managed using Bollinger Bands for entry and exit signals. A fixed lot size, trades are managed to comply with maximum spread conditions and specific trading hours, with the possibility of closing trades based on Bollinger Bands signals. The use of Bollinger Bands indicates a focus on volatility-based trading, while
Hi, I would like to create an expert advisor to fully automatic trade in MT4 as below, it should be possible with gold or any currency pairs and need to possible with 2, 3, 4 or 5 after decimal quotes PAROL MA CROSSOVER 1. Magic Number : Customize 2. Take profit in points : Customize 3. Stop loss in points : Customize 4. Strat time in GMT : Customize 5. End time in GMT : Customize (It means no need to open a new
Need MT4 EA which will trade based on Round Number and Supertrend. Trading conditions: If buy supertrend is >= lower round number and <= the higher round number, EA will place a buy pending order at the higher round number. If sell supertrend is <= higher round number and >=lower round number, EA will place sell pending order at the lower round number. If the trade is exited because of SL/BE, EA will place another

Informations sur le projet

Budget
30 - 100 USD
TVA (22%): 6.6 - 22 USD
Total: 36.6 - 122 USD
Pour le développeur
27 - 90 USD