Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EnterLongLimit multiple times

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

    EnterLongLimit multiple times

    I have the following problem with the method EnterLongLimit() when it is called multiple times. Let's say somewhere in "onBarUpdate" I have the following code:

    Code:
    if (condition1)
    {
        EnterLongLimit(0, true, this._long_order.qty_1, enPrice + 4.67, "Long 1");
    }
    
    if (condition2)
    {
        EnterLongLimit(0, true, this._long_order.qty_2, enPrice + 3.98, "Long 2");
    }
    if (condition3)
    {
        EnterLongLimit(0, true, this._long_order.qty_3, enPrice + 2.45, "Long 3");
    }​
    It could be that all 3 conditions are met. In this case I wanto to call EnterLongLimit() 3 times. I have checked with the debugger and indeed I am calling the method when all conditions are met. But on the chart and in the Strategy Performance Analyzer I only see trades for Long 1. In case I comment out the calls for "Long 1" and "Long 3", the trades for "Long 2" do work. During my research I found this thread: https://forum.ninjatrader.com/forum/...nterlong-twice
    According to the suggestions I changed the values of EntriesPerDirection = 30 (high number just for example) and EntryHandling = EntryHandling.UniqueEntries; but this also did not solve the problem.

    #2
    Hello j0ch3n,

    Welcome to the NinjaTrader forums!

    Enable TraceOrders and this will let you know if orders are being ignored and why.

    Below is a link to a support article on adding debugging prints and using TraceOrders to understand behavior.


    You've noted you have changed the value of the EntryHandling property.
    May I confirm this was assigned in State.Configure in OnStateChange() and not in State.SetDefaults?
    If this was set in State.SetDefaults, may I confirm you have removed the instance of the script from the chart Strategies window Configured list, and added a new instance from the Available list to pull the new defaults?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello ChelseaB,

      this was indeed my problem. I assigned the value of EntryHandling in State.SetDefaults. I now changed it so that it is assigned in State.Configure.
      Thx a lot!

      Comment

      Latest Posts

      Collapse

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