NinjaScript > Language Reference > Strategy > ATM Strategy Methods >

AtmStrategyClose()

Print this Topic Previous pageReturn to chapter overviewNext page

Definition
Cancels any working orders and closes any open position of a strategy by first modifying any existing target orders so they are filled or submitting a market order if no target orders exist.

 

Method Return Value

Returns true if the specified ATM strategy was found; otherwise false. True in NO WAY indicates that the strategy in fact has been closed. It indicates that the the specified ATMstrategy was found and the internal close routine was triggered.

 

Syntax

AtmStrategyClose(string AtmStrategyId)

 

Parameters

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 (GetAtmStrategyUnrealizedProfitLoss("idValue") > 500)
         AtmStrategyClose("idValue");
}