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

Taking out outliers

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

    Taking out outliers

    Hello, Support and All,

    How to take out the 'outliers' from calculation?'Outliers' are just the bars with the bigger range.So,using example of 20 period SMA,which has 15 bars of 20-30 points in range and 5 bars with the 80-100 points in range.So,how to exclude those 5 bars from calculation programmatically?

    Thx

    #2
    p.s. maybe there`s something already written that does so?

    Comment


      #3
      Originally posted by outsource View Post
      Hello, Support and All,

      How to take out the 'outliers' from calculation?'Outliers' are just the bars with the bigger range.So,using example of 20 period SMA,which has 15 bars of 20-30 points in range and 5 bars with the 80-100 points in range.So,how to exclude those 5 bars from calculation programmatically?

      Thx
      In a distribution that is not Gaussian (and even if it is), and has wide dispersion, the median is a better measure of the average than the mean, precisely because, by definition, it ignores outliers. Consider writing your code to use the median as the average instead of the mean.

      Comment


        #4
        Originally posted by koganam View Post
        In a distribution that is not Gaussian (and even if it is), and has wide dispersion, the median is a better measure of the average than the mean, precisely because, by definition, it ignores outliers. Consider writing your code to use the median as the average instead of the mean.
        Thank you.

        I use the study that does use the median,and yet it still accounts for the outliers and 'distorts' the whole picture.Median could be used to monitor on a bar by bar basis only,i think.But it`s not the fractal i want to operate. So,i thought it would be great to exclude them completely.
        Last edited by outsource; 09-19-2015, 08:39 PM.

        Comment


          #5
          Originally posted by outsource View Post
          Thank you.

          I use the study that does use the median,and yet it still accounts for the outliers and 'distorts' the whole picture.Median could be used to monitor on a bar by bar basis only,i think.But it`s not the fractal i want to operate. So,i thought it would be great to exclude them completely.
          koganam has given the correct answer. The median does not take into account outliers.

          Applied to your original question with 15 "normal range" and 5 "wide range" bars:

          If you calculate the median range it will not take into account the wide ranging bars at all. It will simply produce the arithmetical mean of the ranges of the 10th and the 11th bar, once you have sorted them by range size. Both the 10th and the 11th bar would be "normal range" bars.

          Comment


            #6
            Originally posted by Harry View Post
            koganam has given the correct answer. The median does not take into account outliers.

            Applied to your original question with 15 "normal range" and 5 "wide range" bars:

            If you calculate the median range it will not take into account the wide ranging bars at all. It will simply produce the arithmetical mean of the ranges of the 10th and the 11th bar, once you have sorted them by range size. Both the 10th and the 11th bar would be "normal range" bars.
            "once you have sorted them by range size".So you mean i still have to create conditions for the outliers?i don`t get it,honestly.What the bars 10-th and 11-th have to do with the original question?The question was,15 bars in,say, 10 points range,and 5 bars,say,in 100 points range,which need to be taken out from equation.

            Comment


              #7
              Originally posted by outsource View Post
              "once you have sorted them by range size".So you mean i still have to create conditions for the outliers?i don`t get it,honestly.What the bars 10-th and 11-th have to do with the original question?The question was,15 bars in,say, 10 points range,and 5 bars,say,in 100 points range,which need to be taken out from equation.
              You are confusing what NT is (?)wrongly calling the "median" of a bar, which is, more correctly the midpoint of the bar, and the "median value of a distribution" of prices, which with 15 values would be the 8th value, after the values are sorted in numerical value.

              Here is a reference that might help you understand what the "median" really means, and why it is a better representation of the average in quite a few cases.

              ref: https://en.wikipedia.org/wiki/Median
              Last edited by koganam; 09-20-2015, 09:16 AM.

              Comment


                #8
                Originally posted by outsource View Post
                "once you have sorted them by range size".So you mean i still have to create conditions for the outliers?i don`t get it,honestly.What the bars 10-th and 11-th have to do with the original question?The question was,15 bars in,say, 10 points range,and 5 bars,say,in 100 points range,which need to be taken out from equation.
                When calculating the statistical median you always need to sort the data points first.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Waxavi, Today, 02:10 AM
                0 responses
                6 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Started by TradeForge, Today, 02:09 AM
                0 responses
                11 views
                0 likes
                Last Post TradeForge  
                Started by Waxavi, Today, 02:00 AM
                0 responses
                2 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Started by elirion, Today, 01:36 AM
                0 responses
                4 views
                0 likes
                Last Post elirion
                by elirion
                 
                Started by gentlebenthebear, Today, 01:30 AM
                0 responses
                5 views
                0 likes
                Last Post gentlebenthebear  
                Working...
                X