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

Canceling on close in multi-instrument strategy

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

    #16
    heech,

    Running your strategy your logic clearly doesn't even trigger.

    Code:
    if (!Historical && (hogStop != null))
                        {
                            Print("CANCEL ORDER");
                            CancelOrder(hogStop);    
                        }
    Add yourself that Print line. It never prints. I cannot assist you in debugging. You will need to do that yourself.
    Josh P.NinjaTrader Customer Service

    Comment


      #17
      Josh,

      Not trying to give you a hard time. I look at other people's code all day long too, both good and bad, so I'm not saying its trivial. But as I said, this code is pretty close to the simplest I could make it.

      To be perfectly candid, I can (and already have) work around this bug. It doesn't affect me heavily. I put in the time to build the sample to help you guys diagnose the issue, primarily as a courtesy to you (and partly because having clean/correct software is good for for me too). So, hope you guys can put it to good use and fix what's clearly a bug in the software.

      I will take your advice to attach files rather than pasting code directly.
      Attached Files

      Comment


        #18
        Originally posted by NinjaTrader_Josh View Post
        heech,

        Running your strategy your logic clearly doesn't even trigger.

        Code:
        if (!Historical && (hogStop != null))
                            {
                                Print("CANCEL ORDER");
                                CancelOrder(hogStop);    
                            }
        Add yourself that Print line. It never prints. I cannot assist you in debugging. You will need to do that yourself.
        Josh,

        That needs to be running !Historical. Are you sure you're not looking just at historical dump? You need to wait for the next live bar to come in (which would mean the next 30 minute mark, if you're using my code unmodified).

        Comment


          #19
          Heech,

          I have modified your code to use 5 seconds for both series. These are the only prints I get

          12/3/2008 7:51:00 AM Entered internal PlaceOrder() method at 12/3/2008 7:51:00 AM: Action=Buy OrderType=Market Quantity=100 LimitPrice=0 StopPrice=0 SignalName='enterhog' FromEntrySignal=''
          12/3/2008 7:51:05 AM Entered internal PlaceOrder() method at 12/3/2008 7:51:05 AM: Action=Sell OrderType=Stop Quantity=100 LimitPrice=0 StopPrice=12.00 SignalName='exithog' FromEntrySignal='enterhog'
          12/3/2008 7:51:05 AM Entered internal PlaceOrder() method at 12/3/2008 7:51:05 AM: Action=Buy OrderType=Market Quantity=100 LimitPrice=0 StopPrice=0 SignalName='enterlnc' FromEntrySignal=''
          12/3/2008 7:51:10 AM Entered internal PlaceOrder() method at 12/3/2008 7:51:10 AM: Action=Sell OrderType=Stop Quantity=100 LimitPrice=0 StopPrice=10.00 SignalName='exitlnc' FromEntrySignal='enterlnc'

          And after that is just a bunch of prints confirming the various BIP1 and 2 being updated. No CancelOrder() is ever sent.
          Josh P.NinjaTrader Customer Service

          Comment


            #20
            Originally posted by NinjaTrader_Josh View Post
            heech,

            Running your strategy your logic clearly doesn't even trigger.
            By the way, if you don't want to wait for 30 minutes... (no idea what happens at second-scale)...

            Run my code unmodified, make sure you have "cancel orders when strategy exits" enabled. Check that the stop orders are established, and then exit the strategy.

            Comment


              #21
              heech,

              Okay. There are too many specifications running around now. Please give me a final definitive list as to all the settings you want to reproduce your scenario. I am going to continue to maintain my additional prints for debugging purposes.
              Josh P.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by rbeckmann05, Yesterday, 06:48 PM
              1 response
              12 views
              0 likes
              Last Post bltdavid  
              Started by llanqui, Today, 03:53 AM
              0 responses
              6 views
              0 likes
              Last Post llanqui
              by llanqui
               
              Started by burtoninlondon, Today, 12:38 AM
              0 responses
              10 views
              0 likes
              Last Post burtoninlondon  
              Started by AaronKoRn, Yesterday, 09:49 PM
              0 responses
              15 views
              0 likes
              Last Post AaronKoRn  
              Started by carnitron, Yesterday, 08:42 PM
              0 responses
              11 views
              0 likes
              Last Post carnitron  
              Working...
              X