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

Notification

Icon
Error

3 Pages<123>
Options
Go to last post Go to first unread
wabbit  
#21 Posted : Wednesday, May 3, 2006 1:48: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)
Stock splits are an issue for your data provider. MS is a charting tool. It will plot whatever data you feed it (within reason). If a split or consolidation has ocurred, your data provider should be making those adjustments for you. At least, a good data provider will do that for you. wabbit :D
kanellop  
#22 Posted : Wednesday, May 3, 2006 1:57:39 AM(UTC)
kanellop

Rank: Advanced Member

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

Yes, Reutersdatalink, make that for me! But must think the affect of the Split in that kind of Formula! George Kanellopoulos.
Jose  
#23 Posted : Wednesday, May 3, 2006 2:18:33 AM(UTC)
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)
I personally see little point in considering external DLLs, when a binary date function can be easily coded within MetaStock's formula language: [code:1:a5c615b028] =========== Date filter =========== ---8<--------------------------- { Date filter Plots +1 binary signal within user-input date period. For personal use only. http://www.metastocktools.com } { Date inputs } StDay:=Input("start Day",1,31,1); StMnth:=Input("start Month",1,12,1); StYear:=Input("start Year",1800,2200,2006); EnDay:=Input("end Day",1,31,31); EnMnth:=Input("end Month",1,12,3); EnYear:=Input("end Year",1800,2200,2006); { Selected date period } start:=Year()>StYear OR (Year()=StYear AND (Month()>StMnth OR Month()=StMnth AND DayOfMonth()>=StDay)); end:=Year()<EnYear OR (Year()=EnYear AND (Month()<EnMnth OR Month()=EnMnth AND DayOfMonth()<=EnDay)); { Plot in own window } start AND (end OR (start AND Alert(start=0,2))) ---8<--------------------------- [/code:1:a5c615b028] jose '-)
wabbit  
#24 Posted : Wednesday, May 3, 2006 2:22:51 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)
The problem isn't in getting the intial date, its in programmatically setting a date EXACTLY three months after the first date. Binary date code has already been covered on the first page of the thread. wabbit :D
Jose  
#25 Posted : Wednesday, May 3, 2006 2:29:33 AM(UTC)
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)
The binary date filter code above will return a date exactly three months after the first input date. It will also find the nearest trading day, so no need to worry about missing chart data on weekends or holidays. jose '-)
hayseed  
#26 Posted : Wednesday, May 3, 2006 3:06:27 AM(UTC)
hayseed

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 3/7/2005(UTC)
Posts: 1,346

hey henry.... thanks for that note.... i had made a feeble prior attempt at combining them..... only got as far as the month and year..... thanks again..... h x:=Input("month and year",1,130000,12006); m:=int(x/10000); {month} y:=x-(m*10000); {year} d:=Input("day",1,31,3); {day}
kanellop  
#27 Posted : Wednesday, May 3, 2006 12:36:53 PM(UTC)
kanellop

Rank: Advanced Member

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

Well, i received the Message of all of you. I want to tell you that i am Grateful to all of you. My Trust and my Confidence to all of you is Extremely Big! I want to note here, that i put the Metastock Formula of my favourite Jose into my Indicator Builder of Metastock and then try the Formula. I quiet believe that the Formula does not work well. The reason of that is because i believe that Jose did not understand well my Thought. I am sorry for that. I am sure that my Favourite Jose can create that kind of Formula in Nanoseconds!!! This also, does not mean that other People can not create it! I want to repeat that i appreciate for everyone's Help!!! I will try to tell again the Problem!
Do you believe that exist Date Formula which can make the following thing: When a Formula occurs in any Day, for example the Formula/s: Fml("Max DLRL Delta 20") (or for example, the other Formula Fml("APO H 120") or any other Formula that someone can imagine if you like), then from the Day that the above Formula is TRUE, meaning that occurs, or we have TRUE Signal of it, 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") (or for example, the other Formula Fml("APO H 120") or any other Formula that someone can imagine if you like), occur exactly the 31/10/2005, then, when happen that, 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.
wabbit  
#28 Posted : Wednesday, May 3, 2006 1:49:18 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)
George, How would you solve the following problem: Your Fml("Max DLRL Delta 20") return true on 30 November 2005. What date is exactly three months after this date? 28 February (as the last day of the month) or rollover into 02 March? In logic terms this could cause a whole pile of dates to focus on one date! If you could email me some sort of table of EXACTLY what you think a function should do then I will investigate the feasibility of coding it. e.g. EXACTLY three months after 01 Jan 05 --> 01 Apr 05 30 Jan 05 --> 30 Apr 05 31 Jan 05 --> 30 Apr 05 etc etc etc wabbit :D
kanellop  
#29 Posted : Wednesday, May 3, 2006 2:28:43 PM(UTC)
kanellop

