I Make an EA Martingale and need some tips

MQL4 Indicadores Experts

Trabalho concluído

Tempo de execução 4 dias
Comentário do 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 !!!

Termos de Referência

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



Respondido

1
Desenvolvedor 1
Classificação
(879)
Projetos
1392
67%
Arbitragem
117
32% / 42%
Expirado
215
15%
Livre
2
Desenvolvedor 2
Classificação
(597)
Projetos
930
46%
Arbitragem
31
39% / 29%
Expirado
93
10%
Livre
3
Desenvolvedor 3
Classificação
(804)
Projetos
1376
72%
Arbitragem
113
28% / 48%
Expirado
343
25%
Trabalhando
4
Desenvolvedor 4
Classificação
Projetos
0
0%
Arbitragem
0
Expirado
0
Livre
5
Desenvolvedor 5
Classificação
(2434)
Projetos
3066
66%
Arbitragem
77
48% / 14%
Expirado
340
11%
Livre
6
Desenvolvedor 6
Classificação
(14)
Projetos
22
59%
Arbitragem
2
0% / 50%
Expirado
2
9%
Livre
Pedidos semelhantes
Hi there, I would like an EA based of this indicator in the MQL store located here https://www.mql5.com/en/market/product/110504?source=Site +Profile+Seller#description MACD Signal Indicator by Adam Zolei I would like all the settings to be configurable in the original indicator, with a few extra such as Time Fiter e.g. only trade between these 2 time periods also I want an option to change the candle signal, e.g. if
I need a developer of the robot that shall do the following 1. Makes a minimum of $600 per month with a capital of $60 2. The robot shall be plug and pay (In short it shall analyze the market and execute trades) 3. The robot should be compatible to MT5 Mobile Phone and computer MT5. 4. The robot shall allow me to set date of expiry to any account of broker. The robot shall trade the Market Structure Cheat Codes which
Hi, I have my own strategy and some development done on it. But my developer is not able to solve few errors. Strategy has been built already. Can anyone help me with that
We are looking for an experienced MQL5 programmer to develop an Expert Advisor (EA) on MetaTrader 5. The project involves creating an automated trading bot that uses a methodology based on the integration of 2 technical indicators. If you have proven experience in similar projects, we invite you to apply. Main Description of the Bot Trading Methodology Details : The trading bot will operate based on a strategy that
Build mql5 EA and connection to python file , need mql5 and python skills , need to be able to know how connect MT5 EA to python file and have had experience doing it before. PLEASE no-one respond to this job request if you do NOT have very good experience doing this type of thing. My time and money has already been wasted with other devs (not devs from mql5.com) So please do not apply if you do not have very good
1. **Daily Opening Price:** - On MT15, use a horizontal line to mark the daily opening price. 2. **Key Levels:** - Calculate key levels by adding 90 points to the opening price. For example, if the opening price is 1800.12, the key levels will be: - +90 points: 1890.12 - +180 points: 1980.12 - +270 points: 2070.12 - +360 points: 2160.12 - For levels below the opening price, subtract 90 points: -
Job Title: Expert Advisor (EA) Developer for Forex Trading Job Description: I am seeking an experienced Expert Advisor (EA) developer to create a customized trading bot for the MetaTrader 4/5 platform. The bot will be designed to execute a sophisticated trading strategy that incorporates daily range calculations, cost averaging, and hedging with precise pip management. The successful candidate should have strong
Hello, I have built and EA with FX Dreema ( https://fxdreema.com/ ) that uses the maximum and minimum vales of the previous candle to entry on a trade. After that, I put a Stop Loss and Trailing Stop on that order, and goes as the market follows up and down. First, I recognize what I'm asking in this project may not be possible. I know about the differences in results comparing Strategy Tester with Real and Live
I have an indicator here for sun Candlesticks...I'm looking for a programmer who can convert it to an EA . The EA must just follow the color of the candlesticks. Open and close based on the color of the candlesticks
Hello, I am looking to make a modification to an indicator so it runs NT8. This is the link to the indicator in question. https://ninjatraderecosystem.com/user-app-share-download/realtime-level-ii-tick-volume/ I also want to know if if will be possible to add drop down boxes so I can change / choose my own colours and halve an option to adjust the width of the side bar regards

Informações sobre o projeto

Orçamento
30 - 100 USD
IVA (22%): 6.6 - 22 USD
Total: 36.6 - 122 USD
Desenvolvedor
27 - 90 USD