I need an MQL5 version of my MQL4 EA

MQL5 Experts

Job finished

Execution time 29 days

Specification

I have wirtten a simple ea for mt4 which reads a file an executes an order. Now I need this ea for mt5.

The structure of the file is:

2012.10.25 09:00;EURUSD;LL;0.01;1.4200;2;0.003500;0.005500;0.005500;Runner ;12345;

ORDERTIME;Symbol;ORDERTYPE;Volume;Price ;Slippage;StopBreakEven;StopLoss;TakeProfit;Comment;MagicNumber;

ORDERTIME: Is used to detect outdated orders; Format 'YYYY.MM.DD HH:MM'.

ORDERTYPE: LL : Long Limit
           LM : Long Entry
           LS : Long Stop
           SL : Short Limit
           SM : Short Market
           SS : Short Stop
           XX : Exit Any 

Here is part of the code which has to be translated:

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
void start()
{
  string   Buffer;
  string   FileNameX = FileName + "(X)";
  int      Handle;
 
  string   Order_Comment = NULL;
  datetime Order_Expiration = NULL;
  double   Order_Lots = NULL;
  int      Order_MagicNumber = NULL;
  double   Order_Price = NULL;
  int      Order_Slippage = NULL;
  double   Order_StopBreakEven = NULL;
  double   Order_StopLoss = NULL;
  string   Order_Symbol = NULL;
  datetime Order_OpenTime = NULL;
  double   Order_TakeProfit = NULL;
  int      Order_Ticket = NULL;
  int      Order_Type = NULL;
 
  Buffer = "";
 
  if ( FileCode == "ASCII" )
  {
    Handle = FileOpen( FileName, FILE_BIN|FILE_READ );
    if ( ! ( Handle > 0 ) ) return;
   
    if ( FileSize( Handle ) > 0 ) Buffer = FileReadString( Handle, FileSize( Handle ) );
   
    FileClose( Handle );
  }
 
  if ( FileCode == "UNICODE" )
  {
    Buffer = ReadFile( TerminalPath() + "\\experts\\files\\" + FileName );
   
    Buffer = StringSubstr( Buffer, 2 );
  }
 
  if ( Buffer == "" ) return;
 
  Handle = FileOpen( FileNameX, FILE_BIN|FILE_WRITE );
  FileWriteString( Handle, Buffer, StringLen( Buffer ) );
  FileClose( Handle );
 
  if ( ( Period() * 60 ) > 600 ) Order_Expiration = Time[ 0 ] + Period() * 60;
 
  Handle = FileOpen( FileNameX, FILE_CSV|FILE_READ, ';' );
  if ( ! ( Handle > 0 ) ) return;
 
  if ( FileSize( Handle ) == NULL ) { FileClose( Handle ); return; }
 
  Order_OpenTime = StrToTime( StringTrimRight( StringTrimLeft( FileReadString( Handle ) ) ) );
 
  Order_Symbol = StringTrimRight( StringTrimLeft( FileReadString( Handle ) ) );
 
  Order_Type = IO;
  Buffer = StringTrimRight( StringTrimLeft( FileReadString( Handle ) ) );
  if ( Buffer == "LL" ) Order_Type = LL;
  if ( Buffer == "LM" ) Order_Type = LM;
  if ( Buffer == "LS" ) Order_Type = LS;
  if ( Buffer == "SL" ) Order_Type = SL;
  if ( Buffer == "SM" ) Order_Type = SM;
  if ( Buffer == "SS" ) Order_Type = SS;
  if ( Buffer == "XX" ) Order_Type = XX;
 
  Order_Lots = StrToDouble( StringTrimRight( StringTrimLeft( FileReadString( Handle ) ) ) );
  if ( MarketInfo( Symbol(), MODE_LOTSTEP ) == 0.1 ) Order_Lots = NormalizeDouble( Order_Lots, 1 );
 
  Order_Price = StrToDouble( StringTrimRight( StringTrimLeft( FileReadString( Handle ) ) ) );
 
  Order_Slippage = StrToInteger( StringTrimRight( StringTrimLeft( FileReadString( Handle ) ) ) );
 
  Order_StopBreakEven = StrToDouble( StringTrimRight( StringTrimLeft( FileReadString( Handle ) ) ) );
 
  Order_StopLoss = StrToDouble( StringTrimRight( StringTrimLeft( FileReadString( Handle ) ) ) );
 
  Order_TakeProfit = StrToDouble( StringTrimRight( StringTrimLeft( FileReadString( Handle ) ) ) );
 
  Order_Comment = StringTrimRight( StringTrimLeft( StringTrimRight( StringTrimLeft( FileReadString( Handle ) ) ) ) );
 
  Order_MagicNumber = StrToInteger( StringTrimRight( StringTrimLeft( FileReadString( Handle ) ) ) );
 
  FileClose( Handle );
 
  if ( ( TimeOut > 0 ) && ( Order_OpenTime < ( TimeCurrent() + TimeOffset * 60 - TimeOut * 60 ) ) )
  {
    Handle = FileOpen( FileNameX, FILE_BIN|FILE_READ );
    LogEvent( LOGERROR, "TimeOut: " + FileReadString( Handle, FileSize( Handle ) ) );
    FileClose( Handle );
   
    return;
  }
 
  for ( int Order = OrdersTotal(); Order > 0; Order-- )
  {
    if ( OrderSelect( ( Order - 1 ), SELECT_BY_POS, MODE_TRADES ) != true ) continue;
    if ( OrderSymbol() != Symbol() ) continue;
   
    if ( ( Order_MagicNumber == NULL ) || ( Order_MagicNumber == OrderMagicNumber() ) ) { Order_Ticket = OrderTicket(); break; }
  }
 
  switch ( Order_Type )
  {
    case LL: Order_Ticket = ResetOrder( Order_Ticket, OP_BUYLIMIT, Order_Slippage );
            
             if ( Order_Price == NULL ) Order_Price = Ask;
            
             if ( CurrentEntries( Order_MagicNumber ) < PositionMax )
               Order_Ticket = SendOrder( OP_BUYLIMIT, Order_Lots, Order_Price, NULL, Order_Comment, Order_MagicNumber, Order_Expiration );
            
             if ( OrderSelect( Order_Ticket, SELECT_BY_TICKET ) != true ) break;
            
             // ???
             Order_Ticket = ModifyOrder( Order_Ticket, ( Order_Price - Order_StopLoss ), ( Order_Price + Order_TakeProfit ) );
            
             break;
            
    case LM: Order_Ticket = ResetOrder( Order_Ticket, OP_BUY, Order_Slippage );
            
             if ( CurrentEntries( Order_MagicNumber ) < PositionMax )
               Order_Ticket = SendOrder( OP_BUY, Order_Lots, Order_Price, Order_Slippage, Order_Comment, Order_MagicNumber, NULL );
            
             if ( OrderSelect( Order_Ticket, SELECT_BY_TICKET ) != true ) break;
            
             if ( ( ( Order_StopLoss > 0 ) && ( OrderStopLoss() == NULL ) ) || ( ( Order_TakeProfit > 0 ) && ( OrderTakeProfit() == NULL ) ) )
             {
               if ( Order_StopLoss > 0 ) Order_StopLoss = OrderOpenPrice() - Order_StopLoss; else Order_StopLoss = OrderStopLoss();
               if ( Order_TakeProfit > 0 ) Order_TakeProfit = OrderOpenPrice() + Order_TakeProfit; else Order_TakeProfit = OrderTakeProfit();
               Order_Ticket = ModifyOrder( Order_Ticket, Order_StopLoss, Order_TakeProfit );
             }
            
             if ( ( Order_StopBreakEven > 0 ) && ( Bid > ( OrderOpenPrice() + Order_StopBreakEven ) ) )
               Order_Ticket = ModifyOrder( Order_Ticket, OrderOpenPrice(), OrderTakeProfit() );
            
             break;
            
    case LS: Order_Ticket = ResetOrder( Order_Ticket, OP_BUYSTOP, Order_Slippage );
            
             if ( Order_Price == NULL ) Order_Price = Ask;
            
             if ( CurrentEntries( Order_MagicNumber ) < PositionMax )
               Order_Ticket = SendOrder( OP_BUYSTOP, Order_Lots, Order_Price, NULL, Order_Comment, Order_MagicNumber, Order_Expiration );
            
             if ( OrderSelect( Order_Ticket, SELECT_BY_TICKET ) != true ) break;
            
             // ???
             Order_Ticket = ModifyOrder( Order_Ticket, ( Order_Price - Order_StopLoss ), ( Order_Price + Order_TakeProfit ) );
            
             break;
            
    case SL: Order_Ticket = ResetOrder( Order_Ticket, OP_SELLLIMIT, Order_Slippage );
            
             if ( Order_Price == NULL ) Order_Price = Bid;
            
             if ( CurrentEntries( Order_MagicNumber ) < PositionMax )
               Order_Ticket = SendOrder( OP_SELLLIMIT, Order_Lots, Order_Price, NULL, Order_Comment, Order_MagicNumber, Order_Expiration );
            
             if ( OrderSelect( Order_Ticket, SELECT_BY_TICKET ) != true ) break;
            
             // ???
             Order_Ticket = ModifyOrder( Order_Ticket, ( Order_Price + Order_StopLoss ), ( Order_Price - Order_TakeProfit ) );
            
             break;
            
    case SM: Order_Ticket = ResetOrder( Order_Ticket, OP_SELL, Order_Slippage );
            
             if ( CurrentEntries( Order_MagicNumber ) < PositionMax )
               Order_Ticket = SendOrder( OP_SELL, Order_Lots, Order_Price, Order_Slippage, Order_Comment, Order_MagicNumber, NULL );
            
             if ( OrderSelect( Order_Ticket, SELECT_BY_TICKET ) != true ) break;
            
             if ( ( ( Order_StopLoss > 0 ) && ( OrderStopLoss() == NULL ) ) || ( ( Order_TakeProfit > 0 ) && ( OrderTakeProfit() == NULL ) ) )
             {
               if ( Order_StopLoss > 0 ) Order_StopLoss = OrderOpenPrice() + Order_StopLoss; else Order_StopLoss = OrderStopLoss();
               if ( Order_TakeProfit > 0 ) Order_TakeProfit = OrderOpenPrice() - Order_TakeProfit; else Order_TakeProfit = OrderTakeProfit();
               Order_Ticket = ModifyOrder( Order_Ticket, Order_StopLoss, Order_TakeProfit );
             }
            
             if ( ( Order_StopBreakEven > 0 ) && ( Ask < ( OrderOpenPrice() - Order_StopBreakEven ) ) )
               Order_Ticket = ModifyOrder( Order_Ticket, OrderOpenPrice(), OrderTakeProfit() );
            
             break;
            
    case SS: Order_Ticket = ResetOrder( Order_Ticket, OP_SELLSTOP, Order_Slippage );
            
             if ( Order_Price == NULL ) Order_Price = Bid;
            
             if ( CurrentEntries( Order_MagicNumber ) < PositionMax )
               Order_Ticket = SendOrder( OP_SELLSTOP, Order_Lots, Order_Price, NULL, Order_Comment, Order_MagicNumber, Order_Expiration );
            
             if ( OrderSelect( Order_Ticket, SELECT_BY_TICKET ) != true ) break;
            
             // ???
             Order_Ticket = ModifyOrder( Order_Ticket, ( Order_Price + Order_StopLoss ), ( Order_Price - Order_TakeProfit ) );
            
             break;
            
    case XX: Order_Ticket = ResetOrder( Order_Ticket, -1, Order_Slippage );
            
             break;
            
    default: Handle = FileOpen( FileNameX, FILE_BIN|FILE_READ );
             LogEvent( LOGERROR, "Invalid OrderType: " + FileReadString( Handle, FileSize( Handle ) ) );
             FileClose( Handle );
  }
 
  if ( Debug )
  {
    Handle = FileOpen( FileNameX, FILE_BIN|FILE_READ );
    LogEvent( LOGDEBUG, "FileSize = " + FileSize( Handle ) + "; '" + FileReadString( Handle, FileSize( Handle ) ) );
    FileClose( Handle );
  }
}

 

