Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

current bar - multiple dataseries

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

    current bar - multiple dataseries

    Hello,

    I couldnt find in the forum a solution for my problem when working with multiple dataseries and working with currentbar, How can one refer to the current bar of each dataseries.

    Eg when RSI [BarsArray5] crossbelow 20 then I store the barnumber with "crossbar = CurrentBar". Then I have "period=CurrentBar- crossbar" so that I can use it with if(Lows[2][0]<= MIN (Lows[5],"period")[1].

    I have 2 questions/problems:

    * because of working with multiple dataseries I have in onbarupdate if(Historical) return;. Which bar is then the Currentbar? Or what do I have to do for having the currentbar of a certain dataseries, eg [5] with the cross.

    * another way: how can I store the time of the RSI cross to get the period (number of bars of that period) then with "currentime-time_of_RSIcross" and to use this for the period in the MIN-indicator? but maybe this is more difficult to do then the first question(?)

    Thank you
    Tony
    Last edited by tonynt; 08-09-2016, 12:41 AM. Reason: clearifying, translation error

    #2
    Hello,
    You can access a certain CurrentBar value of a data series when working with multiple data series by using CurrentBars[int barSeriesIndex]. Please see the following link for more information on CurrentBars: http://ninjatrader.com/support/helpG...urrentbars.htm

    You could get the time of an added dataseries value by using Times[int barSeriesIndex][int barsAgo], but it does sound like using CurrentBars instead would be easier to implement into your current code.

    If we can be of any other assistance please let us know.
    Cody B.NinjaTrader Customer Service

    Comment


      #3
      Hello,

      thank you for your reply. I´m still getting messages in log tab ("You are accessing an index with a value that is invalid since its out of range.")

      Please let me give a short example: when I have in my script if(Historical) return! and a condition like "&& MIN(Lows[2],3)[0]<= MIN (Lows[8],8)[0]"

      do I have then to substitute "if(Historical)return;" by
      if (Historical || CurrentBars[1]<1 || CurrentBars[2]<1 || CurrentBars[3]<1 || CurrentBars[4]<1
      || CurrentBars[5]<1 || CurrentBars[6]<1 || CurrentBars[7]<1 || CurrentBars[8]<1)
      return;

      Thank you!
      Tony
      Last edited by tonynt; 09-01-2016, 12:44 AM. Reason: Typing error

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by gbourque, Today, 06:39 AM
      2 responses
      14 views
      0 likes
      Last Post gbourque  
      Started by rexsole, Today, 08:39 AM
      0 responses
      4 views
      0 likes
      Last Post rexsole
      by rexsole
       
      Started by trilliantrader, Yesterday, 03:01 PM
      3 responses
      30 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by cmtjoancolmenero, Yesterday, 03:58 PM
      4 responses
      26 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by Brevo, Today, 01:45 AM
      1 response
      14 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X