Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.



    a simple example of closing the first located position:

    Code:
    account.Positions[0].Close();



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

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by rocketman7, Today, 01:00 AM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by wzgy0920, 04-23-2024, 09:53 PM
    3 responses
    76 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by JonesJoker, 04-22-2024, 12:23 PM
    9 responses
    46 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by timko, Today, 06:45 AM
    1 response
    7 views
    0 likes
    Last Post gaz0001
    by gaz0001
     
    Started by Waxavi, 04-19-2024, 02:10 AM
    3 responses
    41 views
    0 likes
    Last Post gaz0001
    by gaz0001
     
    Working...
    X