I need an MQL5 version of my MQL4 EA

MQL5 Uzman Danışmanlar

İş tamamlandı

Tamamlanma süresi: 29 gün

İş Gereklilikleri

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

 

Yanıtlandı

1
Geliştirici 1
Derecelendirme
(336)
Projeler
620
38%
Arabuluculuk
39
23% / 64%
Süresi dolmuş
93
15%
Serbest
2
Geliştirici 2
Derecelendirme
(59)
Projeler
182
55%
Arabuluculuk
31
45% / 16%
Süresi dolmuş
103
57%
Serbest
3
Geliştirici 3
Derecelendirme
(215)
Projeler
302
79%
Arabuluculuk
4
25% / 0%
Süresi dolmuş
62
21%
Serbest
4
Geliştirici 4
Derecelendirme
(90)
Projeler
159
61%
Arabuluculuk
40
18% / 63%
Süresi dolmuş
70
44%
Serbest
5
Geliştirici 5
Derecelendirme
(71)
Projeler
254
53%
Arabuluculuk
16
50% / 38%
Süresi dolmuş
83
33%
Serbest
6
Geliştirici 6
Derecelendirme
(47)
Projeler
140
49%
Arabuluculuk
9
56% / 0%
Süresi dolmuş
27
19%
Serbest
7
Geliştirici 7
Derecelendirme
(18)
Projeler
37
43%
Arabuluculuk
6
17% / 50%
Süresi dolmuş
17
46%
Serbest
8
Geliştirici 8
Derecelendirme
(1235)
Projeler
2820
80%
Arabuluculuk
156
22% / 43%
Süresi dolmuş
488
17%
Serbest
Benzer siparişler
We are looking for an experienced Expert Advisor Developer who can build a customized MT5 Expert Advisor for us. The Expert Advisor would use two built-in indicators as entry/exit signals and our own risk management strategy with customizable inputs. The goal is to create a reliable and efficient trading tool that can automate our trading process on the MT5 platform. Skills required: - Strong understanding of
I need stochastic div (hidden &regular ea) that should perform task in all tf's ..divergence is a repaint stly so i want to use it with candlestick flips .. so bet for it
Hello, I have an indicator from a friend and I'd like to replicate it on my own TradingView or MT5 platform. Could you assist me with that?. Here is the link
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

Proje bilgisi

Bütçe