I need an MQL5 version of my MQL4 EA

MQL5 Esperti

Lavoro terminato

Tempo di esecuzione 29 giorni

Specifiche

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

 

Con risposta

1
Sviluppatore 1
Valutazioni
(336)
Progetti
620
38%
Arbitraggio
39
23% / 64%
In ritardo
93
15%
Gratuito
2
Sviluppatore 2
Valutazioni
(59)
Progetti
182
55%
Arbitraggio
31
45% / 16%
In ritardo
103
57%
Gratuito
3
Sviluppatore 3
Valutazioni
(215)
Progetti
302
79%
Arbitraggio
4
25% / 0%
In ritardo
62
21%
Gratuito
4
Sviluppatore 4
Valutazioni
(90)
Progetti
159
61%
Arbitraggio
40
18% / 63%
In ritardo
70
44%
Gratuito
5
Sviluppatore 5
Valutazioni
(71)
Progetti
254
53%
Arbitraggio
16
50% / 38%
In ritardo
83
33%
Gratuito
6
Sviluppatore 6
Valutazioni
(47)
Progetti
140
49%
Arbitraggio
9
56% / 0%
In ritardo
27
19%
Gratuito
7
Sviluppatore 7
Valutazioni
(18)
Progetti
37
43%
Arbitraggio
6
17% / 50%
In ritardo
17
46%
Gratuito
8
Sviluppatore 8
Valutazioni
(1235)
Progetti
2820
80%
Arbitraggio
156
22% / 43%
In ritardo
488
17%
Gratuito
Ordini simili
Here is the Idea: I want a Semi Auto Trade Panel Manager EA that only activates when I press the BUY or SELL or BUY LIMIT or SELL LIMIT then the EA will do the rest : that includes the BUY STOP 0r SELL STOP and the hedging calculations according to below diagram. So overall , my only intervention is entering the lot size , hedge zone distance and TP ratio or entering the price for buy limit/sell limit then pressing
Hi, I'm looking for a martingale MT4 EA that performs a lot of trading volume per day. If you have the robot, you'll need to send me the demo so I can backtest it. Thank you very much
Hello potential Freelancers I’m very new to trading so please bear with me as I try to explain what ‘m looking for. I'm currently getting signals ( XAUUSD )sent to me and I’m looking to find a person who can look at the data either watch account live, or I send the trade history. The bot my provider is using makes 100’s of trades a day and does very well on average. I’m also looking to have the following features
Hello The EA will work on particular zone choose by the user and can mark it on any TF and with some rules can open trades and mange the trade by some unique rules. the EA need to check the difference by RSI as well and with some extra rules . developer should have good attitude and good communication (englsih) with high performence and knowledge with coding EA
we want to build a dashboard ea that would display on another chart key metrics : i will foward screeshot of what i want to dashboard to look like : the function i would need to get display are the following: 1. classified past performance ea by magic number ( with classic : total trade , total profit , return/dd , max dd (base on history) , ) 2. equity chart of performance if we click on a magic number we should
the task will be actually quiet simple , i need an active develloper to devellope out of 3 updates an ea STEP 1 (this job): make a classical pair trading ea , that can calculate correlation between assets and trade when the correlation diverge above a specified % the develloper that will postulate for the job will need : 1- to be ok to do the full project this job and the update following 2- very low arbitration , i
Hello, I want to create an EA that can be able to take and optimise trade bids using the trend tracker concept I have developed. The tracker will monitor the 2 lines in the below pictures and then start to activate bids once they cross each other and then be able to manage all bids afterwards towards the direction of the market by opening and closing them intermittently and profitably until the position at the other
Hi man, How are u? I have an EA and I need to check few aspects of the code, if It works fine? I am looking for an expert coder, who can understand mt4 language and help us to solve this out. This job will hardly take about 3-4 hours max for an experienced coder, when explained detail. Also, I would like to give this to someone, who can understand and speak English well. Also, the coder should be able to come via
Hello The EA will work on particular zone choose by the user and can mark it on any TF and with some rules can open trades and mange the trade by some unique rules. the EA need to check the difference by RSI as well and with some extra rules . developer should have good attitude and good communication (englsih) with high performence and knowledge with coding EA. THREE TYPES OF ENTRIES 1: AGGRESSIVE 2: DIVERGENCE 3
Indicator in use: Bollinger Bands Mechanism: (See diagrams provided for help) Sells: 1. Trigger candle: When candle low is above the top Bollinger band - accurate to the point scale (e.g. On EURUSD if candle low is 1.07915 and the value of top bollinger is 1.07914 - this is a sell signal) 2. Enter sell ONLY on the next candle if price breaks below the trigger candle LOW (using the e.g. above- if next candle price

Informazioni sul progetto

Budget