Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
      Chris L.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by judysamnt7, 03-13-2023, 09:11 AM
      4 responses
      53 views
      0 likes
      Last Post DynamicTest  
      Started by ScottWalsh, Today, 06:52 PM
      4 responses
      33 views
      0 likes
      Last Post ScottWalsh  
      Started by olisav57, Today, 07:39 PM
      0 responses
      5 views
      0 likes
      Last Post olisav57  
      Started by trilliantrader, Today, 03:01 PM
      2 responses
      19 views
      0 likes
      Last Post helpwanted  
      Started by cre8able, Today, 07:24 PM
      0 responses
      6 views
      0 likes
      Last Post cre8able  
      Working...
      X