> 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.

# IncludeTradeHistoryInBacktest

## Definition

Determines if the strategy will save orders, trades, and execution history. When this property is set to false you will see significant memory savings at the expense of having access to the detailed trading information.

* Since trade information is not stored you will only see entry/exit executions plotted on the chart with no connecting PnL trade lines.

* This property is always defaulted to true, except when the strategy is running on the strategy tab.

## Property Value

This property returns true if the strategy will include trade history; otherwise, false. Default is set to true.

This property should ONLY be set from the **OnStateChange()** method during State.Configure (or State.SetDefaults when adding the script from the strategy tab).

## Syntax

`IncludeTradeHistoryInBacktest`

## Examples

```csharp
protected override void OnStateChange()
{
    if (State == State.Configure)
    {
        // Exclude trade history in a backtest to benefit from memory savings
        IncludeTradeHistoryInBacktest = false;
    }
}

protected override void OnBarUpdate()
{
    // Stop taking trades after 10 trades have been taken since the strategy was enabled
    if(SystemPerformance.AllTrades.Count >= 10)
        return;
}
```