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

# AtmStrategyCreate()

## Definition

Submits an entry order that will execute a specified ATM Strategy.

Please review the section on using [ATM Strategies](/developer/desktop-sdk/guides/educational-resources/using-atm-strategies). This method is NOT backtestable and will NOT execute on historical data. See the [AtmStrategyCancelEntryOrder()](/developer/desktop-sdk/references/strategy/atm-strategy-methods/atmstrategycancelentryorder) to cancel an entry order. See the [AtmStrategyChangeEntryOrder()](/developer/desktop-sdk/references/strategy/atm-strategy-methods/atmstrategychangeentryorder) to change the price of the entry order. The ATM Strategy will be created asyncronous on the hosting NinjaScripts UI Thread, a callback is provided solely to check when the ATM Strategy is started on that thread - accessing for example price data in that outside OnBarUpdate() context is not possible. Please see the SampleATMStrategy build into NinjaTrader for example usage.

## Method Return Value

This method does not return a value

## Syntax

`AtmStrategyCreate(OrderAction action, OrderType orderType, double limitPrice, double stopPrice, TimeInForce timeInForce, string orderId, string strategyTemplateName, string atmStrategyId, Action\<ErrorCode, string\> callback)`

## Parameters

| Parameter            | Description                                                                                                                                              |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action               | Sets if the entry order is a buy or sell order. Possible values are: OrderAction.Buy, OrderAction.Sell                                                   |
| orderType            | Sets the order type of the entry order. Possible values are: OrderType.Limit, OrderType.Market, OrderType.MIT, OrderType.StopMarket, OrderType.StopLimit |
| limitPrice           | The limit price of the order                                                                                                                             |
| stopPrice            | The stop price of the order                                                                                                                              |
| timeInForce          | Sets the time in force of the entry order. Possible values are: TimeInForce.Day, TimeInForce.Gtc                                                         |
| orderId              | The unique identifier for the entry order                                                                                                                |
| strategyTemplateName | Specifies which strategy template will be used                                                                                                           |
| atmStrategyId        | The unique identifier for the ATM strategy                                                                                                               |
| callback             | The callback action is used to check that the ATM Strategy is successfully started                                                                       |

Tip: Unlike NinjaScript Strategy orders (both [managed](/developer/desktop-sdk/references/strategy/order-methods/managed-approach) and [unmanaged](/developer/desktop-sdk/references/strategy/order-methods/unmanaged-approach)), ATM strategies generated by the AtmStrategyCreate() method can then be managed manually by any order entry window such as the SuperDOM or within your NinjaScript strategy.

## Examples

```csharp
private string atmStrategyId;
private string atmStrategyOrderId;
private bool   isAtmStrategyCreated = false;

protected override void OnBarUpdate()
{
   if (State < State.Realtime)
       return;

   if (Close[0] > SMA(20)[0])
   {
       atmStrategyId = GetAtmStrategyUniqueId();
       atmStrategyOrderId = GetAtmStrategyUniqueId();

       AtmStrategyCreate(OrderAction.Buy, OrderType.Market, 0, 0, TimeInForce.Day,
           atmStrategyOrderId, "MyTemplate", atmStrategyId, (atmCallbackErrorCode, atmCallbackId) => {

           // checks that the call back is returned for the current atmStrategyId stored
           if (atmCallbackId == atmStrategyId)
           {
               // check the atm call back for any error codes
               if (atmCallbackErrorCode == ErrorCode.NoError)
               {
                   // if no error, set private bool to true to indicate the atm strategy is created
                   isAtmStrategyCreated = true;
               }
           }
       });
   }

   if(isAtmStrategyCreated)
   {
       // atm logic
   }

   else if(!isAtmStrategyCreated)
   {
       // custom handling for a failed atm Strategy
   }
}
```