Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Simple orderId question

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

    Simple orderId question

    Sorry to be so simple but sometimes I cannot see my own mistakes. I am trying to print to the output window the orderId. I have this line of code:
    Code:
    private string  	orderId = string.Empty;
    I have this line of code to make sure a second order does not interfere with the first:
    Code:
    if (orderId.Length == 0  &&  etc
    And all that works fine. What I can't seem to do is print the orderId to the output window. Reading the hellp screens and seeing other's code it appears simple enough but it is not working for me.

    I have tried both lines below, neither of which cause an error but neither of which "print"
    Code:
    Print (orderId.ToString());
    
    and
    
    Print (orderId);
    Do I need to retrieve the orderId first with a "GET" command?

    #2
    sarasotavince,

    When you are printing the orderId, has there been a value assigned to the variable?

    If not, you won't get anything printed out as the string is empty
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      I think you are right...nothing is assigned...So, oh Wise One, point me in the right direction...how do I assign orderId a value? Sample code is always helpful.

      Code:
      orderId = ////?? what ?? and where do I get it?
      I thought orderId was a NT filled reserved field/variable...but I guess not.

      In other words, what values are out there in NT after an order is submitted I can call?

      And, how does that change (if at all) when I submit a limited order and 2 bars later it is filled?

      The order is submitted but not filled, so is that orderId the same as when the limited order is filled?
      Last edited by sarasotavince; 10-08-2014, 10:48 AM.

      Comment


        #4
        sarasotavince,

        Are you trying to a particular ID for an order or using Atm Strategies?

        You would want to use GetAtmStrategyUniqueId(). This will create a random string text for you to use.
        http://www.ninjatrader.com/support/h...gyuniqueid.htm
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          Cal,

          My mistake. I should have explained... I used to use ATM strategies and such but now moving to everything be programmed manually, so to speak. So the GetATM... is what I use now, but want more freedom and flexibility... so now I am using:

          Code:
          myEntryOrderLong = EnterLongLimit(0,true,numberOfContracts,limitPriceLong,"Long");							SetProfitTarget(CalculationMode.Ticks,tradeProfitTarget);
          SetStopLoss(CalculationMode.Ticks, tradeStopLoss);
          and the likes..without the orderId and use thereof, I am having trouble canceling orders, making sure two orders do not happen at the same time, etc. As I am limited in my knowledge, I must have skipped a step about how to track an order once submitted. I am sorry but the help topics confuse me as they are generally incomplete and don't show enough examples to actually teach me when to use method A vs Method B. I have to do everything trail and error then make some assumptions based on what worked and what did not. I love to learn but for me C# is a slow process.

          So, can this line be used with my above code?

          Code:
          string orderId = GetAtmStrategyUniqueId();
          Or am I confusing ATM with preset ATMs already saved and called based on their names. When I used them, I simply numbered them, ATM1, ATM2, ATM3, up to 8... and depending on the profit and loss for the session, a different ATM# was used...but I had to keep changing the quantities and targets and stops on all the ATM# and re-saving and it was a good start but does not work for my futures plans...

          Comment


            #6
            sarasotavince,

            If you are wanting to track fills and such then you would want to use the OnOrderUpdate() for tracking your IOrder objects.

            Take a look at the following link for more information -
            http://www.ninjatrader.com/support/h...rderupdate.htm
            Cal H.NinjaTrader Customer Service

            Comment


              #7
              Unfortunately I have looked at that link and can't manage to get the script to do what I want. I think I'll come at this from a different angle and post/start another thread. Thanks nontheless.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by philmg, Today, 01:17 PM
              0 responses
              2 views
              0 likes
              Last Post philmg
              by philmg
               
              Started by cre8able, Today, 01:01 PM
              1 response
              4 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by manitshah915, Today, 12:59 PM
              1 response
              3 views
              0 likes
              Last Post NinjaTrader_Erick  
              Started by ursavent, Today, 12:54 PM
              1 response
              4 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by Mizzouman1, Today, 07:35 AM
              3 responses
              17 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Working...
              X