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"?
Comment