Responded

1
Developer 1
Rating
(336)
Projects
620
38%
Arbitration
39
23% / 64%
Overdue
93
15%
Free
2
Developer 2
Rating
(59)
Projects
182
55%
Arbitration
31
45% / 16%
Overdue
103
57%
Free
3
Developer 3
Rating
(215)
Projects
302
79%
Arbitration
4
25% / 0%
Overdue
62
21%
Free
4
Developer 4
Rating
(90)
Projects
159
61%
Arbitration
40
18% / 63%
Overdue
70
44%
Free
5
Developer 5
Rating
(71)
Projects
254
53%
Arbitration
16
50% / 38%
Overdue
83
33%
Free
6
Developer 6
Rating
(47)
Projects
140
49%
Arbitration
9
56% / 0%
Overdue
27
19%
Free
7
Developer 7
Rating
(18)
Projects
37
43%
Arbitration
6
17% / 50%
Overdue
17
46%
Free
8
Developer 8
Rating
(1235)
Projects
2820
80%
Arbitration
156
22% / 43%
Overdue
488
17%
Free
Similar orders
so basically I have an EA(mql5), AI script(python), flask server and socket server both on python. Now this is an experimental script as I am trying to learn. However the EA is not entering any trades. How much would it cost for you to troubleshoot this for me? Thank you in advance
NEW FUNCTION 50+ USD
La idea es la siguiente, sería un EA semi automático. Yo como trader opero en zonas. En adelante las vamos a denominar ``zonas calientes´´. El EA debe que necesito debe operar conforme a 4 zonas calientes que yo configure en el mismo. ¿Qué hará el EA en cada una de esas zonas calientes que yo he configurado? En cada una de estas zonas el EA debe realizar hedging (crear un rango en el cual el EA entrara en sell o en
I have the bot just over half made, from another developer who let me down and decided they no longer wished to finish the project, so I have a basic example of the fundamentals of what it could look like, although multiple functions I require do not work, but I can show this to you on request. There are multiple features that I require, so please read the in depth requirement sheet on the attachment. Function: To
I need EA that works on MT5 to be able to do the following: - Can recognize Support/Resistance area - Can recognize VWAP direction. - Can recognize RSI. - Can recognize Double Top/bottom, Bullish/Bearish hammer candle, Bullish/bearish engulfing candle. - Ability to set Stoploss below/above support/resistance, but risk must be fixed at a certain price. - Stoploss
I want a program that will help calculate and enter the market on full margin for me. I just need to put in the price for entry, Stop loss and TP then it will calculate the lot sizes for entering the trade on full margin on Mt5
"I need an expert advisor (EA) based on stochastic divergence and candlestick formation. It should be able to identify both hidden and regular divergences. The EA should also include modified risk-reward ratios, modified timeframes, and a trailing stop loss. It is important that the EA is 100% accurate. Once an experienced developer applies, I will share the complete strategy."
I am seeking a highly skilled and experienced developer to assist with an important project. I need a development of an automated trading bot for NinjaTrader, utilizing a 4 SMA (Simple Moving Average) crossing strategy, with additional custom diversions for trade entries. The bot needs to be based on a strategy involving the crossing of four different SMAs. The exact periods for these SMAs and the conditions for
I need someone that can make expert advisor for backtesting purpose. The input file is History trade report export file from MQl5 the expert advisor should open position the exact time of open trade on the report. The same as the close time
So i have copier EA. The idea is the EA will triggered through manual OP by user via mobile or whatever platform. Let's say 0.01 lot to trigger it. After the EA takes master's position, the EA will be standby mode. If the master take more OP, the EA still not take the master's position (OP) until the user input manually once again via mobile for another 0.01 lot. Since this is a MT4 EA, Whenever user want to close
Hello, send robot models with a solid strategy (to trade forex), I want to use it to make money for the week. It is important that you present me with your profitability graph and a test. I also want to hire him for future jobs

Project information

Budget