Previous Next


Returns the direction (LONG / SHORT) of the last opened and open trade.

GDirections  GTrade.TradeDirection();
   string  symbol = NULL  // Symbol



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

Return value

Returns the GDirections direction of the last opened and open trade.


//--- 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();

   //--- Die Daten der Klasse initialisieren


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

void OnTick ()
   //--- Get the profit of the last opened trade
   PrintEnumToString(trade.TradeDirection()) );

See also

GTrade.TradeProfit, GTrade.TradeOpenPrice, GTrade.TradeProfitWithComment