• 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

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 Debayan Sen, Today, 01:50 AM
              0 responses
              3 views
              0 likes
              Last Post Debayan Sen  
              Started by eleven, Yesterday, 10:03 PM
              1 response
              9 views
              0 likes
              Last Post eleven
              by eleven
               
              Started by tvbecv, Yesterday, 09:23 PM
              0 responses
              8 views
              0 likes
              Last Post tvbecv
              by tvbecv
               
              Started by reedstickets, Yesterday, 08:07 PM
              0 responses
              9 views
              0 likes
              Last Post reedstickets  
              Started by timko, Yesterday, 07:39 PM
              0 responses
              5 views
              0 likes
              Last Post timko
              by timko
               
              Working...
              X