StartAtmStrategy()

View as Markdown

Definition

StartAtmStrategy can be used to submit entry orders with ATM strategies.

Syntax

NinjaTrader.NinjaScript.AtmStrategy.StartAtmStrategy(AtmStrategy atmStrategyTemplate, Order entryOrder)

NinjaTrader.NinjaScript.AtmStrategy.StartAtmStrategy(string atmStrategyTemplateName, Order entryOrder)

Properties

PropertyDescription
atmStrategyTemplateAn AtmStrategy representing the ATM strategy you wish to use
atmStrategyTemplateNameA string representing the name of the ATM strategy you wish to use
entryOrderAn Order representing the entry order

Critical: The “name” argument on the CreateOrder() method MUST be named “Entry” for the ATM Strategy to be started successfully.

Examples

1// Example of starting an ATM strategy from an Add On window. The concept can be carried over
2// to any NinjaScript object you may be working on.
3public class MyAddOnTab : NTTabPage
4{
5 private Account account;
6 private Order entryOrder;
7
8 public MyAddOnTab()
9 {
10 // Find our Sim101 account
11 lock (Account.All)
12 account = Account.All.FirstOrDefault(a => a.Name == "Sim101");
13
14 if (account != null)
15 {
16 entryOrder = account.CreateOrder(Cbi.Instrument.GetInstrument("AAPL"), OrderAction.Buy, OrderType.Market,
17 TimeInForce.Day, 1, 0, 0, string.Empty, "Entry", null);
18
19 // Submits our entry order with the ATM strategy named "myAtmStrategyName"
20 NinjaTrader.NinjaScript.AtmStrategy.StartAtmStrategy("myAtmStrategyName", entryOrder);
21 }
22 }
23
24 // Other required NTTabPage members left out for demonstration purposes. Be sure to add them in your own code if building an Add On window.
25}