• 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

Dataseries containing selected members of another dataseries

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

    #16
    Hello bkool,

    Thank you for your reply.

    I'm not quite certain what you're trying to achieve here:

    bM1Close = Closes[10][myBarsAgoValue];
    bM2Close = Closes[10][myBarsAgoValue];

    Closes[10][myBarsAgoValue] would give you the Close price of a 10th additional data series at a index equal to the value of myBarsAgo value. Is this intentional?

    Also, CurrentBars[10] would give you the current bar number of the 10th dataseries. I am also unsure if this is intentional.

    Please clarify if possible; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #17
      Hi Kate W.

      thank for your question.
      Everything mentioned above is intentional and works fine.
      What I need is to relate between current & several previous Closes[10] [x] values, as NT works with data series, where x = 0 for the current Close, x= 1 for the previous one, etc.
      So I guess myBarsAgoValue should act as data series holding accessible index values.
      Hope I made my point clear.


      Comment


        #18
        Hello bkool,

        Thank you for your reply.

        Ah, I follow now, I just needed to look back on what we discussed last week.

        CurrentBars[10] is just going to hold the bar number of the most recent bar in the 10th data series, so that's why it prints out the same every time you loop through the loop - you haven't gone to a different bar yet.

        So, trueBarIndexes already is holding the bar number of each bar for which either signal 1 or signal 2 was true. So let's say I want to access the close of the 5th time ago that this was true and compare it to the close of the 10th time ago that this was true.

        I could do something like this:

        if(Closes[10][CurrentBars[10] - trueBarIndexes[4] ] > Closes[10][CurrentBars[10] - trueBarIndexes[9]])
        {
        //do something here
        }

        Please let us know if we may be of further assistance to you.

        Kate W.NinjaTrader Customer Service

        Comment


          #19
          Thanks Kate W.
          Yes, this is the type of relations I'm looking for. it seems that since trueBarIndex is holding all the correct values, it just needs proper indexing...

          best.

          Comment


            #20
            Hello Kate w.

            Could you please suggest a way to solve that ?

            Comment


              #21
              Hello bkool,

              Thank you for your reply.

              I'm not sure what you are referring to solving. This previous post below already demonstrated how you can retrieve the values you seek for each bar for which either signal 1 or signal 2 was true. Please clarify.

              Originally posted by NinjaTrader_Kate View Post
              Hello bkool,

              Thank you for your reply.

              Ah, I follow now, I just needed to look back on what we discussed last week.

              CurrentBars[10] is just going to hold the bar number of the most recent bar in the 10th data series, so that's why it prints out the same every time you loop through the loop - you haven't gone to a different bar yet.

              So, trueBarIndexes already is holding the bar number of each bar for which either signal 1 or signal 2 was true. So let's say I want to access the close of the 5th time ago that this was true and compare it to the close of the 10th time ago that this was true.

              I could do something like this:

              if(Closes[10][CurrentBars[10] - trueBarIndexes[4] ] > Closes[10][CurrentBars[10] - trueBarIndexes[9]])
              {
              //do something here
              }

              Please let us know if we may be of further assistance to you.
              Kate W.NinjaTrader Customer Service

              Comment


                #22
                Hello Kate W.,

                Sorry, I couldn't have the above solution working for me.
                I always get an error message: "You are accessing an index with a value that is invalid since its out of range".
                Could you please show me the code used for testing so I can reproduce this ?

                Thanks, bkool
                Last edited by bkool; 07-14-2019, 01:22 AM.

                Comment


                  #23
                  Hello bkool,

                  Thank you for your reply.

                  The error you're receiving is due to trying to access something in one of those arrays that doesn't exist (the index is out of range). I think you're probably running into issues with having multiple data series. Are you adding items to the trueBarIndexes list from all of the data series? If so, you could well be trying to access a bar number that doesn't exist for a certain bar series because it was added when another bar series was processing. Can you provide a reduced version of your strategy that illustrates the behavior you're seeing?

                  Thanks in advance; I look forward to assisting you further.
                  Kate W.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by stevenev1, Today, 01:43 PM
                  0 responses
                  5 views
                  0 likes
                  Last Post stevenev1  
                  Started by shinuvu, Today, 11:05 AM
                  2 responses
                  12 views
                  0 likes
                  Last Post shinuvu
                  by shinuvu
                   
                  Started by Hagar, Yesterday, 07:12 PM
                  1 response
                  14 views
                  0 likes
                  Last Post NinjaTrader_ChrisL  
                  Started by PBreen, Today, 11:59 AM
                  1 response
                  8 views
                  0 likes
                  Last Post NinjaTrader_ShawnB  
                  Started by johnnybegoode, 01-14-2019, 07:24 PM
                  13 responses
                  548 views
                  0 likes
                  Last Post seeseea
                  by seeseea
                   
                  Working...
                  X