Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Allowing EnterLongStopLimit() to last longer than each candle

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

    Allowing EnterLongStopLimit() to last longer than each candle

    Hello,

    While trying to develop a strategy to help me trade, I came across the issue of EnterLongStopLimit() not staying active for more than 1 candle. Upon looking this up, I found out that this is normal behavior. When trying to figure out how to prevent it, I read more into Advanced Order Handling and figured out that this should solve my problem. Ideally, I would like to place an order with my given limits, and allow it to continue until I call the cancel order command. When trying to translate into the AOH, I am coming across the issue of figuring out BarsInProgress. I currently have

    EnterLongStopLimit(?, true, 1, limitPrice, stopPrice, signalName)

    and I am unsure of what to put for the ?. I've tried different numbers and I've tried to look more into it, however, I am hitting a roadblock. All the values I've placed gives me an out-of-bounds error. I would just like my EnterLogStopLimit to last more than 1 candle. Is this the right way to go about this, or is there something I am overthinking?

    Thanks!

    #2
    Rather than using the overload to keep the order alive beyond the bar, what I would probably do if you want to keep it simple is set a flag that you're trying to enter, set variables for the stop price and limit price and size, and then just keep repeating the order each bar until you get filled or are ready to cancel it. If you "repeat" the order each bar it doesn't actually make a new order, it just doesn't cancel it if all of its particulars match the already existing order.
    Bruce DeVault
    QuantKey Trading Vendor Services
    NinjaTrader Ecosystem Vendor - QuantKey

    Comment


      #3
      Hello, thanks for writing in. The first parameter is the BarsInProgressIndex. This lets you submit the order to alternate series added with AddDataSeries. If you want to submit the order only on the primary series use 0 in that first parameter.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      633 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      567 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X