Discussions
»
Product and Service Development
»
Formula Assistance
»
Metastock Math -- Any reason for different results?
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 5/13/2005(UTC) Posts: 715 Location: Midwest, USA
Was thanked: 1 time(s) in 1 post(s)
|
I'm trying to calculate an indicator using SECURITY(), which should be independent of any Chart's Base Security, but get different answers when using the chart to browse symbols. Here is the indicator:
---------------------------------------------------------------------------------------
AdvIss:=Security("\METASTOCK DATA\BM Data\X.NYSE-A",C); DecIss:=Security("\METASTOCK DATA\BM Data\X.NYSE-D",C); x:=((AdvIss-DecIss)/(AdvIss+DecIss))*100; McClellanOsc:=Mov(x,19,E)-Mov(x,39,E); McClellanOsc; ---------------------------------------------------------------------------------------
For Friday, 14 Oct 2011, it gives the following:
8.58988 -- DJI, DJT, DJU, OEX, SML, SPX 8.13997 -- IXIC, MID, NYA, XAX 8.51524 -- RUT 6.07266 -- GSPTSE
It does not matter if RETAIN SCALE is checked, nor if the amount of bars loaded varies -- have tried the entire history, as well as loading only 3024 bars.
Can anyone shed light on this?
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi Johnathan
In situations like this I've almost invariably found that there is an explanation for the problem and it turns out not to be a matter of MetaStock being unable to perform a calculation properly. That specific groups of securities return the same result suggests that the cause for the differences you're seeing lies with the specific securities you're using for display purposes. My guess would be that the securities used as hosts have recent extra or missing data bars relative to the broad market data. I've just run a "validity" scan over the most recent 250 bars of 180 US indices and got a result indicating 10 different combinations of missing or extra bars over that period.
Some time back I published an indicator in MSTT that identified data variations between two securities. However, I think it required Volume data and I'm not sure that every index has that. The validation scan should tell you which securities NOT to use as a host if missing or extra data bars is the problem.
Roy
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 5/13/2005(UTC) Posts: 715 Location: Midwest, USA
Was thanked: 1 time(s) in 1 post(s)
|
Hi Roy, What did you use for the "validity" scan? What bugs me is that this is a variation of the McClellan Oscillator & Summation Index -- the Summation Index, at least, should "converge", using CUM(). Since it uses "Security()" on the NYSE data, I expected very close results. I ran the following Exploration on the S&P 500 constituents over 3024 bars, and nearly 20% of the ColC results are all over the map: ColA: Cum(1) ColB: Fml("_McClellan Oscillator Ratio") { aforementioned code } ColC: Cum(Fml("_McClellan Oscillator Ratio"))
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi Johnathan
Here's the validity scan. I developed this scan to help overcome problems with the GobalVar DLL when summing historical values across an entire portfolio of stocks. Global variable cells don't automatically align by date and so cell results can only be known to hold data for a specific date across a portfolio when all securities in that portfolio have identical date stamps. Any missing or extra data bars in any security compromises the result. The validity scan is used to select an optimum set of dates and then weed out those securities that don't comply.
{Data Validity Scan}
{This exploration scans a list of securities to find those with optimal/identical data sets. From the various column results select and enable filter values for a second scan which will filter out securities with missing or extra data records. If required the result of the second scan can be saved as a favorite}
{Col A: Day} ValueWhen(1,Cum(1)=1,DayOfMonth())
{Col B: Month} ValueWhen(1,Cum(1)=1,Month())
{Col C: Year} ValueWhen(1,Cum(1)=1,Year())
{Col D: SumMonth} Cum(DayOfMonth())
{Col E: Sum Days} Cum(DayOfWeek())
{Col F: Sum Bars} Cum(1);
{Filter} {Disable filter for preliminary scan. Use results to set optimum column values for second scan} {colA=6 AND colB=11 AND colC=2001 AND colD=39308 AND colE=7551}
Filter enabled: Yes Periodicity: Daily Records required: As required
When using the Security() function to import data into another chart the
Security() function in effect uses ValueWhen(1,date match, data) to
"fill" any gaps in the imported data. I've never really looked at what
happens when the host chart is the one missing a data bar.
Roy
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 5/13/2005(UTC) Posts: 715 Location: Midwest, USA
Was thanked: 1 time(s) in 1 post(s)
|
Roy, >>Here's the validity scan On the main Dow and S&P Indices I monitor, there is variation -- the bars (3024) are all the same, but the start date can vary from 4 -20 Oct 1999. The RUT is the most late, starting 20 Oct 1999, yet has the same bar count as the SPX, which starts 12 Oct 1999. Riddle me that one, Obi-Wan... >>I've never really looked at what
happens when the host chart is the one missing a data bar. Have run into this on a chart using the FIRE Addon to calculate the S&P 500, then dragging the actual SPX into the chart. There is Equis SPX data for 20110905, yet that was a holiday and U.S. markets were closed -- no data on Yahoo or any of the SPX constituents: While the Base Security only goes back to 19800102, the chart will display back to 19500103: Explorations may not work the same, though -- still can't figure why the CUM() on the the McClellan isn't at least close...
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi Johnathan
I'm aware that a problem might only show up in one column - that's why there are 5 separate checks. I look first for common numbers in columns 4 and 5 and then check the start date almost as an after thought. Usually more than one column will signal that something is amiss but it ain't necessarily so. The odds of having a problem when all 5 columns are the same is miniscule, and I've never seen that, but even so I wouldn't guarantee that it's impossible (my maths isn't that good).
Anyway, I hope this tool helps you get a handle on the problem.
Roy
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Discussions
»
Product and Service Development
»
Formula Assistance
»
Metastock Math -- Any reason for different results?
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.