Previous Next


Returns the current profit of an open trade with a specific comment on a specific symbol.

double  GTrade.TradeProfitWithComment(
   string  comment,       // Required comment for output
   string  symbol = NULL  // Symbol



[in]  The comment that the open position must contain to output the value.


[in]  The symbol from which the value should be output.

Return value

Returns the profit of the last opened trade with a certain comment.


//--- Include Glib classes
#include <Glib.mqh>

//--- Create a pointer to an empty class object
GTrade *trade;

int OnInit ()
   //--- Assign the class to the empty class object
   trade = gTrade();

   //--- Initialize the class data


void OnDeinit (const int reason)
   //--- Release memory on exit
   delete trade;

void OnTick ()
   //--- Get the profit of a specific open trade
   Print( trade.TradeProfitWithComment("Auto Trade") );

See also

GTrade.TradeProfit, GTrade.TradeOpenPrice, GTrade.TradeDirection