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

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 -
    BertrandNinjaTrader Customer Service

    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.
        BertrandNinjaTrader Customer Service

        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 Mizzouman1, Today, 07:35 AM
            4 responses
            18 views
            0 likes
            Last Post Mizzouman1  
            Started by philmg, Today, 01:17 PM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_ChristopherJ  
            Started by cre8able, Today, 01:01 PM
            1 response
            6 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by manitshah915, Today, 12:59 PM
            1 response
            3 views
            0 likes
            Last Post NinjaTrader_Erick  
            Started by ursavent, Today, 12:54 PM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X