logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
sharezack  
#1 Posted : Tuesday, September 19, 2006 11:34:48 PM(UTC)
sharezack

Rank: Member

Groups: Registered, Registered Users
Joined: 9/15/2006(UTC)
Posts: 24

Was thanked: 1 time(s) in 1 post(s)

Hi

I am in the process of learning the metastock and i have written an exploration to find out the simple moving avarages of 3,9,12,20,50 and 200 Days the code is some what like this.

Col A Mov(CLOSE, 3, S)

Col B Mov(CLOSE, 9, S)

Col C Mov(CLOSE, 12, S)

Col D Mov(CLOSE, 20, S)

Col E Mov(CLOSE, 50, S)

Col F Mov(CLOSE, 200, S)

Filter : colA or colB or colC or colD or colE or colF

The problem is some of the securities might have been new listing and do not have traded for more than a week or more than a month or more than 6 months and hence they might not fulfill the critieria of calculating the specified moving avarage period for example if IBM was listed only 10days back it can calculate 3 and 9 day moving avarage but for rest it will fail. In my code securities which are not matching all the critieria are not being calculated.

what i want is if the security fulfills colA critieria and fails to fullfill the rest of the colums even then i should get the results for col A and for rest of the colums i should get 0 value. for exampls

IMB listed 5 days back

3Day 9Day 12Day 20Day 50Day 200Day

20 0 0 0 0 0

This is how it has to display instead of getting rejected in the computation. i tried to look at the filter command but not able to get the answer for this can some one help what i should be doing.

sharezack  
#2 Posted : Wednesday, September 20, 2006 4:12:41 AM(UTC)
sharezack

Rank: Member

Groups: Registered, Registered Users
Joined: 9/15/2006(UTC)
Posts: 24

Was thanked: 1 time(s) in 1 post(s)
to fine tune my query if the stock fulfills even one criteria also this has to be displayed. what should be the filter for this
wabbit  
#3 Posted : Wednesday, September 20, 2006 6:28:29 AM(UTC)
wabbit

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)
sharezak,

Again this is a simple query that will be answered by reading the MS Users Manual and completing the Equis Formula Primer. We understand that you are rushed to have your website completed, but I fail to see why we should be rushing to complete your coding projects for you. If you needed to have your website up and running by a particular date then you should have started earlier; if the time is not an issue then why should we rush to build your code for you? Take the time to learn to do it for yourself.

Quote:
Time management' is really a misnomer - the challenge is not to manage time, but to manage ourselves.


Quote:
The best way to get something done is to begin.



In relation to your explorations:

You do not need a filter criteria. Leave the filter empty and every stock will be returned with values in Columns A to E.

As for the moving averages, the short answer is you cannot replace on Undefined() data array with another array. The IsDefined() and IsUndefined() functions were poorly implemented and are next to useless. The only solution is to write another MS add-in that will accept to arguments, returning one array if the other is undefined. I have one for personal use.


wabbit [:D]



sharezack  
#4 Posted : Wednesday, September 20, 2006 6:58:37 AM(UTC)
sharezack

Rank: Member

Groups: Registered, Registered Users
Joined: 9/15/2006(UTC)
Posts: 24

Was thanked: 1 time(s) in 1 post(s)

hi wabbit

see i have left the filter command empty and ran the exploration but some of the stocks were getting rejected like this. If you see ABAN it is fulfilling upto to colum E since the data range is not available for more than 50days it is getting discarded. where as i want the exploration to list upto column D as it fulfills the critieria and then for column E and F let it show what ever default it can show