Rank: Advanced Member

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

Wabbit, Thank you for your Message. I see it and i want to note, that suppose, the Signal occurs in 30 November 2005. Then the 3 Month Period is until and 28 February 2006. Suppose a Signal that occurs in 01 January 2005 then the 3 month Period after that Day, is until and 31 March 2005. Suppose a Signal that occurs in 15 January 2005 then the 3 month Period after that Day, is until and 14 April 2005. I do not remember well how Metastock Formula Language calculate theMonth() Period, i mean calculate it like the above examples or, like, Suppose the Signal occurs in 30 November 2005. Then the 3 Month Period is until and 28 February 2006. Suppose a Signal that occurs in 01 January 2005 then the 3 month Period after that Day, is until and 01 April 2005. Suppose a Signal that occurs in 15 January 2005 then the 3 month Period after that Day, is until and 15 April 2005. Etc. Kind Regards, George Kanellopoulos.
wabbit  
#30 Posted : Wednesday, May 3, 2006 2:52:15 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)
My first grab at this has been completed... It has some bugs which might take me a little while to figure out. I have an exam on Friday, so I will concentrate my efforts to the task after Friday. wabbit :D yyyymmdd Result --------- Date 19941018 19940718 19941020 19940719 19941020 19940720 19941020 19940721 19941022 19940722 19941024 19940725 19941026 19940726 19941028 19940727 19941028 19940728 19941028 19940729 19941100 19940801 19941102 19940802 19941104 19940803 19941104 19940804 19941104 19940805 19941108 19940808 19941108 19940809 19941110 19940810
wabbit  
#31 Posted : Thursday, May 4, 2006 7:28:32 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, I have done some quick code..... --8<-------------------------------------- whichDay:=Fml("Max DLRL Delta 20"); theDay:=ValueWhen(1,whichDay,DayOfMonth()); theMonth:=ValueWhen(1,whichDay,Month()); theYear:=ValueWhen(1,whichDay,Year()); {add three months} theMonth:=theMonth+3; theYear:=If(theMonth>12,theYear+1,theYear); leapYear:=Mod(theYear,4)=0 AND Mod(theYear,100)<>0 OR Mod(theYear,400)=0; theMonth:=If(theMonth>12,theMonth-12,theMonth); theDay:= If(theMonth=4 OR theMonth=6 OR theMonth=9 OR theMonth=11,If(theDay>30,30,theDay), If(theMonth=2 AND leapYear, If(theDay>29,29,theDay), If(theMonth=2 AND leapYear=0,If(theDay>28,28,theDay),theDay))); {ddmmyy} theNewDate:=(theDay*10000)+(theMonth*100)+Mod(theYear,100); theNewDate; --8<-------------------------------------- See what you can do with this. theNewDate is the date exactly three months after the last instance that Fml("Max DLRL Delta 20") was true. You might need some latches or something toprevent multiple instances etc resetting the three months etc. The return date is just a date. It doesnt match to trading days or anything else so you are going to have work around that. Anyway, see how you go. Any problems, just let me know. Hope this helps. wabbit :D
kanellop  
#32 Posted : Thursday, May 4, 2006 4:33:45 PM(UTC)
kanellop

Rank: Advanced Member

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

Dear Wabbit, First i want to note to do not "kill" me, with, my maybe strange thought... I see it for a little your Formula and i put it into my Indicator Builder. Still is a little chaotic for my Side. Exist some problems. That are: Where is the Second Expression of Formula/s into your Basic Formula. Also i do not want to have Dates as Result, i think. Only 1 for the True and 0 for the False of that.
I want to repeat here my basic thought again. Do you believe that exist Date Formula which can make the following thing: When a Formula occurs in any Day, for example the Formula/s: Fml("Max DLRL Delta 20") (or for example, the other Formula Fml("APO H 120") or any other Formula that someone can imagine if you like), then from the Day that the above Formula is TRUE, meaning that occurs, or we have TRUE Signal of it, 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") (or for example, the other Formula Fml("APO H 120") or any other Formula that someone can imagine if you like), occur exactly the 31/10/2005, then, when happen that, 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.
As you can see, does not exist inside the Formula that you create, the: (HHV(H, 20)-L)*100/HHV(H, 20) > 15 Also i need the 1 for the True and 0 for the False of all that. George K.
wabbit  
#33 Posted : Friday, May 5, 2006 12:38:58 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, You don't know me that well do you? Did you really think I was going to do all the work for you??? I had to leave you to do something yourself! Have a try at including your second criteria. You know when the first date event occurs, my code will tell you when the three months are up, there has been enough code to sink a battleship to decide if another date is between two dates, so all you have to do is put it all together, if(betweendates, if(second criteria, then, else), else ) etc Have a go. If you get stuck, ask for help. wabbit :D
kanellop  
#34 Posted : Saturday, May 20, 2006 8:55:18 AM(UTC)
kanellop

