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:



    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:
      [FONT=Courier New]
      protected override void OnBarUpdate()
      {
          int largestLookback = 50;
          foreach (int i in CurrentBars)
          {
              if (i < largestLookback)
              {
                  return;
              }
          }
      
          // the rest of your OnBarUpdate code here
      }[/FONT]
      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:



        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:

            Comment


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

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by DanielSanMartin, Yesterday, 02:37 PM
              2 responses
              13 views
              0 likes
              Last Post DanielSanMartin  
              Started by DJ888, 04-16-2024, 06:09 PM
              4 responses
              12 views
              0 likes
              Last Post DJ888
              by DJ888
               
              Started by terofs, Today, 04:18 PM
              0 responses
              11 views
              0 likes
              Last Post terofs
              by terofs
               
              Started by nandhumca, Today, 03:41 PM
              0 responses
              8 views
              0 likes
              Last Post nandhumca  
              Started by The_Sec, Today, 03:37 PM
              0 responses
              6 views
              0 likes
              Last Post The_Sec
              by The_Sec
               
              Working...
              X