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