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

Want script to run to end of displayed data (only!)?

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

    Want script to run to end of displayed data (only!)?

    Hi,

    I am developing an indicator using NT7-64 bit and Visual Studio 2010. It's a dream environment, however I am experiencing a variation in how many bars a script runs.

    When an active connection is established to a data provider and you reload a script, the script always runs to the last bar of data, which would be the current data bar in current time since a connection is established. So even if the last data bar (most recent) is not displayed on the chart (because, say, you have scrolled the chart to the left), the script will still run until the last data bar.

    For debugging a script, this is not ideal. If I have identified a problem in the middle of the data on the chart, what I want is for the script to stop just before that bar; then I can set a break point and when the script continues, the breakpoint will fire. To achieve this, I noticed that if a script is reloaded when the chart is not connected to a data provider, the script will only run until the end of the last bar displayed on the chart. Then the script will run for each subsequent bar as you scroll the chart to the right, revealing more bars. This is perfect for debugging!

    For the last month that I have used Visual Studio with NT7, scripts would only run to the last data bar actually displayed in the chart window, which as I described is perfect. Today, for some reason, even though the chart is not connected to the data provider, the script always runs to the end of the complete set of data (beyond what is displayed on the chart). This makes it difficult to debug a problem that occurs in the middle of the data sequence (you need to do unproductive and time consuming things like insert code for the system to break where you want, like:

    if (Low [0] == 1202.25 && dtime == whatevertime) {
    k = 0; //break point is set here
    }

    Based on observed behaviour, I always thought that whether the chart was connected to a provider determined whether the script ran until the last bar displayed on the chart or the last bar of data in the data sequence. However, for some reason this is no longer the case when I tried to debug today.

    So my question is, "How do I consistently load a script so that it runs only to the last data bar displayed on the chart"?
    Last edited by doctore; 06-08-2011, 07:04 PM.

    #2
    doctore, what did change in your setup then that changed this behavior seen, were you adding perhaps a series to the script so it became a MultiSeries one? Did you upgrade to a different build version of NT7?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Previously, I was trying to find out why when I compiled a script successfully, it no longer showed up in the list of chart indicators...see my post from the previous day on that, including the answer. During that process, I tried everything I could think of, including reinstalling NT7.

      After the fresh install of NT7 during the resolution of the previous day's problem, I cannot remember if I tried to debug something and the script would stop at the last displayed bar when not connected...I can only remember that, what seemed like all of a sudden, it ran until the end of the data and I then thought..."what's up with that?"

      How is it supposed to work...I mean what is the 'correct' behaviour in terms of how many bars a script executes, and what are the conditions to return to having the script run only until the last displayed bar (when no data provider connection present)?

      Thanks for your help on this...debugging is ten times harder when you cannot get the script to stop at the end of the displayed data. Also, when the script has stopped at the end of the displayed data, it's super convenient that it runs on subsequent bars, one by one, as each is displayed...this is really perfect behaviour. I hope we can get this back!

      Comment


        #4
        BTW, I am running NT7 64-bit 7.01000.6 on Windows 7.

        Comment


          #5
          Depends. Is that a Strategy or an Indicator?

          Comment


            #6
            It's an indicator.

            Comment


              #7
              If you're not connected live, a single series indicator script should process only the displayed bars up to the scrolled to position, if you then scroll further it would process the new ones made available.
              BertrandNinjaTrader Customer Service

              Comment


                #8
                I had recently added a second series, so that was the problem....thank you.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by trilliantrader, 04-18-2024, 08:16 AM
                4 responses
                18 views
                0 likes
                Last Post trilliantrader  
                Started by mgco4you, Today, 09:46 PM
                1 response
                10 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by wzgy0920, Today, 09:53 PM
                0 responses
                10 views
                0 likes
                Last Post wzgy0920  
                Started by Rapine Heihei, Today, 08:19 PM
                1 response
                10 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by Rapine Heihei, Today, 08:25 PM
                0 responses
                10 views
                0 likes
                Last Post Rapine Heihei  
                Working...
                X