Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 3/20/2006(UTC) Posts: 53
|
Mode, Median, Interquartile Range, Percentile
Hi.
I just wonder if it is possible for Metastock to calculate the following:
- the mode
- the median
- interquartile range (Q3-Q1)
- percentile (*)
*: "percentile" is to return the k-th percentile of values in a range. It can be used establish a threshold of acceptance. For example, you can decide to examine candidates who score above the 90th percentile.
Eg: For data array of 2, 4, 6, 8, 10; the 20th & 80th percentiles are 2 and 8 respectively.
Thank you! :)
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
WmWaster wrote:
- the mode
- the median
- interquartile range (Q3-Q1)
- percentile (*)
Mode, Median and Percentile:
yes, using .dll functions. I am playing with this, sort of a steep learning curve for me though. I will see what eventuates, but, never-the-less, although you might not get the function you want, I will learn more abouth the MSX!!
IQR:
Not directly: each .dll can only return a single value, not a range. You could call two external functions ExtFml("myExternalFunctions.Quartile",C,1) and ExtFml("myExternalFunctions.Quartile",C,3) I think thats how I will implement this, IF I can get the first bit to work.
I will give you an update tomorrow!
wabbit :D
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 3/20/2006(UTC) Posts: 53
|
wabbit wrote:WmWaster wrote:
- the mode
- the median
- interquartile range (Q3-Q1)
- percentile (*)
Mode, Median and Percentile:
yes, using .dll functions. I am playing with this, sort of a steep learning curve for me though. I will see what eventuates, but, never-the-less, although you might not get the function you want, I will learn more abouth the MSX!!
IQR:
Not directly: each .dll can only return a single value, not a range. You could call two external functions ExtFml("myExternalFunctions.Quartile",C,1) and ExtFml("myExternalFunctions.Quartile",C,3) I think thats how I will implement this, IF I can get the first bit to work.
I will give you an update tomorrow!
wabbit :D
Sounds like complicated.
Is it possible to let Excel communicate with Metastock as these functions are readily available in Excel?
And is it heavy to run with real-time data?
After some time of formula learning, it seems Metastock is very limited.
Many ideas cannot be written in Metastock language alone.
Luckily we can seek help for *.dll
Thank you. :)
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/19/2005(UTC) Posts: 2,995
Was thanked: 14 time(s) in 10 post(s)
|
Not to state the obvious, but it's easy to export any indicator (including price data) to Excel or another statistics-capable program to do this. Not as much fun as making a custom solution though. :)
If you are concerned about price only, then you might check out using MP() to return the Median price. It really depends on what you are trying to do with this though.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 3/20/2006(UTC) Posts: 53
|
It seems to be a very hard task since I need these calculations in expert advisor / exploration as well.
It's nearly impossible to export over 2000 stocks and make analysis every day (unless all these work can be done automatically).
I need to use these calculations not only in prices, but also volume & indicators like A/D line or RSI or MACD etc.
:)
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
OK I have made the Statistical Mean and Statistical Median functions....
You asked for them - you got them.... now you have to test them and let me know if the results are right or not. If they aren't right, why aren't they right... etc etc etc
WARNING: the Median function is slow. It has to sort the entire data array every bar. I am thinking about a way to speed this up, but nothing I have tried works, yet.
You can get the Statistics.dll from [FILE REMOVED - - see below]
Hope this helps, and we expect to see the test results soon.
wabbit :D
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
... on second thoughts, if you want a copy of the dll as a TESTER then please PM me....
wabbit :D
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.