NinjaScript > Language Reference > Strategy > ATM Strategy Methods >

AtmStrategyCreate()

Print this Topic Previous pageReturn to chapter overviewNext page

Definition
Submits an entry order that will execute the specified ATM Strategy that can then be managed manually by any order entry window such as the SuperDOM or within your NinjaScript strategy.

 

Please review the section on using ATM Strategies
This method is not backtestable and will not execute on historical data
Executions resulting from the ATM Strategy will not be plotted on the chart
See the AtmStrategyCancelEntryOrder() to cancel an entry order
See the AtmStrategyChangeEntryOrder() to change the price of the entry order

 

Method Return Value

Returns true if the specified ATM strategy was created and no errors were generated.

 

Syntax

AtmStrategyCreate(OrderAction action, OrderType orderType, double limitPrice, double stopPrice, TimeInForce timeInForce, string orderId, string strategyTemplateName, string AtmStrategyId)

 

Parameters

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

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

 

 

Examples

protected override void OnBarUpdate()
{
    if (Historical)
         return;
 
    // Check for valid condition and create an ATM Strategy
    if (Close[0] > SMA(20)[0])
         AtmStrategyCreate(OrderAction.Buy, OrderType.Market, 0, 0,
            TimeInForce.Day, GetAtmStrategyUniqueId(), "MyTemplate",
            GetAtmStrategyUniqueId());
 
}