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

Strategy works on displayed data, but not tick-by-tick

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

    Strategy works on displayed data, but not tick-by-tick

    Hello again. I am writing a strategy to recognize shaved bars. When I run the strategy and run historic data, down to the second, the strategy never kicks in. However, if I stop the data, kill and restart the strategy on the exact same chart, then the strategy successfully implements. That is, the strategy is successful to data that's already displayed, but not to the tick-by-tick historic replay.

    In my screen shots, you can see what happens when I replay the historic data by the second, with the strategy turned on - nothing. I then paused, kill the strategy, restart it, and then the strategy is apparently working.

    Thanks again.
    Attached Files

    #2
    BTW, I believe this issue is related to my last question as well:

    http://ninjatrader.com/support/forum...ad.php?t=95893

    When I replay a strategy on historic data, tick-by-tick or bar-by-bar, the strategy never kicks in, so I never hear the sound.

    Comment


      #3
      Hello timmbbo, and thank you for your question. From your description, it sounds like we are not ensuring there are enough bars on your chart to be able to run your scripts. Please add code like this to the beginning of OnBarUpdate. Please let us know if there are any other ways we can help.

      Code:
      
      protected override void OnBarUpdate()
      {
          int largestLookback = 50;
          foreach (int i in CurrentBars)
          {
              if (i < largestLookback)
              {
                  return;
              }
          }
      
          // the rest of your OnBarUpdate code here
      }
      Jessica P.NinjaTrader Customer Service

      Comment


        #4
        I'm still having this same issue. I just recorded this screen session to better communicate this issue:

        https://youtu.be/VY5Wnq-pbIg

        Your thoughts?

        Comment


          #5
          Thank you for this additional information.

          It will be easier to answer questions about strategies not producing expected results if we could answer as many of the following questions as possible. Could you take a few minutes to review these questions? I am happy to explain further any of the below questions and the rationale behind asking them.


          • Do you see expected results when running the same test environment on the SampleMaCrossOver strategy in NinjaTrader with a 3 and 14 period?
            • By expected results, I mean that the SampleMACrossover places trades whenever a 3 and 14 period SMA cross
          • Who are you connected to? This is displayed in green on lower left corner of the Control Center window.
          • Are you connected to your data feed provider when running this test?
          • What instrument(s) (and expiry if applicable) have you selected?
          • What Data Series Type have you selected? Example: Tick, Minute, Day
          • What From and To date is selected?
          • Is your strategy a multi instrument or multi time frame strategy?
          • Do you receive an error on screen? Are there errors on the Log tab of the Control Center? If so, what do these errors report?
          Jessica P.NinjaTrader Customer Service

          Comment


            #6
            Here's my video, responding to all questions:

            https://youtu.be/fHbaw6JHnh8

            Comment


              #7
              I've resolve this issue. Go ahead and close out. Thanks,

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by rtwave, Today, 01:49 PM
              0 responses
              2 views
              0 likes
              Last Post rtwave
              by rtwave
               
              Started by papaoutai, Today, 08:56 AM
              0 responses
              18 views
              0 likes
              Last Post papaoutai  
              Started by jdspwe, Today, 05:22 AM
              0 responses
              13 views
              0 likes
              Last Post jdspwe
              by jdspwe
               
              Started by JeremuFemstu, Today, 04:49 AM
              0 responses
              15 views
              0 likes
              Last Post JeremuFemstu  
              Started by pjsmith, Today, 04:11 AM
              1 response
              19 views
              0 likes
              Last Post Green Lobster CBD  
              Working...
              X