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

Email for order pending/fill/target/stop

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

    #16
    This is a basic C# concept. The sample is correct because it is only doing one line of code for the if-statement. If you want to do multiple lines of code you need to use brackets.

    Code:
    if (...)
    {
        _____;
        _____;
    }
    Josh P.NinjaTrader Customer Service

    Comment


      #17
      Originally posted by NinjaTrader_Josh View Post
      This is a basic C# concept. The sample is correct because it is only doing one line of code for the if-statement. If you want to do multiple lines of code you need to use brackets.

      Code:
      if (...)
      {
          _____;
          _____;
      }

      Over and over again, Josh thx.

      Comment


        #18
        Originally posted by NinjaTrader_Bertrand View Post
        You would need to work with IOrder objects for this, here's a sample demonstrating this - http://www.ninjatrader-support2.com/...ead.php?t=7499

        I don't see anything in there that looks for Target1 or Stop1...

        Comment


          #19
          To clarify, OnOrderUpdate() is not for ATM managed orders.
          Josh P.NinjaTrader Customer Service

          Comment


            #20
            Originally posted by NinjaTrader_Josh View Post
            To clarify, OnOrderUpdate() is not for ATM managed orders.

            Then it appears to be GetAtmStrategyStopTargetOrderStatus().

            Comment


              #21
              Correct. That will be the method.
              Josh P.NinjaTrader Customer Service

              Comment


                #22
                Originally posted by NinjaTrader_Josh View Post
                Correct. That will be the method.

                Just trying to print to the output window but it doesn't work:

                // Print out some information about the target to the output window
                string[,] orders = GetAtmStrategyStopTargetOrderStatus("TARGET1", "idValue");

                // Check length to ensure that returned array holds order information
                if (orders.Length > 0)
                {
                for (int i = 0; i < orders.GetLength(0) - 1; i++)
                {
                Print("Average fill price is " + orders[i, 0].ToString());
                Print("Filled amount is " + orders[i, 1].ToString());
                Print("Current state is " + orders[i, 2].ToString());
                }
                }

                Comment


                  #23
                  idValue is likely your variable and not the actual string you are trying to pass in. Same issue as you had before.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #24
                    Originally posted by NinjaTrader_Josh View Post
                    idValue is likely your variable and not the actual string you are trying to pass in. Same issue as you had before.

                    I do have this:

                    private string idValue = string.Empty;

                    I'm not sure why it isn't working.

                    Comment


                      #25
                      Same reason as the error before. You are using quotes when you should just be calling the variable directly.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #26
                        Originally posted by NinjaTrader_Josh View Post
                        Same reason as the error before. You are using quotes when you should just be calling the variable directly.
                        Removed the quotes and still does not work.

                        Comment


                          #27
                          Changed it similar structure to the GetAtmStrategyEntryOrderStatus in the SampleAtmStrat:

                          // Check for a pending entry order
                          if (atmStrategyId.Length > 0)
                          {
                          string[,] orders = GetAtmStrategyStopTargetOrderStatus("Target1", atmStrategyId);

                          // Check length to ensure that returned array holds order information
                          if (orders.Length > 0)
                          {
                          for (int i = 0; i < orders.GetLength(0) - 1; i++)
                          {
                          Print("Average fill price is " + orders[i, 0].ToString());
                          Print("Filled amount is " + orders[i, 1].ToString());
                          Print("Current state is " + orders[i, 2].ToString());
                          SendMail("[email protected]", "[email protected]", "status", orders[i, 2].ToString());
                          }
                          }
                          }

                          In the log highlighted in yellow it says:

                          GetAtmStrategyStopTargetOrderStatus() method error: OrderName 'Target1' does not exist

                          I assumed since my ATM Strategy that is called has 2 targets it would automatically have Target1/Target2/Stop1/Stop2.

                          Comment


                            #28
                            Please try
                            Code:
                            string[,] orders = GetAtmStrategyStopTargetOrderStatus("TARGET1", atmStrategyId);
                            BertrandNinjaTrader Customer Service

                            Comment


                              #29
                              Originally posted by NinjaTrader_Bertrand View Post
                              Please try
                              Code:
                              string[,] orders = GetAtmStrategyStopTargetOrderStatus("TARGET1", atmStrategyId);
                              That is what is already in place, see above post.

                              Comment


                                #30
                                Please try with all caps. "TARGET1"
                                Josh P.NinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by geotrades1, Today, 10:02 AM
                                1 response
                                4 views
                                0 likes
                                Last Post NinjaTrader_BrandonH  
                                Started by ender_wiggum, Today, 09:50 AM
                                1 response
                                5 views
                                0 likes
                                Last Post NinjaTrader_Gaby  
                                Started by rajendrasubedi2023, Today, 09:50 AM
                                1 response
                                12 views
                                0 likes
                                Last Post NinjaTrader_BrandonH  
                                Started by bmartz, Today, 09:30 AM
                                1 response
                                9 views
                                0 likes
                                Last Post NinjaTrader_Erick  
                                Started by geddyisodin, Today, 05:20 AM
                                3 responses
                                26 views
                                0 likes
                                Last Post NinjaTrader_Gaby  
                                Working...
                                X