I need an MQL5 version of my MQL4 EA

MQL5 Asesores Expertos

Trabajo finalizado

Plazo de ejecución 29 días

Tarea técnica

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

 

Han respondido

1
Desarrollador 1
Evaluación
(336)
Proyectos
621
38%
Arbitraje
39
23% / 64%
Caducado
93
15%
Libre
2
Desarrollador 2
Evaluación
(59)
Proyectos
182
55%
Arbitraje
31
45% / 16%
Caducado
103
57%
Libre
3
Desarrollador 3
Evaluación
(215)
Proyectos
302
79%
Arbitraje
4
25% / 0%
Caducado
62
21%
Libre
4
Desarrollador 4
Evaluación
(90)
Proyectos
159
61%
Arbitraje
40
18% / 63%
Caducado
70
44%
Libre
5
Desarrollador 5
Evaluación
(71)
Proyectos
254
53%
Arbitraje
16
50% / 38%
Caducado
83
33%
Libre
6
Desarrollador 6
Evaluación
(47)
Proyectos
140
49%
Arbitraje
9
56% / 0%
Caducado
27
19%
Libre
7
Desarrollador 7
Evaluación
(18)
Proyectos
37
43%
Arbitraje
6
17% / 50%
Caducado
17
46%
Libre
8
Desarrollador 8
Evaluación
(1235)
Proyectos
2820
80%
Arbitraje
156
22% / 43%
Caducado
488
17%
Libre
Solicitudes similares
I would like to create an EA based on the Shved Supply and Demand indicator. you can find the Shved Supply and Demand v1.7 indicator in the following link https://www.mql5.com/en/code/29395 NB: Checks the trading robot must pass before publication in the Market ( https://www.mql5.com/en/articles/2555 ) MQ5 file to be provided
Im looking for an coder to code an EA: Trade management 1. opening trades according to the indicator 2. trades settings to choose from like: open all trades according to the signal open only trade 1,2,3 or 4 % per trade ( example 50/30/20 of the lot settings, with 4 trades it would be for example 50/30/10/10) 3. SL/Trailing settings: Move SL to entry after hitting TP1/TP2 or TP3 moving SL by % keep the original SL
Hi I'm looking to have 2 of my pinescript strategies converted to MQL5 and was wondering if you could first give me a quote for the more simple strategy and then for both the simple and complex strategy together. The simple strategy is a MACD crossover type thing that uses a special EMA script that filters out some ranging price action and also fractal candles for the stop loss. The second strategy is market
I want grate robot for making profits that know when to start a good trade and close a trade and must be active all time to avoid lost of money
I have developed a very strong TradingView strategy in Pine Script but unfortunately, a third-party connector is requiired and in my opinion, I want a more direct connection. I am not brilliant at coding, but I have coded the majority of the MT5 code and I would like you to make sure that the MT5 code matches my TradingView script and executes the same way as the TradingView script that I will provide if you are
Mbeje fx 50+ USD
I like to own my robot that why I want to build my own.i like to be a best to every robot ever in the life to be have more money
I need an MT5 EA that can do the following: I have to give the EA a price in advance, when the price is reached the EA has to automatically place a buy stop or sell stop order 0.5 pips below or above the price. Is this possible
Dr Pattern 30+ USD
good day i need the service of the seaso coder to help me fix my ea The Job required 1 knowledge of Mt4 and Mt5 indicator coding 2. Telegram code 3. ability to code indicator to work on multiple Time frame combine to trade 4 Ability to Join two or three indicator on same ir different time frame if you have these skill please let chart i will discuss the details of the Job inside to you The required day including
Good day, I want someone to help me create a universal news filter with on/off switch, with start and end settings, and drawdown control with magic number of EAs, etc. Thanks
Hello, I am looking for a professional programmer to optimize my existing EA integrating it with ChatGPT to analyze currencies using various methods to make the right trading decisions. i want it to be an EA that can be trusted to carry trade with the help of chat gpt and also have a very low drawdown

Información sobre el proyecto

Presupuesto