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

Bar Range

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

    Bar Range

    I'd like to have suggestions to do the following:

    1. state if bar range is > 6 ticks(ES tick .25)
    2. state if close is > midpoint of bar range.
    3. have a sample paint bar to model the conditions for up/down color.

    I have a sample indicator for dots that I'm working with and would like to convert it to
    paint bars.

    Is there a NT7 resource with sample code snippets?

    My first post in forum.

    Thanks

    #2
    Hello rronzz,

    Thanks for your post and welcome to the forums!

    You can use the Range() method to obtain the High[0] - Low[0], see the helpguide: http://ninjatrader.com/support/helpG...nt7/?range.htm

    For the mid point check you could doing something like:

    if (Close[0] > (Range()[0] / 2 + Low[0]) // cuts candle in half and add to low to check against the close
    {
    // do something
    }


    To change the barcolor you would use BarColor, see the helpguide for examples: http://ninjatrader.com/support/helpG.../?barcolor.htm

    I would advise walking through the helpguide starting at the alphabetical Ninjascript Index: http://ninjatrader.com/support/helpG..._reference.htm

    In addition you might review the examples found here: http://ninjatrader.com/support/forum...splay.php?f=30

    and finally, the tips here: http://ninjatrader.com/support/forum...splay.php?f=31
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thanks Paul.

      Is there a simple paintbar indicator that I can download and model/change the conditions as needed, I'm not sure about uses of where, when and if necessary "classes", "public and private" "variables" etc.

      I tried using the indicator wizard and couldn't seem to create a shell for the paintbar indicator, could not find a tutorial with samples to enter in the different fields.

      Regards

      Comment


        #4
        Hi rronzz,

        I've created an example for you that you are welcome to change as you see fit that demonstrates changing bar colors and shows panel colors as well.

        Painting bars is pretty straight forward.


        Here is a basic guideline of how to Import NinjaScripts.

        To import NinjaScripts you will need the original .zip file.

        To Import

        Download the NinjaScripts to your desktop, keep them in the compressed .zip file.

        From the Control Center window select the menu File> Utilities> Import NinjaScript

        Select the downloaded .zip file

        NinjaTrader will then confirm if the import has been successful.
        Critical - Specifically for some NinjaScripts, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'

        Once installed, you may add the indicator to a chart by:

        Right click you chart > indicators > Select the Indicator from the list on the left > New > OK
        Attached Files
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          SMA of Range()

          Hi,
          if I just copy and paste the following code - taken from NT7 help guide - into my strategy, where I need to calculate the SMA of the last bar ranges, I get a compiling error

          double value = SMA(Range(), 20)[0];

          Could you please advice about how to write this correctly?
          thank you
          Martin

          Comment


            #6
            Originally posted by marticora View Post
            Hi,
            if I just copy and paste the following code - taken from NT7 help guide - into my strategy, where I need to calculate the SMA of the last bar ranges, I get a compiling error

            double value = SMA(Range(), 20)[0];

            Could you please advice about how to write this correctly?
            thank you
            Martin
            Code:
            double value = SMA(Range, 20)[0];

            Comment


              #7
              Hi, thanks for the reply but unfortunately also

              double value = SMA(Range, 20)[0];

              does not work. NT7 compiler gives an error.
              Any other possible solution? Thank you in advance

              Comment


                #8
                sorry.. I really apologize..
                double value = SMA(Range(), 20)[0]; works well. I did another mistake...

                Comment


                  #9
                  Hello,

                  Is there a new or updated version for NT8 of the NinjaScript addon referenced above "paintbars" that will automatically plot midpoints (or other points) on bars that have closed?

                  I downloaded the zip but it said it is for an older version of NT.

                  Thank you.

                  Comment


                    #10
                    Hello pchurch,

                    Thanks for your post and welcome to the Ninjatrader forums!

                    The indicator posted in Post #4 does not plot midpoints, its only purpose is to paint the bars a different color depending on if they are up or down bars or color the background if a doji bar. It is provided as a NinjaTrader7 educational reference.

                    There is an NT8 indicator that does plot midpoints called Candle Quarters and is available in the NT user App section of the NinjaTrader Ecosystem. It also plots the high quarter, low Quarter and pivotpoint of the candle. These other plots can be turned off by setting the color to Transparent if you wish

                    This indicator is publicly available on our NinjaTrader Ecosystem website:Here is a basic guideline of how to import NinjaScript add-ons in NinjaTrader 8:

                    Note — To import NinjaScripts you will need the original .zip file.

                    To Import (NINJATRADER8 only):
                    1. Download the NinjaScripts to your desktop, keep them in the compressed .zip file.
                    2. From the Control Center window select the menu Tools > Import > NinjaScript Add-on...
                    3. Select the downloaded .zip file
                    4. NinjaTrader will then confirm if the import has been successful.

                    Critical - Specifically for some NinjaScripts, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'

                    Once installed, you may add the indicator to a chart by:
                    • Right-click your chart > Indicators... > Select the Indicator from the 'Available' list on the left > Add > OK

                    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
                    Paul H.NinjaTrader Customer Service

                    Comment


                      #11
                      Thanks Paul!
                      One follow-up question - will this work with OHLC bars, or only with Candlestick Bars?

                      -pchurch

                      Comment


                        #12
                        Hello pchurch,

                        Thanks for your reply.

                        It will draw the dots and cross regardless of the display type bar.

                        Please note that this is the NinjaTrader7 forum so if you have further questions please create a new topic in the NinjaTrader8 forum section.

                        Thanks for your understanding.
                        Last edited by NinjaTrader_PaulH; 08-03-2021, 07:40 AM.
                        Paul H.NinjaTrader Customer Service

                        Comment


                          #13
                          Got it - and it worked - thank you!

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by bmartz, 03-12-2024, 06:12 AM
                          4 responses
                          31 views
                          0 likes
                          Last Post bmartz
                          by bmartz
                           
                          Started by Aviram Y, Today, 05:29 AM
                          4 responses
                          12 views
                          0 likes
                          Last Post Aviram Y  
                          Started by algospoke, 04-17-2024, 06:40 PM
                          3 responses
                          28 views
                          0 likes
                          Last Post NinjaTrader_Jesse  
                          Started by gentlebenthebear, Today, 01:30 AM
                          1 response
                          8 views
                          0 likes
                          Last Post NinjaTrader_Jesse  
                          Started by cls71, Today, 04:45 AM
                          1 response
                          7 views
                          0 likes
                          Last Post NinjaTrader_ChelseaB  
                          Working...
                          X