Managed Approach

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Strategy > Order Methods >

Managed Approach

Previous page Return to chapter overview Next page

Show/Hide Hidden Text

The Managed approach in NinjaScript is designed to offer the greatest ease of use for beginner to intermediate programmers. The order methods are wrapped in a convenience layer that allows you to focus on your system's trading rules, leaving the underlying mechanics of order management and the relationships between entry orders, exit orders, and positions to NinjaTrader. This approach is best suited for simple to moderate order complexity, and can be further broken down into a Basic/Common Managed approach and a more Advanced Managed approach. The following section will discuss the use of the Basic/Common approach.

 

A few key points to keep in mind:

 

Orders are submitted as live and working when a strategy is running in real-time

Profit target, stop loss and trail stop orders are submitted immediately when an entry order is filled, and are tied together via OCO (One Cancels Other)

Order changes and cancellations are queued in the event that the order is in a state where it can't be cancelled or modified

By default, orders submitted via Entry() and Exit() methods automatically cancel at the end of a bar if not re-submitted

Entry() methods will reverse the position automatically. For example if you are in a 1 contract long position and now call EnterShort() -> you will see 2 executions, one to close the prior long position and the other to get you into the desired 1 contract short position.

 

* Via the SetProfitTarget(), SetStopLoss(), SetTrailStop() and SetParabolicStop methods

 

tog_minus        Order submission for entry and exit methods - basic operation

tog_minus        Order Entry Methods

tog_minus        Quantity Type and TIF

tog_minus        How to close a position

tog_minus        Understanding core order objects

tog_minus        Internal Order Handling Rules that Reduce Unwanted Positions

 

 

 

Advanced Order Handling

Through advanced order handling you can submit, change and cancel orders at your discretion through any event-driven method within a strategy.

CancelOrder()

Cancels a specified order.

ChangeOrder()

Amends a specified Order.

EnterLong()

Generates a buy market order to enter a long position.

EnterLongLimit()

Generates a buy limit order to enter a long position.

EnterLongMIT()

Generates a buy MIT order to enter a long position.

EnterLongStopLimit()

Generates a buy stop limit order to enter a long position.

EnterLongStopMarket()

Generates a buy stop market order to enter a long position.

EnterShort()

Generates a sell short market order to enter a short position.

EnterShortLimit()

Generates a sell short stop limit order to enter a short position.

EnterShortMIT()

Generates a sell MIT order to enter a short position.

EnterShortStopLimit()

Generates a sell short stop limit order to enter a short position.

EnterShortStopMarket()

Generates a sell short stop order to enter a short position.

ExitLong()

Generates a sell market order to exit a long position.

ExitLongLimit()

Generates a sell limit order to exit a long position.

ExitLongMIT()

Generates a sell MIT order to exit a long position.

ExitLongStopLimit()

Generates a sell stop limit order to exit a long position.

ExitLongStopMarket()

Generates a sell stop market order to exit a long position.

ExitShort()

Generates a buy to cover market order to exit a short position.

ExitShortLimit()

Generates a buy to cover limit order to exit a short position.

ExitShortMIT()

Generates a buy to cover MIT order to exit a short position.

ExitShortStopLimit()

Generates a buy to cover stop limit order to exit a short position.

ExitShortStopMarket()

Generates a buy to cover stop market order to exit a short position.

GetRealtimeOrder()

Returns a matching real-time order object based on a specified historical order object reference.

SetParabolicStop()

Generates a parabolic type trail stop order with the signal name "Parabolic stop" to exit a position.

SetProfitTarget()

Generates a profit target order with the signal name "Profit target" to exit a position.

SetStopLoss()

Generates a stop loss order with the signal name "Stop loss" used to exit a position.

SetTrailStop()

Generates a trail stop order with the signal name "Trail stop" to exit a position.