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

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.
    BertrandNinjaTrader Customer Service

    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 rocketman7, Today, 01:00 AM
        0 responses
        1 view
        0 likes
        Last Post rocketman7  
        Started by wzgy0920, 04-20-2024, 06:09 PM
        2 responses
        27 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 02-22-2024, 01:11 AM
        5 responses
        32 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 04-23-2024, 09:53 PM
        2 responses
        74 views
        0 likes
        Last Post wzgy0920  
        Started by Kensonprib, 04-28-2021, 10:11 AM
        5 responses
        193 views
        0 likes
        Last Post Hasadafa  
        Working...
        X