Previous Next

GTrade.LastTradeDate()

Returns the time at which the last trade was closed.

datetime  GTrade.LastTradeDate(
   string  symbol = NULL  // Symbol
   );

Parameter

symbol

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

Return value

Returns the timestamp of the last trade closing.


Example:

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

//--- Creation of 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
   trade.Init();

   return(INIT_SUCCEEDED);
}

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


void OnTick ()
{
   //--- Get the timestamp of the last closed trade
   Print( trade.LastTradeDate() );
}


See also

GTrade.LastTradeProfit