Previous Next

GTrade.TradeProfit()

Returns the current profit of the last opened and open trade.

double  GTrade.TradeProfit(
   string  symbol = NULL  // Symbol
   );

Parameters

symbol

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

Return value

Returns the current profit of the last opened and open trade.


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 data of the class
   trade.Init();

   return(INIT_SUCCEEDED);
}

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


void OnTick ()
{
   //--- Get the profit of the last opened trade
   Print( trade.TradeProfit() );
}


See also

GTrade.TradeOpenPrice, GTrade.TradeProfitWithComment, GTrade.TradeDirection