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

Cancel order at a specific time

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

    Cancel order at a specific time

    Hi

    i try to cancel the entry level at time 161500, here my script, and it doesn't work...

    can you help me ? thx in advance.

    PS: i find this page on your forum

    but the file i download is a .php and not a zip, do you know why ?


    protectedoverridevoid OnBarUpdate()
    {

    if (BarsInProgress != 0)
    return;



    if (blablabla)


    {
    myEntryOrder = EnterLongStop(
    0,true, 1, Closes[1][0],"");
    }



    if (ToTime(Time[0]) > 161500)
    {
    CancelOrder(myEntryOrder);
    }

    #2
    Hello Thomas,

    Thank you for your post.

    What about it doesn't work?

    Do you receive any error messages in the Log Tab of the Control Center?

    What instrument are you running this on and time interval?
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      actually, i don't have any trade or order when i have the cancelorder on my script.

      if i delete the CancelOrder line, i have the orders and trades of my script... but of course the order after 161500

      Comment


        #4
        Do you receive any error messages in the Log Tab of the Control Center?

        What instrument are you running this on and time interval?

        Can you attach the whole script so that I can investigate it further?
        The script will be located in (My) Documents -> NinjaTrader 7 -> bin -> Custom -> Strategy
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          i running it on the FESX intraday 15 minutes since 2010

          you can find the script enclosed
          Attached Files

          Comment


            #6
            Thomas,

            Thank you for the script.

            Just to clarify, can you elaborate on what the exact issue is?
            Cal H.NinjaTrader Customer Service

            Comment


              #7
              the problem is that when i run the script i don't any order.

              when i delete the cancelorder :
              if (ToTime(Time[0]) > 161500)
              {
              CancelOrder(myEntryOrder);
              }



              i have all the trades and orders... however, i have some trades after 161500 time that i don't want...

              can you help ?

              Comment


                #8
                Thomas,

                Let me ensure that I'm following you right,

                When you mention "when i run the script i don't any order" does this mean that when this code is in your script that no orders are being placed, or does this mean that no orders are being filled?

                When you use the CancelOrder() you don't have any orders being placed?

                However, when you don't use CancelOrder() you do get orders being placed but then you get orders after 16:15 that you don't want.

                If this is the case you would want to put in logic for a time filter for your EntryOrder() as well.
                Cal H.NinjaTrader Customer Service

                Comment


                  #9
                  Yes, When i mention "when i run the script i don't any order" means that when this code is in my script that no orders are being placed

                  When i use the CancelOrder() i don't have any orders being placed?

                  However, when i don't use CancelOrder() i do get orders being placed but then i get orders after 16:15 that i don't want.

                  if i put a filter on my condition like && ToTime(Time[0] < 161500) and don't use the CancelOder() i have still orders after 16:15 because the order is placed before 16:15 and can be executed after 16:15, this is why i try to cancel it at 16:15... without succes

                  Comment


                    #10
                    ok i found the problem, i just need to write myEntryOrder != null on my condition...

                    Thx a lot

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by lightsun47, Today, 03:51 PM
                    0 responses
                    5 views
                    0 likes
                    Last Post lightsun47  
                    Started by 00nevest, Today, 02:27 PM
                    1 response
                    10 views
                    0 likes
                    Last Post 00nevest  
                    Started by futtrader, 04-21-2024, 01:50 AM
                    4 responses
                    46 views
                    0 likes
                    Last Post futtrader  
                    Started by Option Whisperer, Today, 09:55 AM
                    1 response
                    14 views
                    0 likes
                    Last Post bltdavid  
                    Started by port119, Today, 02:43 PM
                    0 responses
                    10 views
                    0 likes
                    Last Post port119
                    by port119
                     
                    Working...
                    X