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

# Resetting values at the beginning of new trading sessions

Normally calculated values are carried over between trading sessions, but sometimes you may want to reset these values to begin a trading session fresh. The technique demonstrated in this reference sample can be useful to do things like resetting counters you may be running or clearing bool flags you may have set.

## Key concepts in this example

* Resetting a variable at the beginning of a new trading session
* Limiting the number of trades a strategy can make per trading session

## Important related documentation

* [IsFirstBarOfSession](/developer/desktop-sdk/references/common/bars/isfirstbarofsession)
* [IsFirstTickOfBar](/developer/desktop-sdk/references/common/onbarupdate/isfirsttickofbar)
* [EnterLong()](/developer/desktop-sdk/references/strategy/order-methods/managed-approach/enterlong)
* [ExitLong()](/developer/desktop-sdk/references/strategy/order-methods/managed-approach/exitlong)

## Import instructions

1. Download the file contained in this Help Guide topic to your PC desktop
2. From the Control Center window, select the menu Tools > Import > NinjaScript
3. Select the downloaded file

[SampleTradeLimiter\_NT8.zip](https://ninjatrader.com/support/helpGuides/nt8/samples/SampleTradeLimiter_NT8.zip)