Previous Next

GTrade.TradeOpenPrice()

Returns the opening price of the last opened and open trade.

double  GTrade.TradeOpenPrice(
   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 opening price of the last opened trade
   Print( trade.TradeOpenPrice() );
}


See also

GTrade.TradeProfit, GTrade.TradeProfitWithComment, GTrade.TradeDirection