Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NTSample Strategy duplicating orders

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

    NTSample Strategy duplicating orders

    Dear Sir,

    Your strategy example "NTSample" is duplicating orders in NT. (sometimes orders are multiplied 3, 4 times when tradestation shows that only 1 order was placed and filled)
    Please could you tell me what the problem is?

    Thanks

    #2
    NTSample merely demonstrates usage of our DLL calls. Each time an order method is called, an order is placed.
    RayNinjaTrader Customer Service

    Comment


      #3
      Thank you for your reply.

      How do you prevent order duplication?

      Thanks

      Comment


        #4
        Only call the order method once.

        In conceptual code

        if (orderPlaced == false)
        {
        orderPlace = true;
        placeOrder();
        }
        RayNinjaTrader Customer Service

        Comment


          #5
          I am working in EasyLanguage.

          Is this the EL NT function that I should be using: NTOrderStatus, if not please explain how to do this in Easy Language.

          Please explain:

          1 ) If I should be using NTOrderStatus, then it requires a unique OrderId number to identified each trade.

          How do I


          1) create a unique id for each trade
          2) Refer to an ID that was previously created (how is the code to know which ID to check)

          Thanks

          Comment


            #6
            Unfortunately we do not provide support for basic programming. However, what you need to do is create a variable that you switch from false to true at the time you place your order. Then always check to make sure this variable is false before placing your order, if its true, then it means you have already placed your order.
            RayNinjaTrader Customer Service

            Comment


              #7
              This is what I have done and it makes no difference.
              I am concerned that even you sample code does not work the way it should. Anyone running it wil see the same thing. Have you tried?

              I should point out that it works the way it should in TradeStation. There is something very wrong with the way the trades get fired to Ninjatrader.

              Try it. Run it in tradestation. Say for example you will get 15 signals (buy/sell) when you look at what was placed in Ninjatrader you see that around 30 trades were placed!!!

              From a commercial / client relationship view point you should make sure that you sample code works. If NinjaTrader can't get it to work... that is not a good sign.

              Anyway this is what happens in debug.
              ==> place order flag is set to false therefore an order is sent to Ninjatrader. What is received in Ninjatrader at that point is not ONE trade but TWO and sometimes THREE trades that are duplicates of the initial trade.

              Any suggestions?

              Thanks

              Comment


                #8
                This sample has been with us for many years, yes its been tested and yes its been in use by many others before you. I am sorry but I can't help you with the flag example, this is basic programming for which we do not provide support for.
                RayNinjaTrader Customer Service

                Comment


                  #9
                  Not a problem at all. If that example is a case of "basic programming" then there is something really wrong and I put in my own flag to improve it and in debug the trade duplication occurs when the trade is fired, it's firing multiple times within the flag. This is such a basic problem that this situation should already be handled by your API. I was considering NinjaTrader for automation but I now realize that it is not suitable. I will look elsewhere. Thank you for your help and the opportunity to give it a test.

                  Comment


                    #10
                    There is nothing wrong with the API. If a function is called to place an order --> It will. If you call it multiple times then you will see multiple orders. This is not Easy Language, this is a DLL function that does what you ask it to do.

                    Thanks for giving it a try and sorry it does not work for you.
                    RayNinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by callan300 View Post
                      Not a problem at all. If that example is a case of "basic programming" then there is something really wrong and I put in my own flag to improve it and in debug the trade duplication occurs when the trade is fired, it's firing multiple times within the flag. This is such a basic problem that this situation should already be handled by your API. I was considering NinjaTrader for automation but I now realize that it is not suitable. I will look elsewhere. Thank you for your help and the opportunity to give it a test.
                      I have been running various automation strategies. If a function is called to place an order, it will place the order. If a function is called multiple times, it will place an order multiple times.

                      I'm 99.9999% positive it's your code, not their function, that needs troubleshooting.

                      Comment


                        #12
                        Control does not return to the calling statement or procedure right after order is sent to NT so that something -- if one chooses -- can be done about the "multiple time" issue.
                        I have moved on to something that works better.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by WHICKED, Today, 12:45 PM
                        2 responses
                        19 views
                        0 likes
                        Last Post WHICKED
                        by WHICKED
                         
                        Started by GussJ, 03-04-2020, 03:11 PM
                        15 responses
                        3,276 views
                        0 likes
                        Last Post xiinteractive  
                        Started by Tim-c, Today, 02:10 PM
                        1 response
                        8 views
                        0 likes
                        Last Post NinjaTrader_ChelseaB  
                        Started by Taddypole, Today, 02:47 PM
                        0 responses
                        5 views
                        0 likes
                        Last Post Taddypole  
                        Started by chbruno, 04-24-2024, 04:10 PM
                        4 responses
                        51 views
                        0 likes
                        Last Post chbruno
                        by chbruno
                         
                        Working...
                        X