Rank: Advanced Member

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

I want to note that this Formula, that i was think, it was not possible from my Side to create it!!! I admit that Fact, because i believe, that is beautiful someone to accept that, from to befool his self that can create that Formula Project! After that, i was think how i will resolve the Problem of the Creation of that Formula! After some thought i decided to sent a Message to (I know that you know that Forum Person!) the Forum Person named... JOSE SILVA!!! I sent my Basic Thought to Jose and Jose answer me that can create that Project! Also i asked Jose if had any Problem to publish that Project! Kindly told me that not, the only thing that told me is to say their Name in the Forum! So, after that i received the Project from Jose plus some very Valuable definitions able to that! I want here to say that in my Eyes that Project seems like a Piece of Art! I do not know how many of the Forum Members are Collectors from very small Things to very Big Things, but i have that Emotion for that Project! Also i hope that Project to be Valuable to any Forum Member. I want to tell here that i have decide to write first the Basic Formulas. After i will write some more Informations that Jose gave me, because i had some Questions about the Project! Kind Regards, George Kanellopoulos.
kanellop  
#35 Posted : Saturday, May 20, 2006 9:06:34 AM(UTC)
kanellop

Rank: Advanced Member

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

"Hi George, This project was trickier to code than I thought, but I have tested it on several charts and it plots perfectly. Please see attached pic. I have added some useful extra options to the code - let me know what you think. And if you are happy with the code, please don't forget to mention it in the forum. ;) Regards, jose MetaStock -> Tools -> Indicator Builder -> New -> Copy and paste all three complete formulae between "---8<---" lines. Make sure all indicators are named correctly. ========================== George-K - Original signal ========================== ---8<----------------------------- { Place original signal code below. Example: } Cross(Mov(C,63,S),Mov(C,252,S)) ---8<----------------------------- =============================== George-K - Calendar Day counter =============================== ---8<------------------------------------ {Gregorian calendar Week/Day counter v3.0. Count is independent of any missing chart data. ©Copyright 2002~2006 Jose Silva. The grant of this license is for personal use only - no resale or repackaging allowed. All code remains the property of Jose Silva. http://www.metastocktools.com } { User inputs } adj:=Input("Week's start: [0]Sunday, [1]Monday",0,1,1); plot:=Input("Count: [1]Weeks, [2]Days",1,2,2); { Calendar counter engine } leap:=Frac(Year()/4)=0 AND Frac(Year()/100)<>0 OR Frac(Year()/400)=0; y:=Year()*365+Int(Year()/4) -Int(Year()/100)+Int(Year()/400)-730484; m:= If(Month()=2,31-leap, If(Month()=3,59, If(Month()=4,90, If(Month()=5,120, If(Month()=6,151, If(Month()=7,181, If(Month()=8,212, If(Month()=9,243, If(Month()=10,273, If(Month()=11,304, If(Month()=12,334, -leap))))))))))); DayNr:=y+m+DayOfMonth(); adj:=adj+If(DayNr<1,1,2) -(Frac(Year()/100)=0 AND Frac(Year()/400)<>0); WkCount:=Int((DayNr-adj)/7)+(Year()>=2000); { Plot in own window } If(plot=1,WkCount,DayNr) ---8<------------------------------------ ================================= George-K - Extended Binary signal ================================= ---8<----------------------------------- { Extends original binary signal by Nth weeks or months. Signal extension period is independent of any missing chart data. ©Copyright 2006 Jose Silva. The grant of this license is for personal use only - no resale or repackaging allowed. All code remains the property of Jose Silva. http://www.metastocktools.com } { User inputs } pds:=Input("Extend original signal by x periods",0,520,3); type:=Input("Extension periods, use: [1]Weekly, [2]Monthly",1,2,2); fill:=Input("Fill binary signal? [1]Yes, [0]No",0,1,1); { Reference signals } signal:=Fml("George-K - Original signal"); { Reference Calendar day/week counter } day:=Fml("George-K - Calendar Day counter"); week:=FmlVar("George-K - Calendar Day counter","WKCOUNT"); { Calendar month adjustment } m:=Month(); nuMonth:=m<>Ref(m,-1) OR Cum(1)=2; leap:=Frac(Year()/4)=0 AND Frac(Year()/100)<>0 OR Frac(Year()/400)=0; adj:=If(m=5 OR m=7 OR m=10 OR m=12,1, If(m=3,3-leap,0))*nuMonth; adj:=Cum(adj)-ValueWhen(1,signal,Cum(adj)); mthPds:=pds*31-adj; mthPds:=If(mthPds<1,1,mthPds); { Count Calendar periods since signal } counter:=day-ValueWhen(1,signal,day); wkCounter:=week-ValueWhen(1,signal,week); { Extended signal binary by x periods } weekSignal:=wkCounter>=0 AND wkCounter<pds; weekSignal:=If(signal AND weekSignal=0, signal,weekSignal); mthSignal:=counter>=0 AND counter<mthPds; { Select weekly or monthly extension } extSignal:=If(type=1,weekSignal,mthSignal); { Eye candy } even:=Frac(Cum(1)/2)=0; odd:=Frac(Cum(1)/2)<>0; { Plot in own window } If(fill*extSignal,even,0); If(fill*extSignal,odd,0); extSignal ---8<----------------------------------- "
kanellop  
#36 Posted : Saturday, May 20, 2006 9:10:21 AM(UTC)
kanellop

