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

SubmitOrderUnmanaged(): what difference between bars series of same instrument

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

    SubmitOrderUnmanaged(): what difference between bars series of same instrument

    Hello.
    I creating strategy, operating with 2 timeframes [60 min (series 0) and 1 min (series 1)] of same instrument.
    It use unmanaged orders and work with COBC == true.

    Is there any difference between:

    PHP Code:
    SubmitOrderUnmanagedselectedBarsInProgress 0, ... );
    SubmitOrderUnmanagedselectedBarsInProgress 1, ... ); 
    in backtests and live trading?
    Last edited by fx.practic; 05-31-2018, 03:53 AM.
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    #2
    Hello fx.practic,

    Thanks for the post.

    The choice you make for BarsInProgress submissions will have an effect on the historical order fills that occur in a backtest per the historical fill algorithm. Using an hourly bar for backtesting could lead to incorrect order fill estimation in a backtest. Using a higher resolution bar series for order fills can alleviate this.


    Please let me know if I can answer any questions.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      How to choose timeframe if all used are not time-proportionsl?

      For example, 11 range and 233 ticks?

      May be, there is way to choose bar series each time on exact bar?
      May be, I cab to compare times or closes prices of last bars of each used timeframe?
      fx.practic
      NinjaTrader Ecosystem Vendor - fx.practic

      Comment


        #4
        Hello fx.practic,

        Thanks for the reply.

        If you had an 11 range primary series and a 233 tick secondary series, it is more probable that the 233 tick series would see more OnBarUpdates than the 11 range series if your calculation mode was set to OnBarClose. The historical fill logic will work in the same way regardless of time.

        If you need to get the timestamp of a bar, you may use the Times[][] array. Please see the attached script for an example. Run the script on an 11 range chart and observe the output window via New>NinjaScript Output.

        See these instructions to import the script:


        If I may clear anything up please let me know.
        Attached Files
        Last edited by NinjaTrader_ChrisL; 05-31-2018, 12:52 PM.
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Absolutelly clear example, thank You.
          If to apply it to my question, is this implementation correct:

          PHP Code:
          if( Times[0][0] >= Times[1][0] ) 
          {
          SubmitOrderUnmanaged0, ... );
          }
          else 
          {
          SubmitOrderUnmanaged1, ... );

          Does it have sense to choose bars series in this way each time before to submit order?
          Last edited by fx.practic; 06-03-2018, 04:04 AM.
          fx.practic
          NinjaTrader Ecosystem Vendor - fx.practic

          Comment


            #6
            Hello fx.practic,

            That is correct, the BarsInProgress index is a required parameter of every call to SubmitOrderUnmanaged().

            Your first question might refer to accessing a bars array regardless of the current BarsInProgress context to access data about any bar on any series. Note that the price series section of the help guide contains plural price series arrays, just as there is a Time[] array and a Times[][] array. These can be used to access any bar array value you might have in your script.

            https://ninjatrader.com/support/help...riceseries.htm - All Available Price Series. .

            I do not have enough context of your strategy to provide assistance with entry conditions like the sample that was posted, but the BarsInProgress index, in general, is used to place orders on either an additional data series that is applied to your script or to submit an order to an additional instrument for multi-instrument scripts. You can submit an order with the SubmitOrderUnmanaged method to your secondary time frame even if your BarsInProgress OnBarUpdate context is == 0.

            This page is a comprehensive overview on multi-time frame and multi-instrument scripts.

            Last edited by NinjaTrader_ChrisL; 06-01-2018, 09:44 AM.
            Chris L.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by arvidvanstaey, Today, 02:19 PM
            2 responses
            6 views
            0 likes
            Last Post arvidvanstaey  
            Started by jordanq2, Today, 03:10 PM
            0 responses
            2 views
            0 likes
            Last Post jordanq2  
            Started by traderqz, Today, 12:06 AM
            10 responses
            18 views
            0 likes
            Last Post traderqz  
            Started by algospoke, 04-17-2024, 06:40 PM
            5 responses
            46 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by mmckinnm, Today, 01:34 PM
            3 responses
            5 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X