Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EnterShortLimit error checking

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

    EnterShortLimit error checking

    I had something coded wrong so that my call to EnterShortLimit was being done with a limit order of zero. And NinjaTrader didn't object to this.

    Here's the code I was using:

    Code:
      entryOrder1 = EnterShortLimit( 0, [COLOR="RoyalBlue"]false[/COLOR], DefaultQuantity, limitOrderPrice, shortName1 );
    And I had a code path which hadn't initialized limitOrderPrice, so I called it wrong.

    But, what's worse is the StrategyAnalyzer "filled" the order at a price of zero.

    So here's what I think should have happened:
    1) First off, NinjaTrader should have rejected the order since you can't short at a price of zero.

    2) The StrategyAnalyzer should have "filled" the order at the best available price (which was a lot higher than zero.)

    Just thought I'd let you know... (another couple of 2-minute fixes needed here.)

    #2
    Thanks for the feedback, KBJ. There are two historical fill processing options available:

    Default
    An algorithm that takes a conservative and more realistic approach to filling limit and stop limit orders.
    • Limit orders only fill if the limit price was penetrated
    Limit orders are always filled at the limit price specified never better (for example, if a limit order is submitted on bar n, NinjaTrader will check if the order is filled on bar n+1, if this bar gaps down and the limit order was a buy, the order would be filled at the limit price and NOT the high of bar n+1)

    Liberal
    An algorithm that takes a liberal approach to filling limit and stop limit orders.
    • Limit orders fill if the limit price was touched
    • On gap down bars, buy limit orders will fill at the high of the gap down bar
    • On gap up bars, sell limit orders will fill at the low of the gap up bar

    Your example shows show why we do things this way with the default fill type. It highlights that your strategy is submitting at 0 limit price. This is a coding error you otherwise might not catch if NT fills you on the bar.

    If the provided fill types aren't what you're looking for, you can also program your own. You can see the source for these in:
    Documents\NinjaTrader 7\bin\custom\type
    Last edited by NinjaTrader_RyanM1; 05-27-2011, 02:18 PM.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_RyanM View Post
      Your example shows show why we do things this way with the default fill type. It highlights that your strategy is submitting at 0 limit price. This is a coding error you otherwise might not catch if NT fills you on the bar.
      Ryan,

      Thanks, I'd forgotten about the ability to select different fill processing options (default, liberal, etc.).

      However, since NinjaTrader ignored the zero limit order price, all kinds of other side effects ensued (such as stop-loss and profit-target orders being executed at insanely small numbers because of being specified with CalculationMode.Ticks and a zero limit-order price), so why not just treat this as an error?

      Surely you've spent more time on this already than it would to just put a simple test in the code to reject a zero price?

      It makes sense to do this because a zero price is always a coding error and should not be accepted by NinjaTrader regardless of the fill processing option selected.

      Comment


        #4
        Thanks for the feedback and input KBJ, we will add this to our list of feedback (tracked under # 1010) - have a good weekend
        Last edited by NinjaTrader_Bertrand; 06-07-2011, 10:42 AM.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        652 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        370 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        109 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        574 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        577 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X