NinjaScript > Language Reference > Strategy > TradeCollection >

GetTrades()

Print this Topic Previous pageReturn to chapter overviewNext page

Definition
Returns a TradeCollection object representing all trades that make up the specified position.
 

Method Return Value

An TradeCollection object.

 

Syntax
<TradeCollection>.GetTrades(string instrument, string entrySignalName, int instance)

 

Parameters

instrument

An instrument name such as "MSFT"

entrySignalName

The name of your entry signal

instance

The occurrence to check for (1 is the most recent, 2 is the 2nd most recent position, etc...)

 

 
Examples

TradeCollection myTrades = Performance.AllTrades.GetTrades("MSFT", "myEntrySignal", 1);
Print("The last position was comprised of " + myTrades.Count + " trades.");