• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Managing Stop Orders via Tradestation

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

    Managing Stop Orders via Tradestation

    Hello, please let me know if I am on the proper path. I'm going to be sending stop orders into Ninja via Tradestation. In the past I have sent MarketOrders without a problem.

    A general question about OrderID. While OrderID needs to be unique, Will there be problems running the code..

    Value1=NTCancel("L");
    Value1=NTBuyStop("L",x,y);

    Let's say 30minutes later the buy stop is elected at y.. I then place the sell stop with..

    Value1=NTCancel("L");
    Value1=NTSellStop("L",A,B);

    Where "L" is always the OrderID, represnting the Long side of the strategy, but there is only 1 Stop Order with the ID of "L" active at a time?

    TIA. AJNIN

    #2
    Could be a problem --> Always use a unique ID for each new order.
    RayNinjaTrader Customer Service

    Comment


      #3
      Thanks Ray, OK, I will iterate a number in the OrderID, so it will always be different. A follow up Q.

      Let's say my current OrderID as L12 and my previous OrderID as L11. As I only want to have 1 stop order active, I always want to cancel my previous stop, so in this case OrderID L11. Can I simply write the code

      Value1=NTCancel("L11");
      Value1=NTBuyStop("L12",x,y);

      If L11 has been filled, me trying to cancel the order will not cause any problems, will it? Or is it best served to see if L11 exists and if so, then cancel it.

      If I should check to see if the OrderID exists, can you please gve the the exact code to do so.


      TIA. Ajnin

      Comment


        #4
        There is no consequence if you cancel a stop that is filled. You can check out NTOrders() for a list of id's uses during the session.

        Why do you want to cancel a submit a new stop order? Why not just change the price of the original order?
        RayNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Ray View Post

          Why do you want to cancel a submit a new stop order? Why not just change the price of the original order?
          The stops won't be updating the price. The cycle for the orders will be the Entry Stop is hit, then I will have the code place the exit Stop, so it will go from a Buy Stop to a Sell Stop. Incase TradeStation needs to refresh the chart mid session, I want to enure that I am not placing a dup order, hence the cancel.

          I would perfer not to lose order book priority by cancelling the existing stop, just to place the same stop again, but I haven't been able to figure out a robust way of checking the stop Price and quantity of the order i'm about to place is the same as the order I'm going to cancel. Any thoughts on that??

          Also, what if the order price that is generated in TS is not exactly the price that the market trades in? Say Crude oil, let's say the price that is generated in TS is 115.123, do I need to round this price to the exchange traded tick? Or will Ninja handle that going in?

          Thanks. Ajnin

          Comment


            #6
            I believe NT will round the price, you can test this by sending orders to the Sim101 account. You could self manage the fact that you have submitted an order already by using some variables etc..
            RayNinjaTrader Customer Service

            Comment


              #7
              Thanks Ray, you are the best in service! Just for future info, If I wanted to change Price and/or Quantity, I would simply call NTChange using the existing Order's OrderID?

              Do you know if any change other then Quantity going down, will keep the orderbook priority in the queue?

              Thanks.

              Comment


                #8
                Yes, NTChange(), any change will ultimatley result in your order at the back of the line.
                RayNinjaTrader Customer Service

                Comment


                  #9
                  Thanks, I just want to confirm the uniqueness of the OrderID, The Benefits of it being unique is based upon the Account which it resides. If I have 3 different accounts, they can all have an OrderID of "LongEntry1" and not be an issue. Is that correct? The issue is when an account tries to consume the same OrderID.

                  TIA. AJNIN

                  Comment


                    #10
                    Yes, likely the case however, just always use a unique id.
                    RayNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by MARTIN MARTIN, Today, 01:01 PM
                    0 responses
                    4 views
                    0 likes
                    Last Post MARTIN MARTIN  
                    Started by bouncetherubble, Today, 10:21 AM
                    2 responses
                    10 views
                    1 like
                    Last Post bouncetherubble  
                    Started by tcbarrow, Today, 10:53 AM
                    1 response
                    11 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by dmking, Today, 11:31 AM
                    2 responses
                    15 views
                    0 likes
                    Last Post dmking
                    by dmking
                     
                    Started by TazoTodua, Yesterday, 03:01 PM
                    4 responses
                    27 views
                    0 likes
                    Last Post koganam
                    by koganam
                     
                    Working...
                    X