Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using CancelOrder()

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

    Using CancelOrder()

    Hi,

    I would like to clarify that it is possible to use the CancelOrder() method with code other than the entryOrder bar method in the sampleCancelOrder strategy (as per the code below).

    Code:
    // If entryOrder has not been filled within 3 bars, cancel the order.
                    else if (entryOrder != null && CurrentBar > barNumberOfOrder + 3)
    For example if I was to use a time filter and/or other method(s) instead?

    Admittedly I haven't tried anything else yet because I wasn't sure.

    Regards,
    suprsnipes

    SOLVED:
    An OR is represented in C# with 2 pipe characters: ||

    The TimeFilter reference sample also uses an OR this way. I didn't realise.
    Last edited by suprsnipes; 12-22-2010, 06:30 PM. Reason: Question solved

    #2
    supr,

    I believe the entryOrder variable in this example is of IOrderType. This represents the order you are trying to cancel. You can cancel an order based on any criteria you'd like.
    mrlogik
    NinjaTrader Ecosystem Vendor - Purelogik Trading

    Comment


      #3
      Thanks for the reply mrlogik I appreciate it

      Comment


        #4
        Hi suprsnipes,

        CancelOrder is used with IOrder, in any context of OBU()
        TimNinjaTrader Customer Service

        Comment


          #5
          Ok,

          I have one further question. Is it possible to use the following code (as per the sample) with additional criteria.

          In this case, just for clarification I don't want to use && on the end of the statement below.

          Code:
          else if (entryOrder != null && CurrentBar > barNumberOfOrder + 3)
                    CancelOrder(entryOrder);
          What I do want to do is use a different set of conditions to cancel the same order ... like an OR statement I guess but I'm not to sure if this is possible?

          If so what context could I use?
          Last edited by suprsnipes; 12-20-2010, 08:08 PM.

          Comment


            #6
            HI suprsnipes,

            I don't see any reason why you would not be able to. The conditions for the Cancel shouldn't matter, if they are satisfied, the CancelOrder code will be entered.
            TimNinjaTrader Customer Service

            Comment


              #7
              Thank you Tim

              Comment


                #8
                I am now using an additional cancel order condition which so far in testing is working perfectly.

                The question I would like to ask now is how can I add to the code below an additional time filter as an OR statement?

                Code:
                // If entryOrder has not been filled using the time filter below then cancel the entry order. 
                                else if (entryOrder != null && (ToTime(Time[0]) > 110100))
                I understand I would need to have a time above and below for one condition but how can I use an OR for specifying another time range to achieve the same effect.

                Regards,
                suprsnipes

                Comment


                  #9
                  Hi suprsnipes,

                  Are you familiar with this sample?: http://www.ninjatrader.com/support/f...ead.php?t=3226

                  This uses several "OR's" is the format ||
                  TimNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by binzel, Today, 03:18 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post binzel
                  by binzel
                   
                  Started by stalt, 12-28-2015, 01:36 PM
                  8 responses
                  1,569 views
                  0 likes
                  Last Post Víitnnhatrangdotvn  
                  Started by Rocksworx, Today, 02:29 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post Rocksworx  
                  Started by lcgamarra_pinnacle, 06-15-2024, 09:33 AM
                  2 responses
                  33 views
                  0 likes
                  Last Post AlexMocc  
                  Started by nervesaidus, Today, 01:39 AM
                  0 responses
                  6 views
                  0 likes
                  Last Post nervesaidus  
                  Working...
                  X