• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Historical returning False

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

    Historical returning False

    Dear NinjaTeam,

    I am seeing an odd issue. When I start up Ninja (the program itself) for the first time, and run a strategy; it will load and parse through all the historical data. All the data it has gone through it considers (Historical == false). Now, if I turn off and run the Strategy 1 more time, it will not re-run all the past historical data, giving proper (Historical == true) where expected. Also, if I remove the strategy and re-add it all over again...it will again parse the data and give (Historical == false) everywhere.

    Is this normal behavior?

    What I'm after is trying to match my Account Position to the Strategy Virtual Position by going back 3 Bars and Setting a Long or Short based on an Indicator. This works fine when Historical == true (second run of strategy), but when Historical == false (1st run of strategy)...the strategy executes my "older trade" (using CurrentBar == Bars.Count-2) live(not just keeping it virtual inside the strategy).

    What could be ruining the Historical boolean?

    I am using "immediately submit live working historical orders", "Keep running strategy", "unmanaged approach", strategy is a multi-series with 1 minute and Tick-by-tick data. And, no Syncing Account Position is not enabled...nor do I want to use that option. I have also tried "Wait Until Flat" in the options.

    I know what my position would be in the past simply based off the Indicator.

    Thank you for your help,
    Xraider.

    #2
    Hello Xraider,

    Thank you for your note.

    When you enable the strategy for the 2nd time and say the strategy will not rerun all the past historical data, I am unable to replicate. I produced a video demonstrating this.

    https://www.screencast.com/t/Ydjre6ljCmR

    Would you be able to produce a sample script as well as instructions or a video which demonstrates the behavior you are describing which differs from what I’m seeing?

    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Ok, create this strategy in NT7.

      Code:
      		protected override void Initialize()
      		{
      			Add(PeriodType.Tick,1);
      			CalculateOnBarClose	= false;
      		}
      
      		/// <summary>
      		/// Called on each bar update event (incoming tick).
      		/// </summary>
      		protected override void OnBarUpdate()
      		{
      			if(FirstTickOfBar && BarsInProgress == 0)
      				Print("Historical: " + Historical);
      
      		}
      Close Ninja first, then reopen it. Connect to your price provider. Turn on Strategy in the Control Center. The Output window will show a large list of "Historical: False".
      Turn off the strategy. Turn the strategy back on in the Control Center, you will see a few (far less than 1st run) "Historical: True".

      More testing: Also, if you increase tick period to a high number like 100...meaning Add(PeriodType.Tick,100); Then you see Historical: False even on 2nd run in large amounts (have to reopen Ninja).
      Last edited by Xraider; 02-27-2018, 12:54 PM.

      Comment


        #4
        Hello Xraider,

        I was unable to get false to print.

        Could you please send an email to platformsupport[at]ninjatrader[dot]com with Attn: Alan P in the Subject line. Also within the email please include a link to this thread, and attach the log and trace files for the day in subject which you can find in My Documents>NinjaTrader7>Log and My Documents>NinjaTrader7/Trace folders.

        I look forward to your email.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Ok, Alan. I just sent you the log files and other relevant files. Thank you for your help.

          Comment


            #6
            I think I got it. It seems when you first load a strategy, it is calling for price data. Any data it calls from outside (non saved) it is considering Historical. That's what it looks like to me. Correct me if I'm wrong. That's why the 2nd run of the same strategy, always seems to function fine - it has downloaded the data and marked it historical. (Again, if you restart Ninja or Remove/Add Strategy or Disconnect/Reconnect forcing new data to feed into the strategy...it causes the 1st run to give Historical == false even on data you'd think it had. This is specific to Multi-series inside strategies it seems - especially bad with tick data.).

            So, the solution is to cause the Chart to call the data but also have that data/saved be marked as historical. To achieve this: NinjaTrader Control Center -> Tools -> Options -> Data -> Save Chart as Historical (Checked ON). Then everything appears to function properly, no matter if it's run for the first time or second...as long as the chart has loaded to current time. (chart builds the historical vs non division for us).

            Alan - is this all sounding correct? Particularly the underlined sentence at the top. Is that how Strategies mark their Historical data? Anything downloaded after "start" running = Non-Historical?

            As an aside, this thread seemed to have had the same issue: https://ninjatrader.com/support/foru...ad.php?t=46315

            Though I did try their this.BarsRequired = 0, but with inconsistent improvement. Other threads pointed the issue to Days to Load and not having enough BarsRequired (that would show an index error anyway, easy to spot).

            Thank you. Please confirm if my logic is right here, or this is some weird coincidence.
            Xraider.

            Comment


              #7
              Hello Xraider,

              That would not be correct.

              Attached a screen shot of the strategy you sent which is running as expected.

              I will follow up with you in an email.
              Attached Files
              Alan P.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by darkgreen, Today, 03:35 PM
              0 responses
              6 views
              0 likes
              Last Post darkgreen  
              Started by GTBrooks, Today, 02:44 PM
              2 responses
              13 views
              0 likes
              Last Post GTBrooks  
              Started by GLFX005, Today, 12:22 PM
              4 responses
              41 views
              0 likes
              Last Post NinjaTrader_Kate  
              Started by AspenHiker, Today, 08:37 AM
              1 response
              13 views
              0 likes
              Last Post NinjaTrader_Kate  
              Started by MartinT, Yesterday, 01:12 PM
              3 responses
              17 views
              0 likes
              Last Post MartinT
              by MartinT
               
              Working...
              X