Place Order

The PLACE command is the primary and most versatile method for submitting new orders to NinjaTrader 8. It serves as the foundation for all trade execution, from simple market orders to complex, multi-leg ATM Strategies.

Core Capabilities

The PLACE command can be used to:

  • Submit Standard Orders: Place fundamental order types like MARKET, LIMIT, STOPMARKET, and STOPLIMIT.

  • Initiate New ATM Strategies: Automatically trigger a pre-configured NinjaTrader ATM Strategy template upon the fill of an entry order.

  • Attach to Active ATM Strategies: Apply a new order to an existing, active ATM Strategy, allowing for advanced position management like scaling in.

  • Synchronize Strategy State: Use the sync_strategy feature to ensure orders are only placed when your external strategy's state is aligned with your broker position.


Key Concepts

Standard Orders

For a basic order, you must provide the core parameters: account, instrument, action, qty, order_type, and tif (Time in Force). For LIMIT or STOP orders, you must also provide the limit_price or stop_price respectively.

Using ATM Strategies

The PLACE command is also the entry point for leveraging NinjaTrader's powerful ATM (Advanced Trade Management) functionality.

1. Initiating a New ATM Strategy To have an order start a new ATM Strategy, provide the strategy parameter with the exact name of an ATM Strategy template saved in your NinjaTrader 8 workspace. When this entry order is filled, NinjaTrader will automatically submit the associated stop-loss and profit-target orders defined in that template.

2. Attaching to an Active ATM Strategy If you have an existing position managed by an ATM Strategy, you can place additional orders that are governed by that same strategy. To do this, provide the strategy_id of the active strategy instead of the strategy template name. This is commonly used for scaling into a position.

State Synchronization

For automated systems, preventing state drift between the signaling source and the broker is critical. The PLACE command can be enhanced with the sync_strategy=true parameter to perform a rigorous state check before execution. Learn more.

This advanced feature compares your strategy's expected position with the actual position in NinjaTrader, preventing erroneous trades. For a complete guide, see the Strategy Synchronization (sync_strategy) documentation.

Setting an Order ID

It is also possible to set an ID of the primary order (i.e., not an attached ATM strategy, stop loss, or take profit order) by providing an order_id field that can be referenced later via a change or cancel order command. Using order_id within a one-way system like webhook trading is very complex, so use of order IDs is considered advanced usage.


Example Payloads

This example message will trigger a simple market order for BUY or SELL actions on continuous contract instrument ES1! that will remain in-force for the rest of the trading day.

Buy or Sell Market Orders

key=your-secret-key;
command=PLACE;
account=sim101;
instrument=ES1!;
action=BUY;
qty=1;
order_type=MARKET;
tif=DAY;

Be aware that if you send a BUY order and then a SELL order using the same quantity, the sell order will offset the buy position. This scenario does not create a net short position.

Buy or Sell Limit Orders

key=your-secret-key;
command=PLACE;
account=sim101;
instrument=ES1!;
action=BUY;
qty=1;
order_type=LIMIT;
limit_price=4500;
tif=DAY;

Stop Market and Stop Limit Orders

key=your-secret-key;
command=PLACE;
account=sim101;
instrument=ES1!;
action=BUY;
qty=1;
order_type=STOPMARKET;
stop_price=4600;
tif=DAY;

You must use the stop_price command and not the limit_price command when submitting Stop Market or Stop Limit order types

Using ATM Strategy Templates

This payload will trigger a simple market order for BUY or SELL actions that will use an ATM strategy template and remain in-force for the rest of the trading day.

key=your-secret-key;
command=PLACE;
account=sim101;
instrument=ES1!;
action=BUY;
qty=1;
order_type=MARKET;
tif=DAY;
strategy=crosstrade;

Flatten Before Entry

If you want to close an existing position before opening a new position, there are 2 options. You can either include "flatten_first=true;" inside your message, or you can use the FLATPLACE command in lieu of PLACE.

Both options are available as convenience and achieve the same net effect of executing a CLOSEPOSITION command prior to the PLACE command.

Read more about Flatten First.

Read more about the FLATPLACE command.

Last updated