Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EntriesPerDirection wrong on NQ, but OK on ES, CL, GC etc

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

    EntriesPerDirection wrong on NQ, but OK on ES, CL, GC etc

    OK, I think this is a weird one.

    I've written a strategy that fires off two consecutive orders on each setup (with different signal names). The first with a profit target, the second, to act as a runner. Very common practice... All works just fine with ES, CL, GC, 6B... everything I tested... EXCEPT when I run the EXACT same strategy on NQ. On NQ, I get an "order ignored" error on the 2nd Enter... This cut from the order trace:
    Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties'.



    Hmm... I have EntriesPerDirection = 2 in ALL cases... I do NOT change anything at all... exact same code, same settings... on ES/GC/CL etc .. the 2nd order is accepted as expected.
    Change the instrument to NQ... and it screws up.

    If I set EntriesPerDirection = 4 ... then and ONLY then will my SECOND order on NQ be accepted. That's just wrong...

    Each entry has a different signal name... all "first contract" orders have a "1" as name last digit... all "second contract" orders have a "2" as last letter of the signal name. I know.. confusing ;-)

    I have attached trace outputs for CL, GC and NQ, along with the relevant section of OnStateChange code... Got some lines my code writes in there as well... but you can see the issue in the first few lines of the order traces... You can see multiple orders with signal names like CTR1, CTR2, WIK1, WIK2 etc on the GC/CL traces... but for NQ... only ever CTR1, WIK1 etc... as the secong order is ALWAYS rejected.

    It's the NQ file that displays the mysterious error...

    So... I have a workaround... but it is troubling that this basic behaviour is, well... broken by changing instrument!

    Any suggestions appreciated.

    PS NT8, 8.0.21.0 Win7 Pro.
    Attached Files
    Last edited by tgn55; 03-17-2020, 07:35 AM. Reason: Extra detail added

    #2
    Hello tgn55,

    We would need to see all order updates from OnOrderUpdate along with the TradeOrders information for all instruments.

    May we have a single output file that prints the order object from OnOrderUpdate() for all instruments and has TraceOrders enabled, again for all instruments?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Chelsea, just to clarify...
      My strategy places orders on one instrument ONLY. The multiple files I sent are running the same strategy but on different charts. Each instance ONLY creates orders on the primary series.
      And the traces for GC, CL etc have no problems... it is only the NQ instance that is non-compliant.

      I've included output this time from OnOrderUpdate. After I enter, my strategy (as seen in the GC/CL traces) does some trailing stop management on the second contract... none of which is really relevant. The NQ instance fails on the 3rd line of the trace! 2nd order rejected... end of story. Below that is just noise. The issue manifests itself right up front.

      Yes I set some profit targets and stoplosses... but this is done for each run, ie I mean on ES, on GC etc when I run it on those instruments, no different to when I run the strategy on an NQ chart.

      Your reference to "a single output file" seems to suggest you think I am creating orders on multiple instruments from the one strategy instance... I am not... It is much simpler than that.
      I enter ONLY on BarsInProgress == 0, and while I am not going to send my entire strategy, the relevant order submission code (for a long breakout) is...
      Code:
       if (BO_above_prev_hi && TradeBreakou)
      {
          EnterLongStopMarket(DefaultQuantity, GetCurrentAsk(0) + EntryBuffer * TickSize, setup_name + "1");
          EnterLongStopMarket(DefaultQuantity, GetCurrentAsk(0) + EntryBuffer * TickSize, setup_name + "2");
          ....
      The crux of the matter is - the first EnterLong is accepted... the second is not... but ONLY when I run this on an NQ chart. Run on anything else - it works exactly as expected.

      What I do subsequently with trailing stops (on CL for example, when the second order is accepted) has no bearing on why the second NQ Enter is rejected... when I CLEARLY have EntriesPerDirection set to 2. Kapich?

      Thankyou.

      PS... if it matters, I have run this same strategy on 2 or 3 different SIM accounts... same result. The accounts have NO open positions... nothing else going on. ES works, GC works, CL works... NQ doesn't... unless I bump up EntriesPerDirection. SAME code, SAME chart... only difference is the instrument. Oh... it also fails in the same way if I run the strategy from StrategyAnalyser, rather than from a chart.
      Attached Files
      Last edited by tgn55; 03-17-2020, 10:01 AM. Reason: Extra detail...

      Comment


        #4
        Hello tgn55,

        We are wanting to simplify things.

        I've made a test script that places two stop entry orders in historical data with EntriesPerDirection set to 2 and then closes them, and then once again in real-time.

        (I'm not sure if this output is from historical or real-time orders so I am testing both. If this is the entire output file and the script places historical orders, then I would expect this to be a historical order.)

        I've tested this on the Sim101 on the NQ 06-20 but I am not able to reproduce the ignored order. Both orders are being submitted in both historical and real-time.

        Are you using 8.0.21.0?

        Can you reproduce using this test script?

        Please provide the output from the output window produced by the test script.
        Attached Files
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thanks.

          Yes 8.0.21.0. And your script creates two entries as expected (on historical and realtime)
          So I guess it's my code that's suspect... but, that said, it IS very weird that my code works just fine on everything EXCEPT NQ... huh?
          And the error message is clearly suspect... given I really do have EntriesPerTrade set to 2... and the problem goes away if I increase it.

          Well, I guess I'll just have to use this workaround.

          I have one more thing to test... I'll report back if I find anything useful the community.

          Comment


            #6
            Hello tgn55,

            Did you provide the entire output?

            Are there no other working orders?

            Print EntriesPerDirection in State.DataLoaded to the output window to ensure it's setting.

            You can use the test script I have provided as a starting point and start adding your code until the behavior reproduces. This might help to narrow down the cause of the ignored order.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              I did not send any more output, the trace data does not really reveal anything useful that I can see.. There are no other working orders.

              Printing out EntriesPerDirection... shows it set to 2... and no second orders are accepted. If I increase EPD to 3 in the SA grid... all my second entries happen just fine, and my P/L jumps by a factor of 3x what it is without my "runner" trades ;-)

              My code is like 1,000 lines... not really practical to start with yours and add to it.

              For now, I'll just use the workaround of bumping EPD up... this can go on the back burner while I focus on more pressing issues... like making some money;-)
              Cheers,
              T.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Today, 05:17 AM
              0 responses
              20 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              119 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              63 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              41 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              45 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X