I Make an EA Martingale and need some tips

仕事が完了した

実行時間4 日
依頼者からのフィードバック
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 !!!

指定

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



応答済み

1
開発者 1
評価
(885)
プロジェクト
1410
67%
仲裁
123
32% / 41%
期限切れ
218
15%
パブリッシュした人: 1 code
2
開発者 2
評価
(625)
プロジェクト
984
47%
仲裁
32
38% / 34%
期限切れ
97
10%
仕事中
パブリッシュした人: 6 codes
3
開発者 3
評価
(847)
プロジェクト
1449
72%
仲裁
120
28% / 47%
期限切れ
355
24%
仕事中
パブリッシュした人: 3 articles
4
開発者 4
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
5
開発者 5
評価
(2640)
プロジェクト
3355
67%
仲裁
77
48% / 14%
期限切れ
342
10%
パブリッシュした人: 1 code
6
開発者 6
評価
(14)
プロジェクト
22
59%
仲裁
2
0% / 50%
期限切れ
2
9%
パブリッシュした人: 1 code
類似した注文
I am looking for an experienced MT5 / MQL5 developer to fix an issue with my existing trading bot. The bot is currently working and I want to keep all features, logic, and the dashboard exactly as they are . No modifications to strategy, UI, or other functionalities are needed. The Problem: When I set Take Profit (TP) and Stop Loss (SL), approximately 25% of the trades are opened without TP and/or SL applied. This
Pro EA 30+ USD
Hi, I want to build a trading robot specifically for passing a prop firm challenge. The EA should focus on strict risk management, low drawdown, and consistency suitable for prop firm rules. My current budget for this project is $30. Please let me know what is achievable within this budget and the strategy you recommend
Indicator Simple Moving Averages and Exponential Moving Average BUY SIGNALS SMA 7 High Crosses Above 20 EMA= LIME color Buy Signal at the low of next candle. SMA 7 High Crosses above 40 EMA= BLUE color Buy Signal at low of next candle. SMA 7 High Crossed above 200 EMA= YELLOW Color buy signal at the low of next candle. SELL SIGNALS SMA 7 Low Crosses below 20 Ema= LIME color Sell Signal at the high of next candle. SMA
TRADE COPIER 80+ USD
hello great developer im looking for trade copier I want to tell me more about the features, returns, risks and scalability I think you can tell me the best platform to use for effective results. I also want to know whether it's automated, daily/weekly/monthly returns (profit) and monthly drawdown
WILL PROVIDE MORE DETAILS IN CHAT ... THE EA The EA executes (places trades)? The EA exits (closes trades)? The EA expired ? Or something else? Please provide more details: Which platform? ( MetaTrader 5 or MetaTrader 4 ) What exactly is happening? (error message, no trades, wrong trades, etc.) Broker name? Symbol (like XAUUSD, XAUUSD+, etc.) Send the exact message or screenshot text and I’ll fix it step-by-step
I'm seeking an experienced developer to improve my current, complex MQL4 Expert Advisor. The primary focus of this project is to incorporate new trading strategies and rectify issues related to inaccurate trade execution. Key Responsibilities: - Integrate new trading strategies into the Expert Advisor. - Diagnose and fix issues causing inaccurate trade execution. - Potentially optimize the performance of the Expert
I trade manually on M1 chart (XAUUSD) with fractals and alligator. When there is a price break on fractal (or some fractals that form a price level) or a price level created by multiple candles spikes, I enter 2 trades (0.02 lots), and 2 trades (0.04 lots). If I go in profit (5/10€), I close in profit. But if I go in loss with DD, at this point starts the management: every price level (important level) created by
Phahla fx boto 30+ USD
99.99% signal accuracy 10-15 trades distribution all currency trade and meta AI assistance on loss[advice] stop and start robot cyber security firewall protection activation code: 20060605TLP20 Please create a trading bot with any logo with the name elevation
Refine signal trigger execution . Optimize live chart performance . Ensure stable and clean code structure : Stable and clean code is important . Otherwise its a mess . Apply with as much accurate structure you foresee
I am looking to purchase a fully developed and proven Expert Advisor (EA) for XAUUSD. This must be an existing EA with a minimum of 12 months verified live trading history on a real account. I am not interested in new development or demo-only systems. Requirements: • Verified live track record (Myfxbook, MQL5 signal, or broker statement) • Consistent profitability with controlled drawdown • Designed for XAUUSD •

プロジェクト情報

予算
30 - 100 USD