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

Notification

Icon
Error

Options
Go to last post Go to first unread
moneypick  
#1 Posted : 19 years ago
moneypick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 32

Respected Members, I want to creat a formula for exploration of past date. Suppose I have EOD data upto 15-3-2006 but I want to explore the data of 2 Jan 2006 for signal testing. I write a formula for this purpose, but it always give me result `0`. If((Year()=2006+Month()=1+DayOfMonth()=2)=2-1-2006,If(Cross(Fml("MA1"),Fml("MA2")),1,0),0) Please guide me, what is wrong? Thx, (moneypick)
mstt  
#2 Posted : 19 years ago
mstt

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)
MoneyPick The Explorer always reports the satus or price as at the last bar explored (usually the current data or the day previous). Because you have included a date in your formula that requirement will never allow the Explorer to giva an active result (the current date will never be equal to the date you specified). What you have to do is edit the exploration and change to a "Specific Date" setting. That forces the date set to be be considered as the last date in all your data, and it will give the information required without adding "date" details into your formula. Roy MetaStock Tips & Tools
Justin  
#3 Posted : 19 years ago
Justin

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 9/13/2004(UTC)
Posts: 673
Location: Salt Lake City, UT

To clarify, when you click Edit on the exploration, there is an "Options" button at the bottom of the editor window and you will have options for exploring "Most Recent Date" or "Specific Date".
wabbit  
#4 Posted : 19 years ago
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)
Then again, there is always the BetweenDates function in the Forum.dll for those who must programmatically set dates! Hope this helps. wabbit :D
mstt  
#5 Posted : 19 years ago
mstt

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 Wabbit I don't see how the Forum dll Date Range function is going to help with an exploration. Maybe if the relevant values were captured with ValueWhen(1, "specific date", "sample value"), but I suspect that would cause a lot more problems for monepick than it solved. Am I missing something? Regards Roy MetaStock Tips & Tools
wabbit  
#6 Posted : 19 years ago
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)
I was thinking along lines of: if(extfml("forum.betweendates",date1, date1) and crtiteria.... etc would return TRUE/FALSE for the criteria on that specific date? Or something like that. wabbit :D
moneypick  
#7 Posted : 19 years ago
moneypick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 32

Dear wabbit, Can you please explain with the example. Supposte date is 2-1-2006 & formula is cross (Fml("ma1"),Fml("ma2")). Please, Thx, (moneypick)
wabbit  
#8 Posted : 19 years ago
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)
Notes: 1. You MUST have the Forumdll to use this formula.... its free and downloadable from this site. 2. If you only specify one day, it must be trading day. 3. The date format is yyyymmdd Try this: --8<------------------------- d:= 20060103; ExtFml("ForumDll.DateRange", d,d)=1 AND Cross(Fml("ma1"),Fml("ma2")); --8<------------------------- Hope this helps. wabbit :D
moneypick  
#9 Posted : 19 years ago
moneypick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 32

