Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Preventing multiple ATM submits

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

    Preventing multiple ATM submits

    Hello,

    I'm developing a strategy which submits ATM orders. I wish to prevent submitting multiple orders in the same direction so I've used the following code:

    Code:
    if(Position.MarketPosition != MarketPosition.Long)AtmStrategyCreate(OrderAction.Buy, OrderType.Market,0,0,TimeInForce.Day, GetAtmStrategyUniqueId(),"MyTemplate",GetAtmStrategyUniqueId());
    However, I still get multiple orders even if already long. Anything obvious I'm doing incorrectly?

    #2
    Hi coolmoss,

    Once you have started using the ATM strategy methods, you will have to continue using those as this is now handled by NinjaTrader's backend and not by your strategy. (In other words, the strategy's position will not be updated anymore).

    Below is a link to the help guide on GetAtmStrategyMarketPosition().
    http://www.ninjatrader.com/support/h...etposition.htm
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you Chelsea for the super fast reply. It's been awhile since I worked with this type of strategy and totally forgot about this! Thanks!

      Comment


        #4
        Still submitting multiple orders in same direction. Here is new code I'm employing:

        Code:
        if(GetAtmStrategyMarketPosition("id") != MarketPosition.Long)AtmStrategyCreate(OrderAction.Buy, OrderType.Market,0,0,TimeInForce.Day, GetAtmStrategyUniqueId(),"MyTemplate",GetAtmStrategyUniqueId());

        Comment


          #5
          Hi coolmoss,

          Is your ATM strategy created with the id "id"?

          If you print the value of GetAtmStrategyMarketPosition("id") what is the value that prints?
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Chelsea,

            I can't figure out from the documentation how "id" works. Is the "id" the same as the template name? Otherwise, I don't know how the id is set or created. In the strategy create, there doesn't seem to be a way to set it, I'm just using the snippet shown in the documentation where the id is set to GetAtmStrategyUniqueId().

            Really, I don't understand how this works so I'm probably confusing you with how I'm describing it.
            Last edited by coolmoss; 07-11-2014, 09:31 AM.

            Comment


              #7
              Hi coolmoss,

              Yes, the GetAtmStrategyUniqueId() will create a unique id that you should use to create the ATM strategy.

              By saving this to a variable you can find out the status by using the generated ID.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_ChelseaB View Post
                Hi coolmoss,

                Yes, the GetAtmStrategyUniqueId() will create a unique id that you should use to create the ATM strategy.

                By saving this to a variable you can find out the status by using the generated ID.
                Thank you Chelsea. I've already done some experimenting with trying to get this work, with no success yet. I've looked at the help doc's and can't find a specific example of how to do this. Might you be able to direct me to an example ATM strategy that demonstrates how this should be coded?

                I appreciate your attentiveness

                Comment


                  #9
                  Hi coolmoss,

                  There is a sample included with NinjaTrader.

                  To view the code of this sample:
                  • Click Tools -> Edit NinjaScript -> Strategy....
                  • Select SampleAtmStrategy -> click OK
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  647 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  368 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  108 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  571 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  573 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X