Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

exact bar or within x-bars

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

    exact bar or within x-bars

    Hello,

    I want to ask since I can´t systematize which indicators with "Bars ago" refer to that exact number in [ ] and which indicators mean "within" [x] numbers of bars.

    How do I recognize for coding and debugging wich indicators eg with [3] mean that exactly the one bar (3 bars ago) and which indicators mean that within last 3 bars?

    Thanks
    Tony

    #2
    Hi Tony, the index would be always tied to bars, so it would depend on the series used how much time back it would refer to (3 x 1 minute bars, or 3 x 7 minute bars...). The CrossAbove / CrossBelow for example would have a lookback parameter, which means the condition monitored has occured within the last x bars, so this is a different concept from the bars index.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi Bertrand,

      thank you for your prompt reply. I know that the lookback perios [3] is 3x1 minute bars if there is used 1 minute bars, and 3x5minute bars if there is used 5min bars, and 3x5range bars if used 5range bars.... This is the lookback period of course, and in the sample crossabove/crossbelow its within of course.

      But there are indicators where eg [3] doesn´t mean "within" but it means more like "exactly" that bar 3 bars ago.

      So, how to know the system of the indictators in NinjaTrader and which indicator means "within" [x] and which one means "exactly" that [x]?

      Thanks
      Tony

      Comment


        #4
        Hi Tony, can you give me an exmaple : which indicator(s) are you referring to?

        For example RSI(Typical, 14, 3)[3] refers to the RSI value from exactly 3 bars ago.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Hi Bertrand,

          thanks again for your prompt reply. Mhm, there is some misunderstanding - maybe on my end.

          You gave an example right here with RSI. We know now that crossabove means within and beside RSI its exactly but how with all the others, how do I understand which one it is?

          What about this example:

          Stochastics(BarsArray[1], 3,5,2).D[3] < 70

          does this mean

          a.) D < 70 within last 3 bars or
          b.) D < 70 exactly 3 bars ago

          and beside this does it mean
          c.) 3 bars of BarsArray[1] or 3 bars "basic array"?

          OR

          MACD (4,5,13) [2] >= MACD(4,5,13).Avg [2] means

          a.) MACD >= Avg within last 2 bars or
          b.) MACD >= Avg exactly 2 bars ago

          How do I know which one of the indicators mean within or exactly as you showed that there is crossabove meaning within but RSI meaning exactly. How to recognize the system which....

          Thanks
          Tony

          Comment


            #6
            The general difference is lookback period vs bars ago, bars ago really means : exactly x bars ago as in your example cases cited. For the bars index it would be important to know in which BarsInProgress context it's called.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              I have a similar question, i.e.: I need to calculate a condition but only within a given number of bars.

              For example,whether the High of the current bar is equal to any of the previous 10 bars (but not more than 10).

              I'm new with NinjaScript but this should be relatively easy to achieve.

              Please could you advise?

              Many thanks

              Comment


                #8
                Originally posted by ntuser2017 View Post
                I have a similar question, i.e.: I need to calculate a condition but only within a given number of bars.

                For example,whether the High of the current bar is equal to any of the previous 10 bars (but not more than 10).

                I'm new with NinjaScript but this should be relatively easy to achieve.

                Please could you advise?

                Many thanks
                Code:
                if (High[0] == MAX(High, 10)[1]) {//do it}
                ref: http://ninjatrader.com/support/helpG...aximum_max.htm
                Last edited by koganam; 01-31-2017, 05:29 PM. Reason: Corrected number of previous bars to scan.

                Comment


                  #9
                  Originally posted by koganam View Post
                  Code:
                  if (High[0] == MAX(High, 9)[1]) {//do it}
                  ref: http://ninjatrader.com/support/helpG...aximum_max.htm
                  Many thanks koganam. I will try it.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Barry Milan, Today, 10:35 PM
                  1 response
                  7 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by WeyldFalcon, 12-10-2020, 06:48 PM
                  14 responses
                  1,428 views
                  0 likes
                  Last Post Handclap0241  
                  Started by DJ888, Yesterday, 06:09 PM
                  2 responses
                  9 views
                  0 likes
                  Last Post DJ888
                  by DJ888
                   
                  Started by jeronymite, 04-12-2024, 04:26 PM
                  3 responses
                  40 views
                  0 likes
                  Last Post jeronymite  
                  Started by bill2023, Today, 08:51 AM
                  2 responses
                  16 views
                  0 likes
                  Last Post bill2023  
                  Working...
                  X