Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Savely ignore historical data on stretegy start

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

    Savely ignore historical data on stretegy start

    What is the proper way to ignore historical data when the strategy is started?

    OnBarUpdate is called for any historical bar and I don't need that. I just need the live data.
    Since market replay should work also I can't use DateTime.Now to check...

    #2
    Just start your OnBarUpdate() with

    Code:
    if (Historical) return;

    Comment


      #3
      Ah thanks! I really overlooked that in the help...

      Comment


        #4
        If you are comfortable adding a bool in the variables, this makes it easy to backest without having to edit the code. I put it it OnBarUpdate(). "Backtest" is my bool.

        PHP Code:
        if (backtest == false)
        {
        if (Historical)
        return;
        }
         
        //trade logic here 
        

        Comment


          #5
          Using if (Historical)

          Ninja Support,
          I am trying to run a new strategy that does not seem to be starting up or submitting orders(though it does in backtest).
          So I updated it for realtime.
          It requires 21 bars for the indicators.
          If I use the "if (Historical) command at the start of the OnBarUpdate will it ignore all the past data and start processing those 21 bars at realtime thereby delaying any entries by that amount of bars?
          I have been stopping the Strategy when I see that it didn't put in an order. So I don't know if it puts in the orders at 21 bars.

          Thanks
          Mike

          Comment


            #6
            Hi BigMike,

            If you call on an indicator from your strategy, it will use all available chart data, so the indicators will have data to "use" if you have atleast 21 bars on the chart.

            To find out why you aren't getting orders, start by monitoring the Log tab of the Control Center. Then consider using TradeOrders.

            More info at - http://www.ninjatrader-support.com/H...ml?TraceOrders
            TimNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            649 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            370 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            109 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            574 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            576 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X