Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OrderID and StrategyID

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

    OrderID and StrategyID

    I'm trying to create a strategy that uses the ATM.

    I've gone over the sample ATM strategy and part of it work fine for me.

    One issue I have is executing an exit order or close position order.

    When I try to exit using the command:
    AtmStrategyClose(orderId);

    I get an error saying:
    AtmStrategyId '*** Some random order number ***' does not exist

    I've followed the steps in the sample strategy but can't seem to get the correct orderid information.

    I noticed that the orderid that is captured when an order fills is not the same as the order id on the control center orders tab. Should those numbers match either the ID or Token or Strategy ID?

    Seems as if I'm not getting the correct id information when the order executes.

    I'm using: orderId = GetAtmStrategyUniqueId(); as the method of assigning the value.
    Is this incorrect?

    Thanks

    #2
    DavidHP, you want to use the same orderID that you assigned to the AtmStrategyCreate() to close it, otherwise you do not refer to the correct specific strategy instance created, as such you should not use a new unique ID for each call (Create() & Close()).

    Just progress as per the sample and assign a unique value to a variable upon triggering of the entry. Then refer to this variable value again as you try to close it, then the orderID should be valid.

    Comment


      #3
      Can you give an example of what the order id is for this?
      AtmStrategyCreate(Cbi.OrderAction.Buy, OrderType.Market, 0, 0, TimeInForce.Day, orderId, "AtmStrategyTemplate", atmStrategyId);

      And exactly how it would be inserted into the parenthesis of AtmStrategyClose ();

      Comment


        #4
        Hello brucelevy,

        Thank you for your post.

        The orderId is "orderId", but you pass the atmStrategyId to AtmStrategyClose(). Please review the information on AtmStrategyClose() at the following link: http://www.ninjatrader.com/support/h...ategyclose.htm

        Comment

        Latest Posts

        Collapse

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