Hi, No its not solve my problem. It also generate result `0` only. I try following example shown in forum manual but result is same as above. Buy:=Cross(RSI(C,14),80); DateCheck:=ExtFml(“forum.DateRange", 20040101, 20050101); I change my DATE setting in Control Panel-Regional Option-Date yyyy/mm/dd :?:
StorkBite  
#10 Posted : 19 years ago
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
I've been watching this one in the background... hope you don't mind my 0.02! The forum.dll DateRange function has crashed my MS9.1 a couple of times; however, I'm not sure what I was doing wrong at the time. If you make the initial plot with a date that doesn't exist, I believe it is plotting zero. After that, if you correct the date, it still plots zero... at least on the very few securities that I tested it on. The working solution for me was to make sure the initial dates are valid. After that, the plot looks good even if you change to a date range that is invalid. It's strange. Maybe I've been watching too much sci-fi! Anyway, I did get Wabbit's solution to work. [code:1:edec26c13e]d1:= 20020503; d2:= 20060209; ma1:=Mov(C,10,E); ma2:=Mov(C,21,E); Plot:=ExtFml("ForumDll.DateRange", d1,d2) AND Cross(ma1,ma2); Plot;0;[/code:1:edec26c13e] UserPostedImage
Jose  
#11 Posted : 19 years ago
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
moneypick wrote:
I want to creat a formula for exploration of past date. Suppose I have EOD data upto 15-3-2006 but I want to explore the data of 2 Jan 2006 for signal testing.
The problem may be that there is no data available for the 2nd Jan 2006 (New Year's day holiday). Let's keep things simple - try this formula: [code:1:6f8d25be68] { http://www.metastocktools.com } { Date - user input section } day:= 02; { current Day of month (1~31) } mth:= 01; { current Month (1~12) } yr:= 2006; { current Year, eg 2006 } { *********************************** } { Sample data array } x:=RSI(14); init:=Cum(IsDefined(x))=1; {Date signal - plot next avail date if holiday} period:=Year()>yr-1 OR (Year()=yr-1 AND (Month()>mth OR Month()=mth AND DayOfMonth()>=day)); date:=period AND Alert(period=0,2); { Data at date signal } ValueWhen(1,date OR init,x) [/code:1:6f8d25be68] jose '-)
moneypick  
#12 Posted : 19 years ago
moneypick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 32

Resptected Jose sir, Thanks to you and all members who respond on my query. I change formula RSI(14) to Cross(c,mov(c,50,s)) and get following result. I try to find those security Cross(c,mov(c,50,s) ) on [color=green:48f5bd071f]13-01-2006[/color]. (1) When I used your formula and EOD data upto 17-3-2006. This exploration find most securities who close negative against yesterday close price. [color=darkred:48f5bd071f]Security Name[/color] [color=red:48f5bd071f]Close[/color] [color=orange:48f5bd071f]mov(c,50,s)[/color] [color=olive:48f5bd071f]Ref(c,-1)[/color] [color=darkblue:48f5bd071f](Ref(c,-1)) - C[/color] JIK INDUSTRIES 2.6 2.557 2.6 0 CHEMPLAST SANMAR 8.8 79.557 8.95 -0.15 SUNFLAG IRON AND 14.45 14 14.7 -0.25 RCF 37.15 40.435 38 -0.85 RAIN CALCINING 40.5 46.073 41.25 -0.75 KHAITAN ELECT 44.9 47.282 44.35 0.55 BERGER PAINTS 72.6 72.88 71.9 0.7 GODAVARI FERT 73.8 84.831 75.1 -1.3 STERLITE OPTICAL 95.6 98.303 96.05 -0.45 KAKATIYA CEMENT 101.35 98.776 102.6 -1.25 STATE TRADING 158.9 173.963 159.3 -0.4 SUNDARAM FASTE 162.25 158.452 166.45 -4.2 KOCHI REFINERIES 171.2 179.836 170.8 0.4 INFOMEDIA INDIA 198.4 201.545 201.05 -2.65 TIL 266.65 221.968 272 -5.35 IBP CO 545.35 556.282 555 -9.65 AIA ENGINEERING 652.9 587.59 634.05 18.85 SESA GOA 1154.55 1049.55 1079.95 74.6 JINDAL STEEL 1683.85 1555.41 1724 -40.15 PANTALOON RETAIL 2003.5 1702.71 1926.55 76.95 LAKSHMI MACHINE 19584.25 19156.46 19029.65 554.59 (2) When I used Cross(c,mov(c,50,s)) in the filter section of exploration and delete the EOD data after date 13-01-2006. This exploration find NO securities who close negative against yesterday close price. [color=darkred:48f5bd071f]Security Name[/color] [color=orange:48f5bd071f]Close[/color] [color=green:48f5bd071f]mov(c,50,s)[/color] [color=olive:48f5bd071f]Ref(c,-1)[/color] [color=darkblue:48f5bd071f](Ref(c,-1)) - C[/color] WINSOME YARNS 16.15 16.107 15.75 0.4 TOKYO PLAST 6.3 6.2 6.2 0.1 TIMES GUARANTY 23.1 21.444 21 2.1 SUZLON ENERGY 861.6 835.812 832.3 29.3 SB&T INTERNATIL 73.2 72.888 72.35 0.85 RADAAN MEDIA 7.85 7.793 7.75 0.1 PETRON ENGG 226 217.397 216.2 9.8 NAHAR SPINNING 254.75 253.162 252.5 2.25 MPHASIS BFL 162.9 159.483 160.5 2.4 LIQUIDBEES-ETF 1000 999.998 999.99 0.01 LIBERTY S[censored]S 275.3 258.09 255.75 19.55 KOPRAN 52.3 52.057 51.2 1.1 KHAITAN INDIA 16.2 16.131 15.1 1.1 KANORIA CHEM 127.4 120.136 118.95 8.45 JAYSHREE TEA 111 106.654 105.25 5.75 JAI CORP 111.9 110.323 109.65 2.25 INDIAN HUME PIPE 266.65 266.592 262.75 3.9 IND-SWIFT 58.8 56.067 54.4 4.4 IMPEX FERRO TECH 18 17.999 17.9 0.1 HIMATSINGKA SEIDE 141.8 141.175 140 1.8 GUJARAT FLUOROCH 340.75 338.823 333.7 7.05 GOKALDAS EXPORTS 586.4 581.111 579.55 6.85 GOETZE INDIA 222.45 221.296 219.95 2.5 CREST ANIMATION 154.75 150.456 147.35 7.4 BLUE CHIP INDIA 2.7 2.565 2.55 0.15 Results are different. Perhaps formula not work well.
Jose  
#13 Posted : 19 years ago
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
moneypick wrote:
Results are different. Perhaps formula not work well.
Or perhaps not. The formula is quite simple and works exactly as intended: it finds a specific date, and retrieves your custom formula value for that date. Whenever something doesn't work as expected, it pays to take the time to find out why. Often, unexpected results originate from errors generated between chair & keyboard. ;) jose '-)
wabbit  
#14 Posted : 19 years ago
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)
Jose wrote:
... errors generated between chair & keyboard.
I still love that phrase..... doesn't matter how many times I read it, it still brings a smile and wry chuckle! wabbit :
Jose  
#15 Posted : 19 years ago
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
Well, as Wabbit says: There are only 10 types of binary errors.... Error 01, between keyboard & screen; Error 10, between keyboard & seat. :) jose '-)
Jose  
#16 Posted : 19 years ago
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
My apologies to MoneyPick - there was an error that crept from my brain into the formula. Here is the updated version: [code:1:c7edec38f2] { http://www.metastocktools.com } { Date - user input section } day:= 02; { current Day of month (1~31) } mth:= 01; { current Month (1~12) } yr:= 2006; { current Year, eg 2006 } { *********************************** } { Sample data array } x:=RSI(14); init:=Cum(IsDefined(x))=1; {Date signal - plot next avail date if holiday} period:=Year()>yr OR (Year()=yr AND (Month()>mth OR Month()=mth AND DayOfMonth()>=day)); date:=period AND Alert(period=0,2); { Data at date signal } ValueWhen(1,date OR init,x) [/code:1:c7edec38f2] jose '-)
moneypick  
#17 Posted : 19 years ago
moneypick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 32

Respected Jose Sir, Thankyou very much for relook in the matter. When I crosscheck your old formula and find different result then I wants your attention in the matter. But you mind the last line of my message. I keep silent against the Phrase you use because I have little knowledge of Metastock Programming and English too. Updated formula work well and result are same. Thanks once again for your kind help, (moneypick)
mt4eas  
#18 Posted : 5 years ago
mt4eas

Rank: Newbie

Groups: Registered, Registered Users, Unverified Users
Joined: 3/12/2012(UTC)
Posts: 5

Originally Posted by: Justin Go to Quoted Post
To clarify, when you click Edit on the exploration, there is an "Options" button at the bottom of the editor window and you will have options for exploring "Most Recent Date" or "Specific Date".

colA:=

c1:=ValueWhen(1,Month()=1 AND DayOfMonth()=1 AND Year()=2020,C); c1;

https://imgur.com/a/krBfxiX

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.

information You have 1 unread message(s) in your Inbox.