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 DanielTynera, Today, 01:14 AM
      0 responses
      2 views
      0 likes
      Last Post DanielTynera  
      Started by yertle, 04-18-2024, 08:38 AM
      9 responses
      40 views
      0 likes
      Last Post yertle
      by yertle
       
      Started by techgetgame, Yesterday, 11:42 PM
      0 responses
      10 views
      0 likes
      Last Post techgetgame  
      Started by sephichapdson, Yesterday, 11:36 PM
      0 responses
      2 views
      0 likes
      Last Post sephichapdson  
      Started by bortz, 11-06-2023, 08:04 AM
      47 responses
      1,615 views
      0 likes
      Last Post aligator  
      Working...
      X