Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

A bug?

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

    A bug?

    Hi,
    In my strategy I have this code:
    Code:
    if (Historical) return;
    Print("" + Time[0].ToString() + " Historical: " + Historical.ToString() + " Time now: " + DateTime.Now.ToString());
    and this what is in output window:
    **NT** Enabling NinjaScript strategy 'MR2a/726c1b76fff741beb127e8d1abe3e135' : On starting a real-time strategy - StrategySync=WaitUntilFlat SyncAccountPosition=False EntryHandling=AllEntries EntriesPerDirection=1 StopTargetHandling=PerEntryExecution ErrorHandling=TakeNoAction ExitOnClose=False Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=True CancelExitOrdersOnDisable=True MaxRestarts=4 in 5 minutes
    3/2/2011 1:00:00 PM Historical: False Time now: 3/17/2011 4:42:45 AM
    3/2/2011 2:00:00 PM Historical: False Time now: 3/17/2011 4:42:45 AM
    3/2/2011 3:00:00 PM Historical: False Time now: 3/17/2011 4:42:45 AM
    3/2/2011 4:00:00 PM Historical: False Time now: 3/17/2011 4:42:45 AM
    3/2/2011 5:00:00 PM Historical: False Time now: 3/17/2011 4:42:45 AM
    3/2/2011 6:00:00 PM Historical: False Time now: 3/17/2011 4:42:45 AM
    3/2/2011 7:00:00 PM Historical: False Time now: 3/17/2011 4:42:45 AM
    3/2/2011 8:00:00 PM Historical: False Time now: 3/17/2011 4:42:45 AM
    3/2/2011 9:00:00 PM Historical: False Time now: 3/17/2011 4:42:45 AM
    .
    .
    .
    .
    3/17/2011 4:30:00 AM Historical: False Time now: 3/17/2011 4:42:46 AM
    3/17/2011 4:43:00 AM Historical: False Time now: 3/17/2011 4:43:00 AM
    3/17/2011 4:44:00 AM Historical: False Time now: 3/17/2011 4:44:00 AM
    3/17/2011 4:45:00 AM Historical: False Time now: 3/17/2011 4:45:00 AM
    3/17/2011 4:46:00 AM Historical: False Time now: 3/17/2011 4:46:03 AM
    3/17/2011 4:47:00 AM Historical: False Time now: 3/17/2011 4:47:03 AM
    3/17/2011 4:48:00 AM Historical: False Time now: 3/17/2011 4:48:00 AM
    How can it be???

    Baruch

    #2
    Hello Baruch, is enough historical data loaded to satisfy the min bars required here for all series you work on with this strategy?

    Thanks,

    Comment


      #3
      Hi Bertrand,
      I don't understand why its important, but any way I increased the "days to load" and still the same.
      I load now 70 days. First bar is at 1/5/11 17:00. My main TF is 60 min and biggest TF is 120 min. My biggest indi is MA(365) if its important.
      The min bars required=20.

      Baruch

      Comment


        #4
        Baruch, I tried reproducing it here but was unfortunately unable to - would you mind sending the complete script and steps you take to see this to support at ninjatrader dot com?

        Thanks

        Comment


          #5
          Hi Bertrand,
          I found the offending line:
          Code:
             Add(Instrument.FullName, PeriodType.Minute, 1, MarketDataType.Ask);
          And the problem is not "Instrument.FullName" I tried with a name too.
          The question is WHY?

          Attached is a sample strategy which demonstrates this.

          Baruch
          Attached Files

          Comment


            #6
            Thanks Baruch, which dataprovider are you normally working with? Are they providing the historical minute bid / ask data needed?

            Comment


              #7
              Hi Bertrand,
              No, my data providers do not supply historical bid/ask. (Kinetick & MB Forex) I create my own ask data for backtesting. Still I don't think NT should behave like this.

              Baruch
              p.s. I don't execute it any more in live trading.

              Comment


                #8
                You would see this behaviour as you do not have any Currenbar vs BarsRequired checks in your script, please test the attached one, it should work as you expect.
                Attached Files

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                558 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                324 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                101 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                545 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                547 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X