Security Name Reason for Rejection Location
ABAN OFFSHORE LTD. Error in column E: Period value out of valid range in Mov() function. D:\metadata\NSE2005
ADHUNIK METALIKS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
AIA ENGINEERING Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
DECCAN AVIATION Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
ALLCARGO GLOBAL LOGISTICS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
BAL PHARMA Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
BANK Nifty Error in column E: Period value out of valid range in Mov() function. D:\metadata\NSE2005
BARTRONICS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
BL KASHYAP & SONS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
BOMBAY RAYON FASHIONS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
BENCHMARK SPLIT CAP FUND - BAL - CLASS B Error in column B: Period value out of valid range in Mov() function. D:\metadata\NSE2005
CELEBRITY FASHIONS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
CENTURY PLYBOARDS (I) Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
CHEMFAB ALKALIES Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
CNX 100 Error in column E: Period value out of valid range in Mov() function. D:\metadata\NSE2005
CNX IT Error in column E: Period value out of valid range in Mov() function. D:\metadata\NSE2005
CNX Midcap Error in column E: Period value out of valid range in Mov() function. D:\metadata\NSE2005
CNX Nifty Junior Error in column E: Period value out of valid range in Mov() function. D:\metadata\NSE2005
COMPULINK SYSTEMS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
EDUCOMP SOLUTIONS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
EVEREST KANTO CYLINDER Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
EMAMI LIMITED Error in column E: Period value out of valid range in Mov() function. D:\metadata\NSE2005
EMKAY SHARE & STOCK BROKERS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
ENTERTAINMENT NETWORK Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
ERA CONSTRUCTIONS (I) Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
GALLANTT METAL Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
GITANJALI GEMS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
GMR INFRASTRUCTURE LTD. Error in column E: Period value out of valid range in Mov() function. D:\metadata\NSE2005
GODAWARI POWER & ISPAT Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
GUJRAT STATE PETRONET Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
GTN TEXTILES Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
GVK POWER & INFRASTRUCTURE Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
INDO TECH TRANSFORMERS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
INOX LEISURE Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
JAGRAN PRAKASHAN Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
JK CEMENT Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
KIRLOSKAR BROTHERS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
KEC INTERNATIONAL Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
KEI INDUSTRIES Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
KERNEX MICROSYSTEMS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
KAMDHENU ISPAT Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
KEWAL KIRAN CLOTHING Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
KOHINOOR FOODS LIMITED Error in column E: Period value out of valid range in Mov() function. D:\metadata\NSE2005
LOKESH MACHINES Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
MAHINDRA & MAHINDRA FINANCIAL SERVICES Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
MALU PAPER MILLS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
MAWANA SUGARS LIMITED Error in column E: Period value out of valid range in Mov() function. D:\metadata\NSE2005
NANDAN EXIM Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
NAVA BHARAT VENTURES LIMI Error in column E: Period value out of valid range in Mov() function. D:\metadata\NSE2005
NITCO TILES Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
NITIN SPINNERS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
NUMERIC POWER SYSTEMS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
ORIENT ABRASIVES Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
PRIME FOCUS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
PIONEER EMBROIDERIES Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
PIRAMYD RETAIL Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
PLETHICO PHARMACEUTICALS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
PRATIBHA INDS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
PUNJ LLOYD Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
PVR LTD Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
RR MOHOTA SPINNI Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
RATNAMANI METALS & TUBES Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
RELIANCE CAPITAL VENTURES Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
RELIANCE COMMUNICATIONS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
RELIANCE ENERGY VENTURES Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
REPRO INDIA Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
RELIANCE NATURAL RESOURCES Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
ROHIT FERRO-TECH Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
ROYAL ORCHID HOTELS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
RELIANCE PETROLEUM Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
R SYSTEMS INTL Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
S&P CNX 500 Error in column E: Period value out of valid range in Mov() function. D:\metadata\NSE2005
S&P CNX Defty Error in column E: Period value out of valid range in Mov() function. D:\metadata\NSE2005
S&P CNX Nifty Error in column E: Period value out of valid range in Mov() function. D:\metadata\NSE2005
SADBHAV ENGINEERING Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
SAKUMA EXPORTS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
SANWARIA AGRO OILS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
SHIVALIK GLOBAL Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
SIMBHOLI SUGAR Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
SOLAR EXPLOSIVES Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
SUNIL HITECH ENGINEERS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
SUN TV Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
SURYAJYOTI SPINNING MILLS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
TECH MAHINDRA LIMITED Error in column D: Period value out of valid range in Mov() function. D:\metadata\NSE2005
TULIP IT SERVICES Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
UNITY INFRAPROJECTS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
UTTAM SUGAR MILLS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
VAKRANGEE SOFTWARE Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
VIMTA LABS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
VISA STEEL Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005
WENDT (INDIA) LIMITED Error in column E: Period value out of valid range in Mov() function. D:\metadata\NSE2005
ZICOM ELECTRONIC SECURITY SYSTEMS Error in column F: Period value out of valid range in Mov() function. D:\metadata\NSE2005

