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

N Bars Up doesn't work for market replay

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

    N Bars Up doesn't work for market replay

    I built a strategy in strategy builder using NBars up and NBars Down on the Order Flow Cumulative Delta Indicator. After x amount of Bars up I want to buy or vice versa with the sells. Compiling works without errors. I connected to Playback connection and added the strategy to the chart. When trying to enable the strategy for backtesting it didn't work. It just won't enable. I added this function to another working strategy and upon adding this function the strategy couldn't be enabled anymore.
    Any ideas?

    #2
    Hello HappyTrader76,

    Thank you for posting about this, you actually shouldn't be able to do that. The orderflow tools are not available in the strategy builder due to their data requirements and how they process. You can use them in manual coding but not in the builder. They are normally hidden from the indicators list but it looks like when selected in that use case they show up.

    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you, that clears things up.
      Too bad these indicators are not available in Strategy builder. Would be a nice feature for those that have order flow capability. Is it possible to add that in the future?

      Comment


        #4
        Hello HappyTrader76,

        I have added your vote for that request, you can track it i the change logs with the id: SFT-4377
        JesseNinjaTrader Customer Service

        Comment


          #5
          Hello Jesse
          If I unlock the strategy builder and have the code in Strategy Editor, is there an easy way that I can change the code, so that the order Flow indicator which already shows up in the code can be used. I haven't coded much in C# yet and it would be nice if I could start from Strategy Builder and work from there.

          Comment


            #6
            Hello HappyTrader76,

            It is possible to do that however if you havent worked with manual coding or multi series scripts before this can be a complicated concept at first.
            You can find an example of what logic would be needed to call that indicator here:
            https://ninjatrader.com/support/help...m_highlightsub =orderflow


            If you unlock a strategy builder script it will have the following lines of code:

            Code:
            if (BarsInProgress != 0)
            return;
            
            if (CurrentBars[0] < 0)
            return;




            To make it work with the sample from the help guide you would need to remove those lines and make it look like the following instead:

            Code:
            if (BarsInProgress == 0)
            {
                if (CurrentBar < 0) // replace 0 with the maximum BarsAgo your sets uses
                    return;
            
               // your sets go here
            
            ​
                Print("Delta Close: " + OrderFlowCumulativeDelta(BarsArray[0], CumulativeDeltaType.BidAsk, CumulativeDeltaPeriod.Session, 0).DeltaClose[0]);
            }
            else if (BarsInProgress == 1)
            {
                 // We have to update the secondary series of the cached indicator to make sure the values we get in BarsInProgress == 0 are in sync
                 OrderFlowCumulativeDelta(BarsArray[0], CumulativeDeltaType.BidAsk, CumulativeDeltaPeriod.Session, 0).Update(OrderFlowCumulativeDelta(BarsArray[0], CumulativeDeltaType.BidAsk, CumulativeDeltaPeriod.Session, 0).BarsArray[1].Count - 1, 1);
            }​​​
            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Karado58, 11-26-2012, 02:57 PM
            8 responses
            14,825 views
            0 likes
            Last Post Option Whisperer  
            Started by Option Whisperer, Today, 09:05 AM
            0 responses
            1 view
            0 likes
            Last Post Option Whisperer  
            Started by cre8able, Yesterday, 01:16 PM
            3 responses
            11 views
            0 likes
            Last Post cre8able  
            Started by Harry, 05-02-2018, 01:54 PM
            10 responses
            3,204 views
            0 likes
            Last Post tharton3  
            Started by ChartTourist, Today, 08:22 AM
            0 responses
            6 views
            0 likes
            Last Post ChartTourist  
            Working...
            X