Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 3/22/2005(UTC) Posts: 31
|
I am attempting to create a custom indicator and have run into a problem that I cannot resolve. I'm sure it's very simple, but the solution certainly escapes me. I've gotten a massive headache reading my MetaStock book and trying various combinations to make this thing work.
I have created a security which I call NYSE-AD into which I insert data in the High, Low, and Volume columns. Note that the data has nothing to do with daily highs, lows, or volume, but since that's what MetaStock calls the columns, that's how I have to refer to them when developing a formula. Zeroes are in the Open, Close, and Open Interest columns.
What I am trying to do is for each day, calculate a 5-day sum of the data in the High column, the Low column, and the Volume column, and plot that on a chart.
The 5-day sum of the High and Low columns works fine, but the 5-day sum of the Volume column always shows as zero (0), even though there is data in that column. I have even tried moving the data in the Volume column into the Closed column and modifying my formula accordingly, but it still comes out to be zero.
Any help as to why the 5-day sum of the Volume column always shows zero (0) would be GREATLY appreciated!
Thanks in advance for your help!
Jon Roberts
The formula I have developed so far is (where SumH is supposed to be the 5-day sum of the High column, SumL is supposed to be the 5-day sum of the Low column, and SumV is supposed to be the 5-day sum of the Volume column):
SumH := Security("C:\\FolderName\\NYSE-AD",H) +
Ref(Security("C:\\FolderName\\NYSE-AD",H),-1) +
Ref(Security("C:\\FolderName\\NYSE-AD",H),-2) +
Ref(Security("C:\\FolderName\\NYSE-AD",H),-3) +
Ref(Security("C:\\FolderName\\NYSE-AD",H),-4);
SumL := Security("C:\\FolderName\\NYSE-AD",L) +
Ref(Security("C:\\FolderName\\NYSE-AD",L),-1) +
Ref(Security("C:\\FolderName\\NYSE-AD",L),-2) +
Ref(Security("C:\\FolderName\\NYSE-AD",L),-3) +
Ref(Security("C:\\FolderName\\NYSE-AD",L),-4);
SumV := Security("C:\\FolderName\\NYSE-AD",V) +
Ref(Security("C:\\FolderName\\NYSE-AD",V),-1) +
Ref(Security("C:\\FolderName\\NYSE-AD",V),-2) +
Ref(Security("C:\\FolderName\\NYSE-AD",V),-3) +
Ref(Security("C:\\FolderName\\NYSE-AD",V),-4);
SumH;
SumL;
SumV
The data for the previous 5 days is in the Downloader as follows (so as you can see, the 5-day sum from the Volume column should be 5, not 0):
10/14/2005 0 2225.00 1059.00 0 1
10/17/2005 0 1762.00 1518.00 0 1
10/18/2005 0 918.000 2338.00 0 1
10/19/2005 0 2115.00 1155.00 0 1
10/20/2005 0 826.000 2453.00 0 1
|