Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EntriesPerDirection not working as expected

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

    EntriesPerDirection not working as expected

    Hi,
    I am trying to scale into my position (max 3 contracts). But its not working as expected.

    In my strategy I am using:

    EntriesPerDirection = 3;
    EntryHandling = EntryHandling.AllEntries;

    Then in OnBarUpdate() i am doing:

    Code:
    if (i am flat) {
    if (my condition) {
    Print("Entering first contract");
    EnterLong(1, @"myEntry"); // works fine
    }
    }
    
    if (i am not flat) {
    if (my condition) {
    Print("Entering second contract");
    EnterLong(1, @"myEntry2"); // works fine
    }
    else if (my condition 2) {
    Print("Entering third contract"); // prints in console
    EnterLong(1, @"myEntry3"); // doesn't work
    }​
    }​
    For some reason it only enters 2 contracts max instead of 3. I see the Print output in console for entering the 3rd contract but nothing else no error or anything.

    I also tried:

    EntriesPerDirection = 1;
    EntryHandling = EntryHandling.UniqueEntries;​

    This also doesn't work it also only enters 2 contracts max.

    Is there something I'm doing wrong?


    #2
    Hello trader252,

    Did you re apply the strategy after changing the entries per direction and do you see 3 listed in the strategies properties when you apply it?

    Comment


      #3
      Hi, the strategy is only manually edited now since i've edited the code. And yes I made sure to recompile and reapply the strategy.

      Is there some other place i can check to see if EntriesPerDirection is set properly?

      The weird thing with this though is that I tested the strategy in Playback connection account and it was able to enter 3 contracts. When i run it in a live account (Topstep rithmic) it only enters 2 contracts max. I tested to see if i could manually enter 3 contracts in the live account and i was able to without any issues.

      Comment


        #4
        Hello trader252,

        Are you seeing any messages in the control center log tab when the 3rd order should be submitted, when you see the print?

        You can try enabling traceorders to check if the order is being ignored for some reason, you will need to remove and re apply the strategy after setting that to true.



        Comment


          #5
          Hi,
          I have EntryHandling set to EntryHandling.AllEntries and
          EntriesPerDirection set to 3​

          I enabled traceorders and this is what it said:

          4/2/2024 7:09:58 AM Strategy 'AutoTraderTrendMES/290165232': Entered internal SubmitOrderManaged() method at 4/2/2024 7:09:58 AM: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='myEntry3' FromEntrySignal=''
          4/2/2024 7:09:58 AM Strategy 'AutoTraderTrendMES/290165232': Ignored SubmitOrderManaged() method at 4/2/2024 7:09:58 AM: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='myEntry3' FromEntrySignal='' Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties'​

          At the same time I logged:
          AutoTraderTrendMES: CurrentContracts: 2
          Entering 3rd contract Short​​

          So when it was trying to enter the 3rd contract I had 2 contracts.

          Any idea what would be causing it to not enter the 3rd contract?
          Last edited by trader252; 04-03-2024, 01:25 AM.

          Comment


            #6
            Hello trader252,

            The ignore message means that the strategy is still seeing that you are using less than 3 entries per direction, are you certain that you completely removed the strategy so it was not showing up in the control center strategies tab and then re applied it? When you re applied the strategy was the new default of 3 entries per direction shown in the strategies properties?

            Comment


              #7
              Ok i think i figured out the issue. I had reapplied the strategy and it was showing 3 entries per direction but when I restarted ninjatrader it was reverting back to 2 entries per direction. I made sure to save the workspace after reapplying the strategy and now it shows 3 entries per direction.

              Thanks for the help.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Yesterday, 05:17 AM
              0 responses
              72 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              143 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              76 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              47 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              51 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X