Rank: Advanced Member

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

Dear Jose, Thank you for your Job! The Formula is very complicated for to understand it with a first look. Let me ask you if the "Original Signal" , meaning, the any first Formula, that i had mention in my Messages i mean: Fml("APO L 120") (or for example, the other Formula Fml("APO H 120") or any other Formula that someone can imagine if you like) ? Also i can not found where is the second Expression that must also occurs, into your Formulas, i mean, (HHV(H, 20)-L)*100/HHV(H, 20) > 15 Kind Regards, George K.
kanellop  
#37 Posted : Saturday, May 20, 2006 9:11:47 AM(UTC)
kanellop

Rank: Advanced Member

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

Hi George, > The Formula is very complicated for to understand it with a first > look. I've added comments wherever possible to help understanding. > Let me ask you if the "Original Signal" , > meaning, the any first Formula, that i had mention in my Messages i > mean: > > Fml("APO L 120") > (or for example, the other Formula Fml("APO H 120") or any other > Formula that someone can imagine if you like) ? Exactly - you can put any code inside that indicator, such as Fml("APO L 120"), Fml("APO H 120"), or any MetaStock code. > Also i can not found where is the second Expression that must also > occurs, into your Formulas, i mean, > > (HHV(H, 20)-L)*100/HHV(H, 20) > 15 I've made the final "George-K - Extended Binary signal" without any secondary signals, so that it is easier for you to test if it is working accurately. I've also made the indicator as modular and flexible as possible, so that you can use it with other formula conditions as well. For your condition above, create a new indicator: ---8<--------------------------- (HHV(H,20)-L)*100/HHV(H,20) > 15 AND Fml("George-K - Extended Binary signal") ---8<--------------------------- It's as easy as that! :) Now the [(HHV(H,20)-L)*100/HHV(H,20) > 15] signal will only appear within the 3 month period from the original signal. You can also copy the original "George-K - Extended Binary signal" indicator, and change the last three lines of code: >From this: { Plot in own window } If(fill*extSignal,even,0); If(fill*extSignal,odd,0); extSignal To this: { Plot in own window } (HHV(H,20)-L)*100/HHV(H,20) > 15 AND extSignal Regards, jose
kanellop  
#38 Posted : Saturday, May 20, 2006 9:14:18 AM(UTC)
kanellop

Rank: Advanced Member

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

> Let me ask you also, if i want to choose the exactly Months from 3, > to 6 and after to 9 for my Research, where i can make that? In the indicator's user input: "Extend original signal by x periods" Choose 6 or 9 periods.
kanellop  
#39 Posted : Saturday, May 20, 2006 9:17:39 AM(UTC)
kanellop

Rank: Advanced Member

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

Dear Jose, Hello Again. I want to ask you something important. You include on all that Formula/s, the Day Phenomenon that exist in the February, every 4 Years with 29 Days? In my Message when, Suppose, the Signal occurs in 30 November 2005, Then the 3 Month Period for calculation is until and 28 and February 2006. But forgot to say the following: Suppose now, the Signal occurs in 30 November 2004. Then the 3 Month Period for calculation is until and 29 February 2004. So, you include and that in the Formula/s? Kind Regards, George Kanellopoulos.
kanellop  
#40 Posted : Saturday, May 20, 2006 9:19:53 AM(UTC)
kanellop

Rank: Advanced Member

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

Hi George, Very good question. Of course, being the best MetaStock programmer in the world I had to include provision for extremely accurate leap years (Feb 29) in the formula. :) Plot this sample indicator from your project code: ---8<-------------------------------- leap:=Frac(Year()/4)=0 AND Frac(Year()/100)<>0 OR Frac(Year()/400)=0; leap ---8<-------------------------------- Regards, jose
Users browsing this topic
Guest (Hidden)
3 Pages<123>
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.