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

Submitted State

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

    Submitted State

    Hi Team

    I'm working to cancel orders in the submitted state. I'm testing the cancelation with a Rithmic connection and with a CQG connection. I don't get the same results. Using an ATM with the Rithmic connection and with a live account all orders are canceled but with CQG the open position is filled and not canceled. Why the behaviors are different if I use the same code? I need to have any special consideration for CQG connections, orders, or accounts?

    Thank you

    #2
    Hello Protech,

    Thank you for the post.

    You will likely need to use some logic based on the connection if you are seeing a difference here with that order state. Submitted state is generally not used for any type of order management as that is only just submitted to the broker, it is unknown if that order is valid at that point or can be cancelled. Once the broker has accepted the order and moved it into working would generally be where you can make changes to orders. It is possible to see rejections for orders after submitted based on what the broker provides back so that may or may not be a good state to accomplish your task depending on the situation.
    One note here is that not all brokers behave identically, Rithmic is one of the brokers which does have some different stipulations surrounding how it works in code. You can find a note about that in the OnExecutionUpdate page: https://ninjatrader.com/support/help...lightsub=onexe



    Please let me know if I may be of additional assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi NinjaTrader_Jesse

      Thank you for your answer and guide to my question. I will go through your suggestion and try to see if I can solve this.

      Comment


        #4
        Hi NinjaTrader_Jesse

        Finally, I'm using the state Initiated to cancel orders based on a specific condition. Seems that is working well with any type of connection. But I get a new "problem". If I use any type of order without an ATM Strategy the cancelation is fine, no problems at all. If I use an ATM Strategy I get phantom orders and the orders remain like Cancel Pending and the Strategy remains active.
        Which is the best way to cancel orders with an ATM selected? Can they be canceled in a specific State? In the code I'm not taking into consideration if I have an ATM active, only I cancel orders in the Initiated State. I'm working with an Add-on and trying to react to orders placed with NinjaTrader.

        Do I need to have into consideration If an ATM is selected when I launch the order to cancel it? and if yes, Wich is the best steps to cancel these orders?
        Any help in this direction will be appreciated and very closely to get What I need. Only with this new "problem" that I don't know how to solve these phantom orders. I attached an image with the phantom orders at the DOM using a selected ATM.


        Click image for larger version

Name:	2020-11-11_18h02_10.png
Views:	396
Size:	94.7 KB
ID:	1127132

        Comment


          #5
          Hello Protech,

          I am not certain I follow what you are trying to do here, Initialized is an earlier state than what you were trying, that may not work. Have you tried what you are doing in a later state such as Working?

          Are you trying to prevent an order from being submitted at all? If so we have no suggestions on how to block orders, you would need to just not submit the order to begin with if you didn't intend for that to be an active order. Preventing orders from an addon is something we suggest to avoid as that could lead to problems in case you need to manage the account.


          Please let me know if I may be of additional assistance.
          JesseNinjaTrader Customer Service

          Comment


            #6
            Hi NinjaTrader_Jesse

            Yes, I know is an earlier state, but is working perfectly for any connection and without ATM Strategies. I want to prevent an order from being submitted at all, identical to what NinjaTrader has in the accounts Tab, on edit account, related to max position size, for example. If you excide the number of contracts, ninjatrader prevent to submit the order. I'm trying to do the same. In the initiate state seems I get the same behavior but the ATM is not working.

            Any idea how can do the same as in the max position size from NinjaTrader?

            Comment


              #7
              Hello Protech,

              The internal ways to prevent orders would prevent them before being submitted to the simulator, it moves straight to rejected and does not proceed through the normal states. The way you are trying to cancel the order is already too late in processing to replicate that. You would need to have prevented the entry button from being pressed at all instead of trying to intercept the order while being submitted. I would have no specific suggestions here, you can try to get this working however cancelling orders that early on may not work in all cases or may have unintended side effects depending on the order type being submitted (atm).

              Please let me know if I may be of further assistance.
              JesseNinjaTrader Customer Service

              Comment


                #8
                Hi NinjaTrader_Jesse

                Ok, Thank you for let me know how is working the internal way. I will follow your suggestion and I will go to prevent the entry button from being pressed at all. Is the best way to do what I need.
                Great team and with fast answers, thank you so much!!!

                Comment


                  #9
                  Hello Protech,

                  I just wanted to quickly reply to make it clear for anyone that stumbles on this post that we do not suggest blocking entry buttons or preventing entries in this way. You can certainly try to do that if you really want to but please be aware of what you are doing as you could end up preventing yourself from managing the account in an emergency situation. If you intend to do this please ensure you have your brokers order desk number handy in case of an emergency.

                  Please let me know if I may be of further assistance.
                  JesseNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by kujista, Today, 05:44 AM
                  0 responses
                  6 views
                  0 likes
                  Last Post kujista
                  by kujista
                   
                  Started by ZenCortexCLICK, Today, 04:58 AM
                  0 responses
                  8 views
                  0 likes
                  Last Post ZenCortexCLICK  
                  Started by sidlercom80, 10-28-2023, 08:49 AM
                  172 responses
                  2,281 views
                  0 likes
                  Last Post sidlercom80  
                  Started by Irukandji, Yesterday, 02:53 AM
                  2 responses
                  18 views
                  0 likes
                  Last Post Irukandji  
                  Started by adeelshahzad, Today, 03:54 AM
                  0 responses
                  10 views
                  0 likes
                  Last Post adeelshahzad  
                  Working...
                  X