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

Notification

Icon
Error

3 Pages123>
Options
Go to last post Go to first unread
henry1224  
#1 Posted : Tuesday, May 2, 2006 10:54:52 PM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
When using inputs to select a date most people use 3 inputs one each for month, day and year. Since Metastock only allows for 6 inputs in an indicator, you should use the least required here is a hint on how to use just 1 input C1:=Input("date C mmddyyyy",1011960,12312100,1072000); B:=Input("B:1= tr resistance,2=pk support",1,2,1); PLT:=Input("Lowest Line",1,16,5); PC:=If(B=1,ValueWhen(1, C1=Month()*1000000 + DayOfMonth()*10000+ Year(),L),ValueWhen(1, C1=Month()*1000000 + DayOfMonth()*10000+ Year(),H)); use the input to select a date in the following format mmddyyyy
kanellop  
#2 Posted : Tuesday, May 2, 2006 11:13:46 PM(UTC)
kanellop

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 6/3/2005(UTC)
Posts: 181

Dear Henry1224, I will not make a comment in your Formula. I have an Idea basic in something. This is, if exist a chance to calculate someone, result of a Formula/s, BETWEEN Dates especially in the past using Metastock Formula Language. So, i want to please you to see in the Forum: Indicators the Topic NEED DATE CODE HELP and to write your opinion, if you have, about it. I quite believe that for the Date Periods, need Metastock DATE CODE and especially BETWEEN CODE(If exist). Kind Regards, George Kanellopoulos.
wabbit  
#3 Posted : Tuesday, May 2, 2006 11:33:27 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)
BetweenDates is a function in the Forum.dll wabbit :D
kanellop  
#4 Posted : Tuesday, May 2, 2006 11:51:55 PM(UTC)
kanellop

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 6/3/2005(UTC)
Posts: 181

