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

Cancelling an order without an incoming tick

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

    Cancelling an order without an incoming tick

    Hi,
    I have a client who wishes to place trades using limit orders on stocks so thin that often no ticks come in for long periodsl.
    I have implemented a timer system so that the strategy triggers at regular intervals and can place an order when desired.
    This works fine.
    However when that entry order needs to be cancelled (entry criteria is no longer valid) sending a cancel request for that order does nothing.
    e.g.
    CancelOrder(entryOrder)

    A tick coming in will finally motivate NT8 to cancel the order.

    Is there some way around this? How can I poke NT8 in the ribs in the right way to get it to cancel an order without a tick from the market?

    Thanks,
    saltminer

    #2
    Great question. I have no idea. I wonder if this worked in NT7.

    Might have to post who you are connected to - it might be at the adapter level?

    Comment


      #3
      Hello saltminer and sledge,

      After testing this on GC 02-18, I am able to cancel my orders with a timer before an additional tick is received.

      I may suggest checking to make sure the timer is actually firing. I've attached a test script that I used if you would like to test on your end and review the code.

      Please let me know if this does not resolve your inquiry.
      Attached Files
      Last edited by NinjaTrader_Jim; 01-16-2018, 03:50 PM.
      JimNinjaTrader Customer Service

      Comment


        #4
        Hi Jim,
        thanks so much for building that. It closely resembled my own code, and for a good while I couldn't figure out what was different. I realised at last that I had to use the EnterLongLimit with the signature that includes BarsArray and GoodTilCancelled in it, e.g. EnterLongLimit(0,true,price,name)
        It then worked as expected.

        By the way, I had used a DispatcherTimer in my code, while you used the ye olde Forms.Timer.
        I see conflicting advice about these two in various posts on the forum. Can I get a 2018 update on exactly which is the recommended timer for NT8 WPF?

        Thanks again,
        saltminer

        Comment


          #5
          Hello saltminer,

          I'm glad you got it sorted on your end.

          Both timers would be valid for use, however the WPF DispatcherTimer would be a more robust/powerful timer to use than the WinForms timer.
          JimNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by techgetgame, Yesterday, 11:42 PM
          0 responses
          8 views
          0 likes
          Last Post techgetgame  
          Started by sephichapdson, Yesterday, 11:36 PM
          0 responses
          2 views
          0 likes
          Last Post sephichapdson  
          Started by bortz, 11-06-2023, 08:04 AM
          47 responses
          1,615 views
          0 likes
          Last Post aligator  
          Started by jaybedreamin, Yesterday, 05:56 PM
          0 responses
          10 views
          0 likes
          Last Post jaybedreamin  
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          20 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Working...
          X