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

# Strategy

The methods and properties covered in this section are unique to custom strategy development.

## In this section

| [Strategy Account](/developer/desktop-sdk/references/strategy/account)                                                            | Represents the real-world or simulation Account configured for the strategy.                                                                                                                |
| --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [AddChartIndicator()](/developer/desktop-sdk/references/strategy/addchartindicator)                                               | Adds an indicator to the strategy only for the purpose of displaying it on a chart.                                                                                                         |
| [AddPerformanceMetric()](/developer/desktop-sdk/references/strategy/addperformancemetric)                                         | Adds an instance of custom **Performance Metric** to a strategy used in strategy calculations.                                                                                              |
| [ATM Strategy Methods](/developer/desktop-sdk/references/strategy/atm-strategy-methods)                                           | Adds ATM strategies to manage your position                                                                                                                                                 |
| [BarsRequiredToTrade](/developer/desktop-sdk/references/strategy/barsrequiredtotrade)                                             | The number of historical bars required before the strategy starts processing order methods called in the **OnBarUpdate()** method.                                                          |
| [BarsSinceEntryExecution()](/developer/desktop-sdk/references/strategy/barssinceentryexecution)                                   | Returns the number of bars that have elapsed since the last specified entry.                                                                                                                |
| [BarsSinceExitExecution()](/developer/desktop-sdk/references/strategy/barssinceexitexecution)                                     | Returns the number of bars that have elapsed since the last specified exit.                                                                                                                 |
| [ChartIndicators](/developer/desktop-sdk/references/strategy/chartindicators)                                                     | Contains a collection of Indicators which have been added to the strategy instance using **AddChartIndicator()**.                                                                           |
| [CloseStrategy()](/developer/desktop-sdk/references/strategy/closestrategy)                                                       | Cancels all working orders, closes any existing positions, and finally disables the strategy.                                                                                               |
| [ConnectionLossHandling](/developer/desktop-sdk/references/strategy/connectionlosshandling)                                       | Sets the manner in which your strategy will behave when a connection loss is detected.                                                                                                      |
| [DaysToLoad](/developer/desktop-sdk/references/strategy/daystoload)                                                               | Determines the number of trading days which will be configured when loading the strategy from the Strategies Grid.                                                                          |
| [DefaultQuantity](/developer/desktop-sdk/references/strategy/defaultquantity)                                                     | An order size variable that can be set either programmatically or overridden via the Strategy that determines the quantity of an entry order.                                               |
| [DisconnectDelaySeconds](/developer/desktop-sdk/references/strategy/disconnectdelayseconds)                                       | Determines the amount of time a disconnect would have to last before **connection loss handling** takes action.                                                                             |
| [EntriesPerDirection](/developer/desktop-sdk/references/strategy/entriesperdirection)                                             | Determines the maximum number of entries allowed per direction while a position is active based on the **EntryHandling** property.                                                          |
| [EntryHandling](/developer/desktop-sdk/references/strategy/entryhandling)                                                         | Sets the manner in how entry orders will handle.                                                                                                                                            |
| [Execution](/developer/desktop-sdk/references/strategy/execution)                                                                 | Represents a read-only interface that exposes information regarding an execution (filled order) resulting from an order and is passed as a parameter in the **OnExecutionUpdate()** method. |
| [ExitOnSessionCloseSeconds](/developer/desktop-sdk/references/strategy/exitonsessioncloseseconds)                                 | The number of seconds before the actual session end time that the "**IsExitOnSessionCloseStrategy**" function will trigger.                                                                 |
| [IncludeCommission](/developer/unsorted/includecommission)                                                                        | Determines if the strategy performance results will include commission on a historical backtest.                                                                                            |
| [IncludeTradeHistoryInBacktest](/developer/desktop-sdk/references/strategy/includetradehistoryinbacktest)                         | Determines if the strategy will save orders, trades, and execution history.                                                                                                                 |
| [IsAdoptAccountPositionAware](/developer/desktop-sdk/references/strategy/isadoptaccountpositionaware)                             | Determines if the strategy is programmed in a manner capable of handling real-world account positions.                                                                                      |
| [IsExitOnSessionCloseStrategy](/developer/desktop-sdk/references/strategy/isexitonsessionclosestrategy)                           | Determines if the strategy will cancel all strategy-generated orders and close all open strategy positions at the close of the session.                                                     |
| [IsFillLimitOnTouch](/developer/desktop-sdk/references/strategy/isfilllimitontouch)                                               | Determines if the strategy will use a more liberal fill algorithm for back-testing purposes only.                                                                                           |
| [IsInstantiatedOnEachOptimizationIteration](/developer/desktop-sdk/references/strategy/isinstantiatedoneachoptimizationiteration) | Determines if the strategy should be re-instantiated (re-created) after each optimization run when using the **Strategy Analyzer Optimizer**.                                               |
| [IsInStrategyAnalyzer](/developer/desktop-sdk/references/strategy/isinstategyanalyzer)                                            | Determines if the current **NinjaScript Strategy** is run from a Strategy Analyzer chart.                                                                                                   |
| [IsTradingHoursBreakLineVisible](/developer/desktop-sdk/references/strategy/istradinghoursbreaklinevisible)                       | Plots trading hours break lines on the indicator panel.                                                                                                                                     |
| [IsWaitUntilFlat](/developer/desktop-sdk/references/strategy/iswaituntilflat)                                                     | Indicates the strategy is currently waiting until a flat position is detected before submitting live orders.                                                                                |
| [NumberRestartAttempts](/developer/desktop-sdk/references/strategy/numberrestartattempts)                                         | Determines the maximum number of restart attempts allowed within the last x minutes defined in **RestartsWithinMinutes** when the strategy experiences a connection loss.                   |
| [OnAccountItemUpdate()](/developer/desktop-sdk/references/strategy/onaccountitemupdate)                                           | An event-driven method used for strategies which is called for each AccountItem update for the account on which the strategy is running.                                                    |
| [OnExecutionUpdate()](/developer/desktop-sdk/references/strategy/onexecutionupdate)                                               | An event-driven method which is called on an incoming execution of an order managed by a strategy.                                                                                          |
| [OnOrderTrace()](/developer/desktop-sdk/references/strategy/onordertrace)                                                         | An event-driven method used for strategies which will allow you to customize the output of **TraceOrders**.                                                                                 |
| [OnOrderUpdate()](/developer/desktop-sdk/references/strategy/onorderupdate)                                                       | An event-driven method which is called each time an order managed by a strategy changes state.                                                                                              |
| [OnPositionUpdate()](/developer/desktop-sdk/references/strategy/onpositionupdate)                                                 | An event-driven method which is called each time the position of a strategy changes state.                                                                                                  |
| [OptimizationPeriod](/developer/desktop-sdk/references/strategy/optimizationperiod)                                               | Reserved for **Walk-Forward Optimization**, this property determines the number of days used for the "in sample" backtest period for a given strategy. See also **TestPeriod**.             |
| [Order](/developer/desktop-sdk/references/strategy/order)                                                                         | Represents a read-only interface that exposes information regarding an order.                                                                                                               |
| [Order Methods](/developer/desktop-sdk/references/strategy/order-methods)                                                         | **NinjaScript** provides several approaches you can use for order placement within your **NinjaScript strategy**.                                                                           |
| [OrderFillResolution](/developer/desktop-sdk/references/strategy/orderfillresolution)                                             | Determines how strategy orders are filled during historical states.                                                                                                                         |
| [OrderFillResolutionType](/developer/desktop-sdk/references/strategy/orderfillresolutiontype)                                     | Determines the bars type which will be used for historical fill processing.                                                                                                                 |
| [OrderFillResolutionValue](/developer/desktop-sdk/references/strategy/orderfillresolutionvalue)                                   | Determines the bars period interval value which will be used for historical fill processing.                                                                                                |
| [PerformanceMetrics](/developer/desktop-sdk/references/strategy/tradecollection/tradesperformance/performancemetrics)             | Holds an array of **PerformanceMetrics** objects that represent custom metrics that can be used for strategy calculations.                                                                  |
| [Plots](/developer/desktop-sdk/references/strategy/strategy-plots)                                                                | A collection holding all of the Plot objects that define their visualization characteristics.                                                                                               |
| [Position](/developer/desktop-sdk/references/strategy/position)                                                                   | Represents position-related information that pertains to an instance of a strategy.                                                                                                         |
| [PositionAccount](/developer/desktop-sdk/references/strategy/positionaccount)                                                     | Represents position-related information that pertains to real-world account (live or simulation).                                                                                           |
| [Positions](/developer/desktop-sdk/references/strategy/positions)                                                                 | Holds an array of **Position** objects that represent positions managed by the strategy.                                                                                                    |
| [PositionsAccount](/developer/desktop-sdk/references/strategy/positionsaccount)                                                   | Holds an array of **PositionAccount** objects that represent positions managed by the strategy's account.                                                                                   |
| [RealtimeErrorHandling](/developer/desktop-sdk/references/strategy/realtimeerrorhandling)                                         | Defines the behavior of a strategy when a strategy-generated order is returned from the broker's server in a "Rejected" state.                                                              |
| [RestartsWithinMinutes](/developer/desktop-sdk/references/strategy/restartswithinminutes)                                         | Determines within how many minutes the strategy will attempt to restart.                                                                                                                    |
| [SetOrderQuantity](/developer/desktop-sdk/references/strategy/setorderquantity)                                                   | Determines how order sizes are calculated for a given strategy.                                                                                                                             |
| [Slippage](/developer/desktop-sdk/references/strategy/slippage)                                                                   | Sets the amount of slippage in ticks per execution used in performance calculations during backtests.                                                                                       |
| [StartBehavior](/developer/desktop-sdk/references/strategy/startbehavior)                                                         | Sets the start behavior of the strategy. See **Syncing Account Positions** for more information.                                                                                            |
| [StopTargetHandling](/developer/desktop-sdk/references/strategy/stoptargethandling)                                               | Determines how stop and target orders are submitted during an entry order execution.                                                                                                        |
| [StrategyBaseConverter](/developer/desktop-sdk/references/strategy/strategybaseconverter)                                         | A custom **TypeConverter** class handling the designed behavior of a strategy's property descriptor collection.                                                                             |
| [SystemPerformance](/developer/desktop-sdk/references/strategy/systemperformance)                                                 | The **SystemPerformance** object holds all trades and trade performance data generated by a strategy.                                                                                       |
| [TestPeriod](/developer/desktop-sdk/references/strategy/testperiod)                                                               | Reserved for **Walk-Forward Optimization**, this property determines the number of days used for the "out of sample" backtest period for a given strategy.                                  |
| [TimeInForce](/developer/desktop-sdk/references/strategy/timeinforce)                                                             | Sets the time in force property for all orders generated by a strategy.                                                                                                                     |
| [TraceOrders](/developer/desktop-sdk/references/strategy/traceorders)                                                             | Determines if **OnOrderTrace()** would be called for a given strategy.                                                                                                                      |
| [Trade](/developer/desktop-sdk/references/strategy/trade)                                                                         | A Trade is a completed buy/sell or sell/buy transaction. It consists of an entry and exit execution.                                                                                        |
| [TradeCollection](/developer/desktop-sdk/references/strategy/tradecollection)                                                     | A collection of **Trade** objects.                                                                                                                                                          |
| [TradesPerformanceValues](/developer/desktop-sdk/references/strategy/tradesperformancevalues)                                     | Performance values of a **collection** of **Trade** objects.                                                                                                                                |
| [WaitForOcoClosingBracket](/developer/desktop-sdk/references/strategy/waitforococlosingbracket)                                   | Determines if the strategy will submit both legs of an OCO bracket before submitting the pair to the broker.                                                                                |