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

Multi bar series and order cancels

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

    Multi bar series and order cancels

    Hi,

    I'm wondering if I'm doing something dopey or not.

    My usual approach to strategy development is to first start with static historical data, move to sim101 and then to a live trading account. A good deal of my development work requires looking inside bars, so of course I use multi bar series. Usually I have, say, a Range bar as the primary series, and then add a 1 Tick secondary series. This lets me backtest on a tick by tick basis and works quite well. The strategy inevitably works nicely on sim101 also.

    The problem is when I go live. Pretty much every time the script won't work as is, because once an order is submitted, a cancel order goes out on the very next tick, because orders get cancelled automatically if not filled on the next bar, and with that 1 Tick series present, the next tick is the next bar.

    I'm avoiding getting into keeping orders alive for longer than one bar, so what I do is basically rewrite the strategy by removing the secondary series and go COBC = false. This works, but now I have to keep track of and revise two separate strategy files.

    Any comments or suggestions?

    #2
    Coolmoss,

    Are you using the following syntax for order entry?

    EnterLong(int barsInProgressIndex, int quantity, string signalName)

    The barsInProgressIndex would allow you to submit an order against another time frame.

    Here is a help guide entry on Multi-series order handling : http://www.ninjatrader.com/support/h...r_handling.htm
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Hi Adam,

      You know, I may have been making a mistake here. Can you please verify this: if multiple data series are present in a strategy, (say 10 range is primary and 1 tick is secondary) and the entry order is submitted on the primary (10 range) series, and I'm NOT using syntax including the barsinprogress on the entry order, then even though the order was submitted on the primary series, the secondary tick series will cause the order to be canceled at end of bar (which is the next tick for a 1 tick bar).

      But, if I use the barsinprogress syntax, the the order will be canceled (if not filled of course) at the end of the range (or primary) bar, not the tick bar?

      If so, that's just fantastic!

      Also, an unrelated question: if a custom timer event is employed (like in the sample code in the forum) will that only work on running a live strategy, or will a timer work on historical/backtested data also?

      thanks so much for your help

      Comment


        #4
        Coolmoss,

        Are you using the BarsInProgress filter before you enter the order? Generally, the bars in progress an order is submitted against would keep it tagged to that series, so it would wait until the bar closes for that series, not the other.

        Which reference sample are you referring to? A time filter will work on historical data. Something like DateTime.Now would not however.
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          I wasn't using the bars in progress filter on the primary series, so maybe that's what I need to do.

          Thanks for info on the timer events.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by TheTradingMantis, 01-19-2023, 02:05 AM
          41 responses
          906 views
          0 likes
          Last Post jmagaia
          by jmagaia
           
          Started by _Zero_, 04-10-2020, 03:21 PM
          144 responses
          7,891 views
          6 likes
          Last Post NinjaTrader_ChelseaB  
          Started by Richozzy38, Yesterday, 01:06 PM
          7 responses
          27 views
          0 likes
          Last Post Richozzy38  
          Started by swjake, Today, 12:04 PM
          5 responses
          15 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by forrestang, Today, 01:41 PM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Erick  
          Working...
          X