Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

GetAtmStrategyMarketPosition returns MarketPosition.Flat if I manually cancel OCO

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    GetAtmStrategyMarketPosition returns MarketPosition.Flat if I manually cancel OCO

    Hello,

    I can handle an ATM position until I cancel manually either stop or limit orders.
    The position is still open but GetAtmStrategyMarketPosition(atmStrategyId) returns Flat, and I lose control of this atm strategy.
    Please advise.

    #2
    Hello frslvr,

    Thank you for your post.

    When you are in a position and are using an ATM Strategy to place a profit target/stop-loss and you manually cancel the profit target or stop-loss orders, you are effectively canceling the ATM Strategy. If the ATM Strategy does not exist then MarketPosition.Flat returns as seen in the Notes section of the GetAtmStrategyMarketPosition help guide linked below.

    Please note that GetAtmStrategyMarketPosition provides access to the current ATM strategy position, which should not be confused with the NinjaScript strategy position or account position.

    Here is the help guide about GetAtmStrategyMarketPosition for more information - https://ninjatrader.com/support/help...etposition.htm

    Please let us know if we may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Thank you for your answer, Brandon.

      Is it possible to close the open position (or all positions) on or after the ATM destroyed?

      Comment


        #4
        Hello frslvr,

        Thank you for your note.

        You could check if your account is not flat with PositionAccount by checking if (PositionAccount.MarketPosition == MarketPosition.Flat). Then check if the AtmStrategy has active target/stops that are unprotected by using GetAtmStrategyStopTargetOrderStatus("Stop1", idValue) to look for a stop order since an ATM strategy can be made without a Target but must include a Stop. If Stop1 does not exist, you could assume the Target/Stop is not active. Finally, use AddOn Framework to close the position if it is unprotected. To submit an order directly to the account, you could use CreateOrder to create an order and submit that order directly to the account by calling <Account>.Submit.

        Or, you could simply click the Close button in Chart Trader after you manually close the Profit Target/Stop-Loss.

        Please see the help guide links below for more information about using the AddOn approach.

        PositionAccount - https://ninjatrader.com/support/help...ionaccount.htm

        GetAtmStrategyStopTargetOrderStatus - https://ninjatrader.com/support/help...rgetorders.htm

        Submit - https://ninjatrader.com/support/help...nt8/submit.htm

        Let us know if we may assist further.
        Brandon H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by michaelsh, Today, 04:28 PM
        0 responses
        4 views
        0 likes
        Last Post michaelsh  
        Started by Bmatarese, Today, 03:13 PM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Started by sdauteuil, Today, 12:32 PM
        4 responses
        17 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Gaterz, 09-27-2020, 05:52 PM
        10 responses
        51 views
        0 likes
        Last Post tcea9
        by tcea9
         
        Started by derivtrader, Today, 12:04 PM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Spencer  
        Working...
        X