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 TraderG23, 12-08-2023, 07:56 AM
          9 responses
          382 views
          1 like
          Last Post Gavini
          by Gavini
           
          Started by oviejo, Today, 12:28 AM
          0 responses
          1 view
          0 likes
          Last Post oviejo
          by oviejo
           
          Started by pechtri, 06-22-2023, 02:31 AM
          10 responses
          125 views
          0 likes
          Last Post Leeroy_Jenkins  
          Started by judysamnt7, 03-13-2023, 09:11 AM
          4 responses
          59 views
          0 likes
          Last Post DynamicTest  
          Started by ScottWalsh, Yesterday, 06:52 PM
          4 responses
          36 views
          0 likes
          Last Post ScottWalsh  
          Working...
          X