Hello Wabbit. I have not that Function because i have not download the Forum.dll into my PC. The basic reason is that i do not want to have problems with my Software, i mean especially, between Forum.dll and Metastock 9.1 Pro for E-Signal that i have. If something glued into my PC, my Computer Technician is a little away from me and i will need several days to be without Metastock, for to fix my Problem into my PC! For that reason do you have the Original Formula/s for to write here in this Topic, for to study on it/them? George Kanellopoulos.
henry1224  
#5 Posted : Wednesday, May 3, 2006 12:07:49 AM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
this indicator is from Hayseed {gap tracker, just enter day of gap} m:=Input("month",1,12,1); d:=Input("day",1,31,1); y:=Input("year",1990,2010,2006); a:=ValueWhen(1, Month()=m AND DayOfMonth()=d AND Year()=y,Ref(C,-1)); aa:=ValueWhen(1, Month()=m AND DayOfMonth()=d AND Year()=y,O); a;aa Here is the same indicator with only one input using the date format of mmddyyyy date:=Input("date mmddyyyy",1011960,12312100,1072000); a:=ValueWhen(1, Date=Month()*1000000 + DayOfMonth()*10000+ Year(),Ref(C,-1)); aa:=ValueWhen(1, Date=Month()*1000000 + DayOfMonth()*10000+ Year(),O); a;aa; Using this date format saves the other 2 inputs for other uses in a formula
wabbit  
#6 Posted : Wednesday, May 3, 2006 12:07:55 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)
Download the stable release of the forum.dll file...... leave the Beta version alone for the mean time. If, for some unknown reason your MS crashes with the forum.dll file in memory, just shutdown MS (if it hasnt crashed already, delete the Forum.dll file from the foldr and restart MS. There are no lingering after effects. Nothing else in yuor computer will change for having this file loaded. wabbit :D
kanellop  
#7 Posted : Wednesday, May 3, 2006 12:22:02 AM(UTC)
kanellop

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 6/3/2005(UTC)
Posts: 181

Wabbit, Thank you for your Help, but is not the Formula that need in my Problem, i think. Please see in the Forum: Indicators the Topic NEED DATE CODE HELP and you will undertand what i mean. Kind Regards, George Kanellopoulos.
wabbit  
#8 Posted : Wednesday, May 3, 2006 12:22:19 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)
With the forum function, this: [code:1:e464a30e7f]fmDate:=Input("Start ddmmyy (0=first trade)",0,311299,0); fmDay:=If(fmDate=0,ValueWhen(1,Cum(1)=1,DayOfMonth()),Int(fmDate/10000+.5)); fmMonth:=If(fmDate=0,ValueWhen(1,Cum(1)=1,Month()),Int((fmDate-fmDay*10000)/100+.5)); fmYear:=If(fmDate=0,ValueWhen(1,Cum(1)=1,Year()),Int(fmDate-Int(fmDate/100+.5)*100+.5)); fmYear:=If(fmYear<100,If(fmYear<40,fmYear+2000,fmYear+1900),fmYear); toDate:=Input("End ddmmyy (0=last trade)",0,311299,0); toDay:=If(toDate=0,LastValue(DayOfMonth()),Int(toDate/10000+.5)); toMonth:=If(toDate=0,LastValue(Month()),Int((toDate-toDay*10000)/100+.5)); toYear:=If(toDate=0,LastValue(Year()),Int(toDate-Int(toDate/100+.5)*100+.5)); toYear:=If(toYear<100,If(toYear<40,toYear+2000,toYear+1900),toYear); betweenDates:=((DayOfMonth()>=fmDay AND Month()=fmMonth AND Year()=fmYear) OR (Month()>fmMonth AND Year()=fmYear) OR Year()>fmYear) AND ((DayOfMonth()<=toDay AND Month()=toMonth AND Year()=toYear) OR (Month()<toMonth AND Year()=toYear) OR Year()<toYear);[/code:1:e464a30e7f] can be written as : [code:1:e464a30e7f]fmDate:=Input("Start yyyymmdd (0=last trade)",0,20201231,20060101); toDate:=Input("End yyyymmdd (0=last trade)",0,20201231,0); ExtFml("ForumDll.DateRange", fmDate, toDate);[/code:1:e464a30e7f] Simple. No? wabbit :D
mstt  
#9 Posted : Wednesday, May 3, 2006 12:25:03 AM(UTC)
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 Henry I'm wondering how rigourously you have tested the "all in one" date input. My experience with earlier versions of MS was that "single digit precision errors" tended to creep in when using more than more than 6 digits (for date or anything else). This was most noticable in explorations, and the effect was that the year became useless. Multiplying almost any whole number by 1,000,000 was suspect then, and I'm not sure that anything has changed since then. What is your experience with this? Regards Roy
kanellop  
#10 Posted : Wednesday, May 3, 2006 12:30:45 AM(UTC)
kanellop

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 6/3/2005(UTC)
Posts: 181

I see the Date Formula. Need some time to understand it... I wonder for something. How will work the Formula/s that Need based in the Example that make in the Forum: Indicators the Topic NEED DATE CODE HELP with that Formula that you was write here?? George Kanellopoulos.
wabbit  
#11 Posted : Wednesday, May 3, 2006 12:40:50 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)
It wont help. These are two distinctly different requirements: The code above returns '1' when the date is between the two dates input by the user, The other problem for which you request help, needs to take the value of a bar exactly one year ago (if my understanding is correct?) wabbit :D
kanellop  
#12 Posted : Wednesday, May 3, 2006 12:46:06 AM(UTC)
kanellop

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 6/3/2005(UTC)
Posts: 181

Wabbit, No, i think that you have not understand well. The Problem that exist in the other Topic is: Do you believe that exist Date Formula which can make the following thing: When a Formula occurs in any Day, for example the Formula: Fml("Max DLRL Delta 20"), then from the Day that was born the above Formula until exactly after 3 Months (For Example), to be True or False the following Metastock Formula: (HHV(H, 20)-L)*100/HHV(H, 20) > 15 For example, suppose that the Fml("Max DLRL Delta 20"), occur exactly the 31/10/2005, then, when exist, the (HHV(H, 20)-L)*100/HHV(H, 20) > 15, from 31/10/2005 until exactly 31/01/2006 to be True or otherwise False, so, to receive Price 1 for the True and 0 for the False. Do you believe that can exist a Formula like that? Kind Regards, George Kanellopoulos.
henry1224  
#13 Posted : Wednesday, May 3, 2006 12:59:10 AM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
Roy, I have tested this date format on the current date and have not experienced any errors. most of the indicators that I use with this type of date format are line studies, they are not suitable for explorations since the line studies are meant for the chart they were plotted on Henry
wabbit  
#14 Posted : Wednesday, May 3, 2006 1:17:56 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)
George wrote:
suppose that the Fml("Max DLRL Delta 20"), occur exactly the 31/10/2005, then, when exist, the (HHV(H, 20)-L)*100/HHV(H, 20) > 15, from 31/10/2005 until exactly 31/01/2006 to be True or otherwise False, so, to receive Price 1 for the True and 0 for the False. Do you believe that can exist a Formula like that?
Yes it is possible. It is very complicated in the MSFL to program this, and I really wonder whether it would be worth the time?? On the bar that Fml("Max DLRL Delta 20") was true: you need to get the DayOfMonth(), Month() and Year(). This bit is easy. Then, you need to add three months to the Month(). Don't forget to subtract 12 if Month() >9 and add one to the Year() as required. You also need to check that the date you have created is a valid date i.e. not 31st February or something similar. You will also have to trap the error that will occur if the new date is beyond the right edge of the chart. Anyway.... that should give you enough information to start. Let us all know how you go. wabbit :D
wabbit  
#15 Posted : Wednesday, May 3, 2006 1:23: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)
Oh... and... ummmm This should be RELATIVELY easier to achieve in a .dll call, but you don't like to use add-ins! wabbit :D
henry1224  
#16 Posted : Wednesday, May 3, 2006 1:25:27 AM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
Wabbit, Does your ext fml "between dates" give a cum value? IE: (barssince date a - barssince date b) > (BarsSince Date b - barsSince date C) can it be used more than once in a formula? Henry
wabbit  
#17 Posted : Wednesday, May 3, 2006 1:30:37 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)
henry, As the daterange function returns 0 if not in the range and 1 when in the range, just use cum(betweendates) to count each day inside. And use it as many times as you like in the same formula. wabbit :D P.S. We have to credit Patrick with this code. I only asked for it, he coded it!
henry1224  
#18 Posted : Wednesday, May 3, 2006 1:35:24 AM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
I wonder if there are compatability issues with other dll's ?
wabbit  
#19 Posted : Wednesday, May 3, 2006 1:44:13 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)
Why should there be? Each time an external function is called the entire data series for the selected stock is made available to the function. Although the function can also recieve other data sources, it can only return one data array to MS and none of the original data sources should be changed. i.e. no .dll function should change the value of OHLCVOI data. This means that every time you call a function, MS will pause whilst the computation is taking place until it receives the resultant data array back from the function. It can then call the next function etc. The only compatability issues arise when the .dll uses the MS File Library functions which are dependent on the MSFL version loaded on the users machine. If you dont have the same version and the .dll uses, an error is generated. Higher level stuff than belongs in this thread. wabbit :D
kanellop  
#20 Posted : Wednesday, May 3, 2006 1:45:49 AM(UTC)
kanellop

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 6/3/2005(UTC)
Posts: 181

Wabbit, I am in a bit... bad condition this Hour because of this Formula... I have not sleep and the Time here in this Mad Country named Greece, is 04:45 in the Morning and the Time pass so fast! I decide to listen some Music in my Ears right now, Yanni, and to eat a little Chocolate for to relax for a little! I do not believe that can, alone to create that Formula because of the Metastock Day Expressions that need for that. The problem is in Metastock Manual i think. Have a very little Metastock Formula with Day Examples! So, it is not possible to me to write maybe so complicated Code! But the positive is that, as you said exist Solution. That Formula can exist! Exist and another maybe problem, the Stock Splits! Stock Splits change the Price of the Stock into Metastock. Kind Regards, George Kanellopoulos.
Users browsing this topic
Guest (Hidden)
3 Pages123>
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.