Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CurrentBar[1]?

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

    CurrentBar[1]?

    Howdy--

    This is probably a softball question (at least I hope it is), but when you call "CurrentBar", the current bars int value is returned (i.e., first bar on chart is 0 and next is 1 and next is 2 etc).

    If I wanted to call the previous bar number, is "CurrentBar[1]" the correct way to do that?

    For instance, I am trying to record the previous bar into a list. Therefore, would my code be something like this:

    listSignalBar.Add(CurrentBar[1]);

    or something like this:

    listSignalBar.Add(CurrentBar - 1);


    Thanks,

    Aventeren
    Last edited by aventeren; 11-27-2013, 12:26 PM.

    #2
    Hello Aventeren,

    If you want to get the previous bars values you would use something like "Close[1]", "Open[1]", etc... depending on what price data you are looking for. Here is a few other examples of this that you may view.



    For the bar number itself you may just subtract 1 from the CurrentBar to get this.

    Let me know if you have any questions.
    JCNinjaTrader Customer Service

    Comment


      #3
      Cool, so in my context, I would use:

      listSignalBar.Add(CurrentBar - 1);

      Correct?

      Comment


        #4
        Hello Aventeren,

        Yes, that is correct.
        JCNinjaTrader Customer Service

        Comment


          #5
          Thanks for the quick response, JC.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Jonker, Today, 01:19 PM
          0 responses
          1 view
          0 likes
          Last Post Jonker
          by Jonker
           
          Started by futtrader, Today, 01:16 PM
          0 responses
          5 views
          0 likes
          Last Post futtrader  
          Started by Segwin, 05-07-2018, 02:15 PM
          14 responses
          1,790 views
          0 likes
          Last Post aligator  
          Started by Jimmyk, 01-26-2018, 05:19 AM
          6 responses
          838 views
          0 likes
          Last Post emuns
          by emuns
           
          Started by jxs_xrj, 01-12-2020, 09:49 AM
          6 responses
          3,294 views
          1 like
          Last Post jgualdronc  
          Working...
          X