sharezack  
#5 Posted : Wednesday, September 20, 2006 7:13:10 AM(UTC)
sharezack

Rank: Member

Groups: Registered, Registered Users
Joined: 9/15/2006(UTC)
Posts: 24

Was thanked: 1 time(s) in 1 post(s)

Wabbit buddy

This would be last help i would require, i am really running short of time i would really be thankfull if you can give me the code. I promise there will be no more postings for code with out reading. even if i post you all can ignore it. request you to get me out of this fix and help me with the code for solving this problem

sharezack  
#6 Posted : Wednesday, September 20, 2006 8:14:19 AM(UTC)
sharezack

Rank: Member

Groups: Registered, Registered Users
Joined: 9/15/2006(UTC)
Posts: 24

Was thanked: 1 time(s) in 1 post(s)

hi wabbit

whats wromg with this code If(IsUndefined(Mov(C,200,S))=>1,0,Mov(CLOSE, 200,S))

what i am trying to check is if all data necessary to calculate is available then it returns 0 which is less than 1 so it has to plot the moving avarage else if it is 1 then plot 0.

wabbit  
#7 Posted : Wednesday, September 20, 2006 6:39:12 PM(UTC)
wabbit

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)
wabbit wrote:
As for the moving averages, the short answer is you cannot replace an Undefined() data array with another array. The IsDefined() and IsUndefined() functions were poorly implemented and are next to useless. The only solution is to write another MS add-in that will accept two arguments, returning one array if the other is undefined. I have one for personal use.


As much as the logic you used it is correct, you have still been Kyboshed by the implementaton of the functions in MS.

You (like all of us) might think that

If(IsUndefined(someDataArray)=False, thenUseSomeOtherDataArray, elseUseTheOriginalDataArray)

or

If(isDefined(someDataArray)=True,thenUseTheDataArray,elseUseAnotherDataArray)

would work, but, it doesn't.

Beacuse all the functions in MS are FULLY evaluated, MS sees a function which returns NA and therefore returns NA for that variable.

There is no way around it in MS as it stands at the moment, you need to do the defined/undefined comparison externally and return the appropriate data array from outside of MS. This requires an add-in .dll file.


wabbit [:D]


sharezack  
#8 Posted : Thursday, September 21, 2006 11:48:04 PM(UTC)
sharezack

Rank: Member

Groups: Registered, Registered Users
Joined: 9/15/2006(UTC)
Posts: 24

Was thanked: 1 time(s) in 1 post(s)

hi

Here is the perfect solution for the query i had posted this gives the same results and also for the period where data is not there it gives me zero instead of rejecting in the filter.

Col A:

M:=Mov(C,LastValue(Min(3,Cum(1))),S);

If(Cum(1)<3,0,M);

Col B:

M:=Mov(C,LastValue(Min(9,Cum(1))),S);

If(Cum(1)<9,0,M);

Col C:

M:=Mov(C,LastValue(Min(12,Cum(1))),S);

If(Cum(1)<12,0,M);

Col D:

M:=Mov(C,LastValue(Min(20,Cum(1))),S);

If(Cum(1)<20,0,M);

Col E:

M:=Mov(C,LastValue(Min(50,Cum(1))),S);

If(Cum(1)<50,0,M);

Col F:

M:=Mov(C,LastValue(Min(200,Cum(1))),S);

If(Cum(1)<200,0,M);

Filter enabled Yes

Periodicity Daily

Records required 250

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.