NinjaScript > Language Reference > Strategy >

Performance

Print this Topic Previous pageReturn to chapter overviewNext page

Definition

The Performance object holds all trades and trade performance data generated by a strategy.

 

A NinjaScript strategy can generate both synthetic trades (historical backtest trades) and real-time trades executed on a real-time data stream. If you wish to access only real-time trades, access the "RealtimeTrades" collection
The first trade of the "RealtimeTrades" collection will contain a synthetic entry execution if the strategy was NOT flat at the time you start the strategy.

 

Methods and Properties

AllTrades

Gets a TradeCollection object of all trades generated by the strategy

LongTrades

Gets a TradeCollection object of long trades generated by the strategy

RealtiimeTrades

Gets a TradeCollection object of real-time trades generated by the strategy

ShortTrades

Gets a TradeCollection object of short trades generated by the strategy

 

 

Examples

protected override void OnBarUpdate()
{
    // Print out the number of long trades

    Print("The strategy has taken " + Performance.LongTrades.Count + " long trades.");
}