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

Mean of the High line plot

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

    Mean of the High line plot

    Im sure this is terribly simple, I was thinking it would probably be easiest just to use the bollinger band code and alter it. Looking to plot the mean of the high and the mean of the low and then plot 1 standard deviation from each line.

    So I assume I can just replace the SMA part in the BBand code with whatever the code is for the mean of the high and the low.

    #2
    Yes Zachj, you would basically have two means and Stddev values (based on high / low prices) then from which to compute Upper / Lower levels.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      What i was seeking is the actual code line for the mean of the high and the mean of the low. Is it something like..

      Mean data series high

      Comment


        #4
        You would need to supply the desired input series to the SMA calculating the mean then, per default it would use the close prices. So for example SMA(High, 20)
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Ok that was really simple, just added High to the smaValue code line. It calculates the High mean correctly. But the standard deviation is off which I can see from checking in an Excel spreadsheet. I even checked the custom NT Bollinger band indicator, its not calculating 1 Standard Deviation correctly. Its less than 1 its something like .82 of a StdDev.

          You can check it for yourself, just take any two day period and check 1 StdDev of the 2 closes. As an example..
          Nasdaq Composite index:
          last wed close 3196.88
          last thrsdy close 3198.66
          mean is 3197.77

          StDev(3196.88; 3198.66) =1.2586

          Upper band should then equal the mean + 1StDev or 3197.77 + 1.2586 = 3199.0286
          But ninja trader shows 3198.66
          Last edited by zachj; 02-18-2013, 11:55 AM.

          Comment


            #6
            I tested this on my end and get the correct results when simply printing the Standard Deviation of two values.

            Could you post your code and your expected result so that we may examine further.

            Additionally please ensure you're storing the value as a double and not as an int.
            LanceNinjaTrader Customer Service

            Comment


              #7
              I just edited my previous post below with an example on Nasdaq. And Im just using the custom BBand indicator in ninja trader.
              Last edited by zachj; 02-18-2013, 11:59 AM.

              Comment


                #8
                Originally posted by zachj View Post
                Nasdaq Composite index:
                last wed close 3196.88
                last thrsdy close 3198.66
                mean is 3197.77

                StDev(3196.88; 3198.66) =1.2586

                Upper band should then equal the mean + 1StDev or 3197.77 + 1.2586 = 3199.0286
                But ninja trader shows 3198.66
                The StdDev() will get the population standard dev which in this example is equal to .89

                You would have to code your own function if you wished to use the basic standard deviation value

                For a good StdDev calculator along with a detailed tutorial on the math behind it: http://easycalculation.com/statistic...-deviation.php

                Please let me know if I can be of further assistance.
                LanceNinjaTrader Customer Service

                Comment


                  #9
                  Oh ok gotcha, thanks for clearing that up.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by kevinenergy, 02-17-2023, 12:42 PM
                  118 responses
                  2,778 views
                  1 like
                  Last Post kevinenergy  
                  Started by briansaul, Today, 05:31 AM
                  0 responses
                  9 views
                  0 likes
                  Last Post briansaul  
                  Started by traderqz, Yesterday, 12:06 AM
                  11 responses
                  28 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by PaulMohn, Today, 03:49 AM
                  0 responses
                  8 views
                  0 likes
                  Last Post PaulMohn  
                  Started by inanazsocial, Today, 01:15 AM
                  1 response
                  10 views
                  0 likes
                  Last Post NinjaTrader_Jason  
                  Working...
                  X