NinjaScript > Language Reference > Strategy > Order Methods > Unmanaged Approach >

SubmitOrder()

Print this Topic Previous pageReturn to chapter overviewNext page

Definition
Generates an Unmanaged order.

 

Method Return Value

An IOrder read-only object that represents the order. Reserved for experienced programmers, additional information can be found within the Unmanaged Approach section.

 

Syntax

SubmitOrder(int barsInProgressIndex, OrderAction orderAction, OrderType orderType, int quantity, double limitPrice, double stopPrice, string ocoId, string signalName)

 

 

Parameters

barsInProgressIndex

The index of the Bars object the order is to be submitted against. See the BarsInProgress property. This determines what instrument the order is submitted for.

orderAction

Possible values:
 
OrderAction.Buy

OrderAction.BuyToCover

OrderAction.Sell

OrderAction.SellShort

orderType

Possible values:

 

OrderType.Limit

OrderType.Market

OrderType.Stop

OrderType.StopLimit

quantity

Order quantity

limitPrice

Order limit price. Use "0" should this parameter be irrelevant for the OrderType being submitted.

stopPrice

Order stop price. Use "0" should this parameter be irrelevant for the OrderType being submitted.

ocoId

A string representing the OCO ID used to link OCO orders together

signalName

A string representing the name of the order. Max 50 characters.

 

 

Examples

private IOrder entryOrder = null;

 

protected override void OnBarUpdate()
{
    // Entry condition
    if (Close[0] > SMA(20)[0] && entryOrder == null)
         entryOrder = SubmitOrder(0, OrderAction.Buy, OrderType.Market, 1, 0, 0, "", "Enter Long");
}