Download MetaTrader 5

Inserting a comment into the deal history of an EA

To add comments, please log in or register
Code Base will help you in mastering your theoretical skills. Come and learn!
Hendrik Keuris
537
Hendrik Keuris 2016.04.05 21:40 

Hi Guys,

How can I insert a comment into the history page of an EA? Every time it puts a line into the history column, I want to add the EA name into the comments column. Any ideas how to do that?

Thanks! 

Marco vd Heijden
Moderator
4684
Marco vd Heijden 2016.04.05 21:45  
OrderComment()
Hendrik Keuris
537
Hendrik Keuris 2016.04.05 21:50  
Marco vd Heijden:
Thanks!
Marco vd Heijden
Moderator
4684
Marco vd Heijden 2016.04.05 21:57  
FirestarZA:
Thanks!
OrderComment() 

Its to read the comment when the order is selected,

The actual comment is put through in the (MQL4) OrderSend() function:

OrderSend

The main function used to open market or place a pending order.

int  OrderSend( 
   string   symbol,              // symbol 
   int      cmd,                 // operation 
   double   volume,              // volume 
   double   price,               // price 
   int      slippage,            // slippage 
   double   stoploss,            // stop loss 
   double   takeprofit,          // take profit 
   string   comment=NULL,        // comment 
   int      magic=0,             // magic number 
   datetime expiration=0,        // pending order expiration 
   color    arrow_color=clrNONE  // color 
   );
 

There the yellow lines, and for MQL5:

struct MqlTradeRequest
  {
   ENUM_TRADE_REQUEST_ACTIONS    action;           // Trade operation type
   ulong                         magic;            // Expert Advisor ID (magic number)
   ulong                         order;            // Order ticket
   string                        symbol;           // Trade symbol
   double                        volume;           // Requested volume for a deal in lots
   double                        price;            // Price
   double                        stoplimit;        // StopLimit level of the order
   double                        sl;               // Stop Loss level of the order
   double                        tp;               // Take Profit level of the order
   ulong                         deviation;        // Maximal possible deviation from the requested price
   ENUM_ORDER_TYPE               type;             // Order type
   ENUM_ORDER_TYPE_FILLING       type_filling;     // Order execution type
   ENUM_ORDER_TYPE_TIME          type_time;        // Order expiration type
   datetime                      expiration;       // Order expiration time (for the orders of ORDER_TIME_SPECIFIED type)
   string                        comment;          // Order comment
   ulong                         position;         // Position ticket
   ulong                         position_by;      // The ticket of an opposite position
  };

Hendrik Keuris
537
Hendrik Keuris 2016.04.05 22:05  
Marco vd Heijden:

Its to read the comment when the order is selected,

The actual comment is put through in the (MQL4) OrderSend() function:

There the yellow lines, and for MQL5:

I was just about to ask for more clarification. I'm not a programmer. I only know enough to follow, so I was going through code in the examples to try and find ordercomment to see how it was used. Thanks for explaining! I think I now have it! :)
To add comments, please log in or register