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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        66 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        149 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        99 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        286 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X