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 Hwop38, 05-04-2026, 07:02 PM
            0 responses
            164 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Started by CaptainJack, 04-24-2026, 11:07 PM
            0 responses
            319 views
            0 likes
            Last Post CaptainJack  
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            246 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            350 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            179 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Working...
            X