NinjaScript > Language Reference > Strategy >

WaitForOcoClosingBracket

Print this Topic Previous pageReturn to chapter overview

Definition

There may be brokers who require that OCO orders are submitted simultaneously in a single API call vs sending them in sequence with an include user defined OCO identifier. For brokers that require OCO orders to be submitted in a single function call, a NinjaScript strategy must wait until it has both legs of the OCO pair generated by SetStopLoss(), SetTrailStop() and SetProfitTarget().

 

If you only wish to send a stop loss or profit target (but not both) via any of the Set...() methods mentioned above, when WaitForOcoClosingBracket is enabled, your exit orders will never be sent since NinjaTrader needs to wait until it has both orders of the OCO bracket. If you disable WaitForOcoClosingBracket, NinjaTrader will immediately submit a stop or profit target order, whichever is submitted first.

 

Current affected brokers:

 

TD AMERITRADE

 

* For any other broker, this property has no affect.

 

Property Value

This property returns true if the strategy will wait for both legs of an OCO bracket to be called in a strategy before submitting the order pair to the broker; otherwise, false.

 

Syntax

WaitForOcoClosingBracket

 

 

Examples

protected override void Initialize()
{
   WaitForOcoClosingBracket = false;
}