• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How can I call AtmStrategyClose from an Add On?

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

    How can I call AtmStrategyClose from an Add On?

    Hi,

    I am using NinjaTrader.NinjaScript.AtmStrategy.StartAtmStrate gy to start an ATM strategy from an AddOn.

    // Submits our entry order with the ATM strategy named "myAtmStrategyName"
    NinjaTrader.NinjaScript.AtmStrategy.StartAtmStrate gy("myAtmStrategyName", entryOrder);

    What is the equivalent to AtmStrategyClose(string atmStrategyId) that I can call from an AddOn to close my ATM?

    In other words, how can I close the position, hence the ATM strategy, from an add on?

    Thank you!
    jmneto

    #2
    Hello jmneto,

    In this case, this is not going to be similar to a NinjaScript strategy as you are submitting manual orders.

    If you want to close the position, you could use the Account object and its Positions collection to close the position that was opened. You can also use the Flatten method if you wanted to specify an instrument rather than using logic to pick the position.

    https://ninjatrader.com/support/help...ns_account.htm

    a simple example of closing the first located position:

    Code:
    account.Positions[0].Close();
    https://ninjatrader.com/support/help...us/flatten.htm


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by yrch1985, 11-03-2019, 11:49 AM
    8 responses
    95 views
    0 likes
    Last Post aligator  
    Started by Dr3am, Today, 05:10 PM
    0 responses
    2 views
    0 likes
    Last Post Dr3am
    by Dr3am
     
    Started by imalil, Today, 04:28 PM
    0 responses
    4 views
    0 likes
    Last Post imalil
    by imalil
     
    Started by bboyle1234, Today, 03:47 PM
    0 responses
    1 view
    0 likes
    Last Post bboyle1234  
    Started by caveat_lector, Today, 03:46 PM
    0 responses
    7 views
    0 likes
    Last Post caveat_lector  
    Working...
    X