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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      43 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      21 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      30 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      50 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Working...
      X