Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Ignoring x number of bars in middle

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

    Ignoring x number of bars in middle

    Hi ,
    I need help/example for this indicator.

    Sequence:
    Bar C5 ---> C4 ---> x number or bars (small bars compared to c5 and c4) ---> C3-->c2--C1

    x number mean any number 1-10. Can someone post a sample code which will do that ?

    I am not able to figure out how to ignore x number of bars in middle .

    Thanks in advance

    #2
    shashankg27, unfortunately I'm not exactly sure what you're asking here - do you wish to ignore these bars for calculations of indicator values so running on a custom array of values then, where you would not have index for each bar?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi Bertrand,
      X number of bars is random (based on market condition).
      some times it is 2, sometimes 10.

      In that case how to code ?

      Comment


        #4
        for example
        C5 ---> C4 ---> x1 x2 x3 ---> C3-->c2--C1

        C5--->C4 --> x1 x2 --->C3-->c2--c1

        Comment


          #5
          Well, what are you then first of all trying to calculate here? If you want to ignore bars in indicator calcs (like inside bars) then you would need to run on custom lists (more a C# topic).
          BertrandNinjaTrader Customer Service

          Comment


            #6
            yes something like ignoring all inside bars. Any example I can refer to ?

            Comment


              #7
              I would unfortunately not be aware of sample or code shared already for this topic.
              BertrandNinjaTrader Customer Service

              Comment


                #8
                Originally posted by shashankg27 View Post
                yes something like ignoring all inside bars. Any example I can refer to ?
                You simply determine on what condition you will ignore a bar for calculation, and do so. To address the specific example of Inside Bars that you cite:

                Code:
                 
                //We are checking one bar ago, so we need an escape
                if (CurrentBar < 1) return;
                 
                //Is it an inside bar?
                bool IsIgnoreBar = High[0] < High[1] && Low[0] > Low[1];
                 
                //if so, ignore processing for the bar
                if (IsIgnoreBar) return;
                 
                [COLOR=blue]// the rest of the processing goes here.[/COLOR]
                Naturally, you just need to change IgnoreBar to be whatever condition that you want to igore.

                Comment


                  #9
                  Thankyou this is helpful...

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by quantismo, 04-17-2024, 05:13 PM
                  3 responses
                  25 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by ScottWalsh, 04-16-2024, 04:29 PM
                  7 responses
                  34 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by cls71, Today, 04:45 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post cls71
                  by cls71
                   
                  Started by mjairg, 07-20-2023, 11:57 PM
                  3 responses
                  214 views
                  1 like
                  Last Post PaulMohn  
                  Started by TheWhiteDragon, 01-21-2019, 12:44 PM
                  4 responses
                  547 views
                  0 likes
                  Last Post PaulMohn  
                  Working...
                  X