Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Data Series question

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

    Data Series question

    I'm trying to understand Data Series Arrays (new to C# programming). I created the indicator using the Data Array tutorial, and it works fine. But, if I change the Open[0] to Open[1] I get nothing in the indicator panel and nothing in the output window (using a Print statement). Here is the line of code I change:

    This one works fine:

    myDataSeries.Set(Close[0] - Open[0]);

    This one doesn't:

    myDataSeries.Set(Close[0] - Open[1]);

    Why doesn't the second one work?

    Thanks

    #2
    Hello Ghoti,

    Likely you are running into the issue described in the post below:

    http://www.ninjatrader-support2.com/...ead.php?t=3170

    In your case you need to add a check at the top of the OnBarUpdate() method:
    Code:
     
    if (CurrentBar < 1)
       return;
    Last edited by NinjaTrader_RyanM1; 03-02-2010, 03:11 PM.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks Ryan,

      I didn't mention, I did do some searching for the cause of this problem before I posted this question. I saw that post, it doesn't apply here. It is a daily chart with 365 days of history.

      Comment


        #4
        Hello Ghoti,

        If you are attempting to access Open[1] but you do not have the CurrentBar check, then that post applies here. Amount of history will not matter as the problem happens when NinjaTrader attempts to access objects that don't exist. When you're looking at the first bar in the series (from the left), Open[1] does not exist.

        Try adding that check and let us know your results.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          I guess I need to read more carefully... That was it.

          Thanks again.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by JTizz, Today, 01:20 PM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by omermirza, Today, 12:39 PM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_Jim  
          Started by mballagan, Today, 01:02 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_Kate  
          Started by larkmail, Today, 12:30 PM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Kate  
          Started by Danila, Today, 11:08 AM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X