• 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 aligator, Today, 10:11 PM
    0 responses
    1 view
    0 likes
    Last Post aligator  
    Started by psquare, Today, 03:11 PM
    4 responses
    18 views
    0 likes
    Last Post psquare
    by psquare
     
    Started by ballboy11, Today, 03:20 PM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by tonynt, Today, 02:18 PM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_JoshG  
    Started by denalek2419, Today, 01:46 PM
    3 responses
    12 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Working...
    X