Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Internal Order Handling rules error

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

    Internal Order Handling rules error

    Hey there,

    the system was super slow, as I've found my experience to be multiple times. As per usual, I've uninstalled NT8B12, and deleted all of the files, and reinstalled everything, and imported over 4 public indicators from your website, and my own strategy.

    I have the picture of it attached, on the right screen. Not sure if maybe I didn't read the log before, but I'm 99% sure I didn't see this fault previously; no code has been modified, and I'm using built in NASDAQ100 list.

    Strategy makes 23 trades, and another 13 are ignored, as per the log; for NASDAQ 100. I got the last trade in question highlighted on log and output, and have the relevant code. Couple questions about that...

    1) Is my logic crazy? Is it the way I've got it put together? I'm looking for an entry, and then I'm trying to get a better price. NT cannot do real time entries as of CURRENT bar - or can it? - so I'm using last bar's close and if it's a long entry I want to try a limit 2% less, then 1% less, then if position is still flat, I'll take what I can get at market entry.

    2) IS it possible to time an entry on the current bar? Let's say Close[0] satisfies en entry long. Can I then check what the CURRENT bar is, and if its OPEN[NOW] -+2.5% above or below Close[0] I don't want to trade a trade. Otherwise can I write a LOOP ON THE CURRENT bar entry? trying a long entry 2% limit, if that doesn't fill then try 1%, if that doesn't fill do market. I think that's essentially what I have?

    3) SIDE note, why Am i getting LMCK and LMCA as not available? I've got historical downloaded, and indeed when I open the chart for those two, I am only getting TODAY. I checked with ToS platform, and TD DOES have those stocks in there...

    Thanks for ideas!
    Attached Files

    #2
    Hello lmatiukas,

    There error message indicates that you are violating an internal order handling rule.

    Have you checked your code to make sure that none of the situations listed on the Internal Order Handling rules have been violated?
    http://ninjatrader.com/support/helpG...d_approach.htm

    Yes, its likely the logic of the script causing the error. Likely there is another working order that is preventing this order from being submitted.

    Yes, you can place orders in real time.
    Yes, you can place an order as one bar closes (which causes the new bar to open).
    Yes, you can place a buy limit order 2% under the current price (if you calculate this value).

    Yes, you can use a timer to place an order at a specific time. You can also use Calculate.OnEachTick to trigger OnBarUpdate on each tick between bar closes and use FirstTickOfBar to see if a new bar has opened.
    Yes, you can check the current bar is, you can check to see if the Open[0] ([0] is 0 bars ago and is the current bar) is above or below another value and not submit the order if it is not.
    When you say if it doesn't fill, you can always modify the price of another and move it to a better price without having to cancel the order. Just submit the order again using the new price but using the same signal name.

    I will not be able to comment on why historical data is not available from TD Ameritrade for some instruments. If the data is available and the symbol mapping is correct, NinjaTrader will download the data and use it.
    Are you having issues with other instruments?
    Have you asked TD Ameritrade if they provide data to the API for these instruments?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      hey there,

      if it's not too much trouble, how do I call upon the current bar for the entry price? Let's say Close[0] was $20, and so I would want to enter at 2% or 1% below $20 or finally market order. However, if the current bar is at $30 - a $10 spike overnight, then I don't want a $30 market order to fill. How would I check for current price to make sure that at the entry point it's not higher than Close[0] by 2.5%?

      thanks so much for your help regarding that question^^; really not sure what code language I'm using here sometimes.

      Additionally will simply remove any stocks that NT can't import from TD - since it's just a handful for some reason; I will also try a simple LongEntry(), to see if I still get an error, or if it's my logic... Maybe I'll use While (market position == flat){ keep trying to enter -5%,-4%-,3% and so on...}

      Thanks

      Comment


        #4
        Hello lmatiukas,

        The current price is Close[0].

        If Calculate on bar close is set to true, then Close[0] will refer to the current price as the bar is closing. If Calculate on bar close is set to false, then Close[0] will refer to the current price of the current bar in real time.

        Print(Close[0]);
        This will print the current last price.

        I'm not sure what you are trying to do. Are you trying to find if the current close is greater than the previous bar?

        if (Close[0] > Close[1])
        {
        // execute code
        }
        This would trigger if the current price is greater than the previous bar's close price.

        NinjaScripts are written in C#.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          here is a simple code - not running any loops - and I get: Strategy
          'Main_strategy/-1': An Enter() method to submit an entry order at '7/11/2016 4:00:00 PM' has been ignored. Please search on the term 'Internal Order Handling Rules' in the Help Guide for detailed explanation.

          ExitShort();
          double entry = GetCurrentBid()*.98;
          EnterLongLimit((int)orderQuantity,GetCurrentBid(), "Super LONG ");
          Print("Super LONG Limit"+ Position.Instrument);
          justEntered = true;
          if (Position.MarketPosition == MarketPosition.Flat)
          {
          EnterLongLimit((int)orderQuantity,GetCurrentBid(), "Super LONG.1 ");
          Print("Super LONG.1 Limit"+ Position.Instrument);
          justEntered = true;
          }
          else if(Position.MarketPosition == MarketPosition.Flat)
          {
          EnterLong((int)orderQuantity,"Super Long, limit was not filled");
          Print("Super Long.2"+ Position.Instrument);
          justEntered = true;
          }

          I want to first see if it's possible to get a lower bid, and try to long there, and it never is.. It always gets executed at CurrentBid on the next iteration. I take a regular market order if Bid/Ask were not to fill in real life; but still would like the +-2% to work.

          How should I go about doing that?

          Thank you

          Comment


            #6
            If i clear the code and simply do
            1. EnterLong(quantity) - I get no issues..
            2. If I do what I've posted above - I get issues
            3. If i change to just EnterLimitLong(quantity,GetCurrentBid()) - I get issues

            What's a good way to say enter a limit at currentBid, but if it doesn't fill, then simply ignore it.

            Comment


              #7
              Hello lmatiukas,

              The error is not about the price being used or when the order is being placed.

              The error is letting you know that another order is working and this order is being ignored because it would violate the internal order handling rules.

              I have mentioned this in post #2. Has this been addressed? I did not receive an answer from you about this.

              Below is a link to the NinjaTrader 8 Help Guide on the Managed Approach. Please see the section 'Internal Order Handling Rules that Reduce Unwanted Positions'.
              http://ninjatrader.com/support/helpG...d_approach.htm

              Did you review the internal order handling rules and then check to see if you are violating any of these rules?
              Do you have any working orders at the time the order is being placed?

              For future reference, below is a link to the NinjaTrader 8 Beta section of the help guide where NT8 inquiries should be posted.
              http://ninjatrader.com/support/forum...splay.php?f=59
              Chelsea B.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              70 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              42 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              25 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              28 views
              0 likes
              Last Post TheRealMorford  
              Started by Mindset, 02-28-2026, 06:16 AM
              0 responses
              54 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Working...
              X