> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ninjatrader.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ninjatrader.com/_mcp/server.

# WinningTrades

## Definition

A subcollection of [Trade](/developer/desktop-sdk/references/strategy/trade) objects consisting of only the winning trades in a [TradeCollection](/developer/desktop-sdk/references/strategy/tradecollection). You can access a trade object by providing an index value. Trades are indexed sequentially meaning the oldest trade taken in a strategy will be at an index value of zero. The most recent trade taken will be at an index value of the total trades in the collection minus 1.

## Methods and Properties

| Method/Property                                                                                   | Description                                                                                                                   |
| ------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| [Count](/developer/desktop-sdk/references/strategy/tradecollection/tradescount)                   | An int value representing the number of trades in the collection                                                              |
| [GetTrades()](/developer/desktop-sdk/references/strategy/gettrades)                               | Gets a [TradeCollection](/developer/desktop-sdk/references/strategy/tradecollection) object representing a specified position |
| [TradesPerformance](/developer/desktop-sdk/references/strategy/tradecollection/tradesperformance) | Gets a [TradesPerformance](/developer/desktop-sdk/references/strategy/tradecollection/tradesperformance) object               |

## Syntax

`\<TradeCollection\>.WinningTrades`

## Examples

```csharp
protected override void OnBarUpdate()  
{  
    // Accesses the first/last winning trade in the strategy (oldest trade is at index 0)  
    // and prints out the profit as a percentage to the output window  
    if (SystemPerformance.AllTrades.WinningTrades.Count > 1)  
    {  
        Trade lastTrade = SystemPerformance.AllTrades.WinningTrades[SystemPerformance.AllTrades.Count - 1];  
        Trade firstTrade = SystemPerformance.AllTrades.WinningTrades[0];  
   
        Print("The last winning trade's profit was " + lastTrade.ProfitPercent);  
        Print("The first winning trade's profit was " + firstTrade.ProfitPercent);  
    }  
}
```