Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strange trade handling

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

    Strange trade handling

    NT support,
    I use what you call "Advanced Order Handling".
    I use 3 IOrders: EntryOrder, StopOrder and PTOrder.
    For longs I issue in OnBarUpdate() an EntryOrder=EnterLong(TradeQuantity, Name)
    Then in OnExecution() if Long:
    StopOrder = ExitLongStop(SLPrice, "Stop", Name)
    PTOrder = ExitLongLimit(PTPrice, "PT", Name)
    Those orders are executed and then canceled (see order_bug.txt). Why are they canceled and why the quantity is Zero.
    Second attempt :
    StopOrder = ExitLongStop(TradeQuantity, SLPrice, "Stop", Name)
    PTOrder = ExitLongLimit(TradeQuantity, PTPrice, "PT", Name)
    In this scenario (order_bug2.txt) The quantity is correct, but still cancellation.
    So now I do:
    StopOrder = ExitLongStop(0, true, TradeQuantity, SLPrice, "Stop", Name)
    PTOrder = ExitLongLimit(0, true, TradeQuantity, PTPrice, "PT", Name)

    The question is: Why exit orders are canceled and why do I need the quantity? and do I need the last overload or there is something other wrong?

    Baruch
    Attached Files

    #2
    Hello,

    Thanks for the forum post.

    Just to clarify:

    StopOrder = ExitLongStop(0, true, TradeQuantity, SLPrice, "Stop", Name)
    PTOrder = ExitLongLimit(0, true, TradeQuantity, PTPrice, "PT", Name)

    The last option you tried works without cancellation correct?

    I look forward to assisting you further.

    Comment


      #3
      The last option you tried works without cancellation correct?
      Yes, but I thought that only entries are canceled on a new bar, not exits.

      Comment


        #4
        Hello,

        It also applies to exit orders as well.

        Also, these orders are meant to work in OnBarUpdate(), running outside of this may give you some unexpected cancellation timing.
        Last edited by NinjaTrader_Brett; 09-15-2011, 07:45 AM.

        Comment


          #5
          Hi Bret,
          Yes it applies to exits too. I had a blackout.
          For entering only OnBarUpdate(), please look at the example below.
          When using NinjaTrader's Enter() and Exit() methods, the default behavior is to automatically expire them at the end of a bar unless they are resubmitted to keep them alive. Sometimes you may want more flexibility in this behavior and wish to submit orders as live-until-cancelled. When orders are submitted as live-until

          Comment


            #6
            Rght however this uses the override that says to not cancel the order based off OnBarUpdate(). Which then works as you have confirmed and you dont run into the OnBarUpdate() cancellation issue.

            Thanks.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by r68cervera, Today, 05:29 AM
            0 responses
            2 views
            0 likes
            Last Post r68cervera  
            Started by geddyisodin, Today, 05:20 AM
            0 responses
            3 views
            0 likes
            Last Post geddyisodin  
            Started by JonesJoker, 04-22-2024, 12:23 PM
            6 responses
            33 views
            0 likes
            Last Post JonesJoker  
            Started by GussJ, 03-04-2020, 03:11 PM
            12 responses
            3,239 views
            0 likes
            Last Post Leafcutter  
            Started by AveryFlynn, Today, 04:57 AM
            0 responses
            6 views
            0 likes
            Last Post AveryFlynn  
            Working...
            X