Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

(CurrentBar == 0)

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

    (CurrentBar == 0)

    Hallo,

    What does (CurrentBar == 0) mean?. In the MACD indicator, it says:

    if (CurrentBar == 0)
    {
    fastEma.Set(Input[0]);
    slowEma.Set(Input[0]);
    }

    I though the CurrentBar index started from 1.

    /Juan Rivera

    #2
    >> I though the CurrentBar index started from 1
    Incorrect, starts at 0.

    Comment


      #3
      But in The NinjaTrader Help it says_
      CurrentBar
      Definition
      A number representing the current bar in a Bars object that the OnBarUpdate() method in an indicator, Market Analyzer column or strategy is currently
      processing. For example, if a chart has 100 bars of data, the very first bar of the chart (left most bar) will be number 1 (one) and each subsequent bar from
      left to right is incremented by 1.

      I am getting confused with something here: In the MACD, when it says:
      if (CurrentBar == 0)
      Is it refering to th every first bar of the chart, or is it refering to the last bar available (the very last bar)??


      Comment


        #4
        Not sure which docs you are looking at. I have latest 6.5.1000.2 installed and see this: http://www.ninjatrader-support.com/H...urrentBar.html

        Comment


          #5
          Ok, I see. there was a mistake in the older version of the Help.

          Talking about mistakes, in the tutorial Level 4 for indicators, when entering the Calculation Logic and it says:

          // Calculate the range of the current bar and set the value
          Plot0.Set(SMA(SMAPeriod)[0] + myDataSeries[0]);

          is that expression correct??

          Thanks!

          Comment


            #6
            What's wrong there?

            Comment


              #7
              Should it not be?

              Plot0.Set(SMA(myDataSeries,SMAPeriod)[0];

              Comment


                #8
                Not sure I follow. Statement below is syntactically incorrect.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by GussJ, 03-04-2020, 03:11 PM
                15 responses
                3,271 views
                0 likes
                Last Post xiinteractive  
                Started by Tim-c, Today, 02:10 PM
                1 response
                8 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by Taddypole, Today, 02:47 PM
                0 responses
                2 views
                0 likes
                Last Post Taddypole  
                Started by chbruno, 04-24-2024, 04:10 PM
                4 responses
                51 views
                0 likes
                Last Post chbruno
                by chbruno
                 
                Started by TraderG23, 12-08-2023, 07:56 AM
                10 responses
                403 views
                1 like
                Last Post beobast
                by beobast
                 
                Working...
                X