Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Counting UpBars, DownBars, and NilBars

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

    Counting UpBars, DownBars, and NilBars

    Being a complete newbie at programming, I have occasionally hired a consultant to assist me, and now I would like to have a little tool to help me trade.
    I look in the downloads and Indicator forums, but dont see anything quite what I need.

    I hope there are some suggestions on how to best accomplish this in NTScript.

    Basically I am trying to count back from the last drawn bar, until the goal of having equal # of Up bars and Down bars is reached, and then display the values of the # of bars that covers: eventually I would like to be able to have the value sent to an indicator (such as the # of periods field for a moving average). A box drawn including all the bars would be a great assist.

    Up bars have close > open
    Down bars have close < open
    Nil bars have open = close

    # of bars covered would be Up bars + Down bars + Nil bars

    I am sure this is likely a simple thing to do in NTScript. I have done a little scripting in FDC, hope I can pickup the C# as I explore further.

    Thanks very much in advance,
    TJ

    #2
    Hi TJ, before starting to code you full custom tool for this, I would suggest looking into our Swing indicator and the methods it offers, for example returning the number of bars ago a swing high or low was found -

    Comment


      #3
      Hi Bertrand,

      Thanks for your interest and suggestion.

      Taking a stab at this, I am thinking a double nested 'if else' statement for barsago and the condition of the count #Upbars until it equals the #Downbars?

      TJ

      Comment


        #4
        If I understood what you look for this would be a good first step, generally I guess you would look for an avg swing length as input to make indicator length adaptive as new swings are formed...for this you can also check into John Ehlers cycle work, suitable indicators are in the sharing.

        Comment


          #5
          How could you find the average swing length?

          Comment


            #6
            Originally posted by brucelevy View Post
            How could you find the average swing length?
            Stick them in a list and find the average of the List.

            It is pretty much what we are doing here when I responded when you asked the same question.

            ref: http://ninjatrader.com/support/forum...ighlight=swing

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            558 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            324 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            545 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            547 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X