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

Notification

Icon
Error

Options
Go to last post Go to first unread
hayseed  
#1 Posted : Wednesday, May 3, 2006 2:43:40 AM(UTC)
hayseed

Rank: Advanced Member

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

zoran [censored]er has a neat habit of marking fundamental events on his highly technical charts.... then we can better see it's a blend of technical and fundamental events that move the markets.... zoran will actually hinge charts at times to specific events.... metastock enables us to do the same..... my accounts on the short side took a big hit on 4/18/06.... it was not from being technically wrong, technically i was right..... a statement from the fed minutes released that morning , perceived as fundamentally bullish , moved the markets against me.... of course my accounts on the long side, received a windfall boost..... but the point is later, the true why, right , wrong , reason of it all might be long forgotten..... by marking such events on the chart zoran keeps a better perspective of past..... without it, someone many months later looking at the chart technically only, might draw wrong conclusions .... perhaps then it will appear as the widely used 89 day ema stood, when in fact it had more to do with reaction to a fundamental event..... or a blend of both..... meta can help us size up the +/- of such events.... as an example, if we were to add up the volume in advance/decline style from a particular point in time we would hinge the chart, or at least one window, to that event in time.... it would be helpful to zero the indicator from that day.... meta allows us to do that.... if we use moving averages tied to that date, the usual lag will exist.... wabbit has helped in that area.... using his dll gets us to zero in smooth fashion.... the indicators below are set to 1/03/06 but could be pegged to any event .... the top most window has wabbits ma in red overlaid with the standard lag ma in blue for clear comparison.... the second window has wabbit's ma in red/blue and the pure adv/dec in green.... all together now, "good work wabbit".... the indicator is straight forward, just set your values and date.... meta and wabbits dll will take it from there.... i changed date inputs to match henry's much appreciated suggestion....... you'll need wabbit's dll for the indicator to work as is.... just give him a holler, but fair warning, be sure to mention you've read the manual cover to cover 15 times......h [code:1:cdf6a27c43]pnt:=Input("close=1, high=2, low=3",1,5,1); pds1:=Input("fast macd periods 1",2,100,5); pds2:=Input("slow macd periods 2",3,100,9); pds3:=Input("moving average trigger periods 3",2,100,3); date:=Input("date mmddyyyy",111990,12312100,1032006); plot:=Input("adv/dec =1",0,1,1); 0; upv:=Cum(If(If(pnt=2,H,If(pnt=3,L,C))>Ref((If(pnt=2,H,If(pnt=3,L,C))),-1),V,0)); dnv:=Cum(If((If(pnt=2,H,If(pnt=3,L,C)))<Ref((If(pnt=2,H,If(pnt=3,L,C))),-1),V,0)); a:=upv-dnv; aa:=ValueWhen(1, Date=Month()*1000000 + DayOfMonth()*10000+ Year(),a); aaa:=a-aa; b:=ExtFml( "myMA2.SMA",aaa ,pds1 ) - ExtFml( "myMA2.SMA",aaa ,pds2 ) ; bb:=ExtFml( "myMA2.SMA",b,pds3 ) ; If(plot=1,aaa,0); b;bb[/code:1:cdf6a27c43]
wabbit  
#2 Posted : Wednesday, May 3, 2006 3:27: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)
Ahh that takes me back to mid 2004! --8<-------------------------------- {Date Modified OBV v2.10} {©Copyright 2004 wabbit} x:=Input("1-O, 2-H, 3-L, 4-C",1,4,4); x:=If(x=1,O,If(x=2,H,If(x=3,L,C))); 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); shift:=LastValue(BarsSince(betweenDates)); vValue:=If(x>Ref(x,-1),V,If(x<Ref(x,-1),-V,0)); myOBV:=If(betweenDates,Cum(If(betweenDates,vValue,0)),0); myOBV:=Ref(Ref(ValueWhen(1,betweenDates,myOBV),-shift),+shift); myOBV; --8<-------------------------------- Now made sooooo much easier if you use the external calls! wabbit :D
wabbit  
#3 Posted : Wednesday, May 3, 2006 3:39:18 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)
x:=Input("1-O, 2-H, 3-L, 4-C",1,4,4); x:=If(x=1,O,If(x=2,H,If(x=3,L,C))); FirstDate:=Input("Start yyyymmdd (0=first trade)",0,20201231,20060101); LastDate:=Input("End yyyymmdd (0=last trade)",0,20201231,0); betweenDates:= ExtFml( "Forum2.DateRange", FirstDate, LastDate); vValue:=If(x>Ref(x,-1),V,If(x<Ref(x,-1),-V,0)); myOBV:=Cum(betweenDates*vValue); myOBV; wabbit :D
Jose  
#4 Posted : Wednesday, May 3, 2006 3:22:20 PM(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)
Wabbit, MetaStock doesn't deal that well with large numbers - this is the point that Roy was trying to draw attention to in an earlier post. Plot the indicator below, and note the shifted output on your screen: 20,060,10[color=red:9fe1b9da75]0[/color] ---8<--------------------------------------------------------- FirstDate:=Input("Start yyyymmdd (0=first trade)",0,20201231,2006010[color=green:9fe1b9da75]1[/color]); FirstDate ---8<--------------------------------------------------------- jose '-)
wabbit  
#5 Posted : Thursday, May 4, 2006 12:07:28 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)
Yes Jose, we know this limitation BUT there is a limitation on that limitation. Although in the Input window the last value displays 0, if you replace the errant 0 with the correct 1 then all is well again. Although the Input window rounds of the function to x-significance (or however its doing it) the value sent to the external call is correct to whatever precision you tell it. Precision errors come back again when you try to do fine computations on large numbers in MS. Thats why the large date format is sent to the external call, whole. The .dll can handle the precision. MS cannot. Try this: FirstDate:=Input("Start yyyymmdd (0=first trade)",0,20201231,20060101); ExtFml("Forum2.DateRange", FirstDate,0) and see the result move with daily precision. wabbit :D
Jose  
#6 Posted : Thursday, May 4, 2006 8:06:20 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)
wabbit wrote:
Although in the Input window the last value displays 0, if you replace the errant 0 with the correct 1 then all is well again.
Unfortunately not so on my screen. The indicator's user input accepts 20060101 but absolutely refuses to display it.
Quote:
Although the Input window rounds of the function to x-significance (or however its doing it) the value sent to the external call is correct to whatever precision you tell it.
I'm far from convinced. If a value is stored within a MS variable (complete with precision errors), then surely that same rounded-off value will be passed on to any dll call. I don't have the Forum2.dll to test this, as I prefer to keep DLLs to the necessary minimum for a relatively stable MetaStock. Since MetaStock loads all DLLs on startup, too many can sometimes upset MetaStock's poor memory management. jose '-)
wabbit  
#7 Posted : Thursday, May 4, 2006 9:05:24 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)
Jose, I concede some ground. I have just run the two million tests through MS to a .dll to watch the change in the passed values. It seems that MS does do some precision 'rounding' but, for the life of me, I cannot see any logical pattern. Sometimes 99 is rounded to 00, sometimes to 98 and sometimes not at all. 01 is sometimes rounded to 00, sometimes to 02 and sometimes not at all. It seems mainly that odd numbers are rounded to even numbers, but not always. These values tests were between 18000101 and 20201231... the range that most people would associate with dates and historical data. As the precision within MS 'changes' (dare I say randomly?? plus or minus one) then it leads to the reconsideration on how "date" information needs to be passed around in MS. It has been just lucky that in the past the test values have all worked as planned. Reworking the original test: this time using values 000000 to 311299 there does not appear to be any precision rounding. This means that we can represent date ranges year xx in one centrury to year xx-1 in the next century, with some additional code to work out which is which. e.g. 1920 to 2019, 1999 to 2098 etc These test are only as accurate as my testing rig, running MS8 on my machine etc etc I will rewrite the dateRange function to accept user date information in for ddmmyy to avoid the precision error. Any future "date" values should be within this range too. It happens to be already the case in the dates 'thingie' I wrote for George! -- On the other note, I have about 47 .dll files (4.4MB) in my MS8 folder and don't ever seem to have any problems with memory management issues. (P3 1GB RAM, 7200rpm 120GB HDD Win XP Pro SP2) When I am running some big system tests (rarely) I do a couple of other gucci things with Windows to speed up the process, but generally the system is left alone to do its thing. I haven't tried stacking the External Functions Folder to test the effects. Above what number of files do you think causes problems, and your MS and machine specs?? wabbit :D P.S. All, Please don't ask me for the tricks: they are not for the risk adverse or the computer newbie. Get it wrong and there are SERIOUS consequences! I learned the hard way and sometimes still manage to stuff it up!
wabbit  
#8 Posted : Thursday, May 4, 2006 9:14:03 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... one more thing. Once the data enters the external function, it remains unadulterated all the way through. External functions have better precision than MS. wabbit :D
Jose  
#9 Posted : Thursday, May 4, 2006 10:07:14 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)
Wabbit, the DLL's internal processing accuracy is of little consequence if MetaStock's input & output processes are compromised by binary/low precision errors. As for MetaStock's memory management problems, it has little to do with available system memory management. Just for the record, I'm now running MS Pro v8.01 on a dual-core XP SP2 notebook, with 2GB ram, 100GB/7200rpm HDD, latest drivers & o/s patches. jose '-)
hayseed  
#10 Posted : Thursday, May 4, 2006 12:36:11 PM(UTC)
hayseed

Rank: Advanced Member

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

hey jose, wabbit...... do ya reckon thats why henry has his date format reversed.... it doesn't appear to effect it the same way..... or at least my limited testing didn't reveal it..... will look deeper at it today.....h henry's
FirstDate:=Input("Start mmddyyyy (0=first trade)",0,12012007,01011995); FirstDate
date changing varity
FirstDate:=Input("Start yyyymmdd (0=first trade)",0,20201231,20060101); FirstDate
--------------------------------------------
wabbit  
#11 Posted : Thursday, May 4, 2006 1:22:55 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)
I will run it through my test rig on Saturday and let you know. (Uni Friday). wabbit :D
Jose  
#12 Posted : Thursday, May 4, 2006 2:13:23 PM(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)
hayseed wrote:
hey jose, wabbit...... do ya reckon thats why henry has his date format reversed.... it doesn't appear to effect it the same way..... or at least my limited testing didn't reveal it..... will look deeper at it today.....h
The integer format really doesn't make much difference - any number longer than 6-7 digits is affected by MetaStock's lower precision issue. This is why I use dd/mm/yyyy format in the date filter indicators. jose '-)
henry1224  
#13 Posted : Friday, May 5, 2006 12:14:20 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)
A1:=Input("date A mmddyyyy",1011960,12312100,1032000); B1:=Input("date B mmddyyyy",1011960,12312100,1052000); C1:=Input("date C mmddyyyy",1011960,12312100,1072000); PKTR:=Input("B1=TR,B2=PK",1,2,1); PLT:=Input("Middle DGL",-1,6,1); PLT2:=Input("ABC's 1=yes,2=no Optional",1,2,1); BSA:=BarsSince(A1=((Month()*1000000) + DayOfMonth()*10000+ (Year()))); BSB:=BarsSince(B1=((Month()*1000000) + DayOfMonth()*10000+ (Year()))); BSC:=BarsSince(C1=((Month()*1000000) + DayOfMonth()*10000+ (Year()))); AP:=ValueWhen(1,A1=((Month()*1000000) + DayOfMonth()*10000+ (Year())),C); BP:=If(PKTR=1,ValueWhen(1,B1=((Month()*1000000) + DayOfMonth()*10000+ (Year())),L),ValueWhen(1,B1=((Month()*1000000) + DayOfMonth()*10000+ (Year())),H)); CP:=If(PKTR=1,ValueWhen(1,C1=((Month()*1000000) + DayOfMonth()*10000+ (Year())),H),ValueWhen(1,C1=((Month()*1000000) + DayOfMonth()*10000+ (Year())),L)); If(PLT2=1,AP,AP); If(PLT2=1,BP,AP); If(PLT2=1,CP,AP); Pick 3 pivots A,B,C from Left to right enter their dates in A1 B1 C1 if the price of b is lower than the prices of a and c then select 1 in the PKTR selection Plot onto the price chart and select the option to merge with scale on right
henry1224  
#14 Posted : Friday, May 5, 2006 12:28:50 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)
FirstDate:=Input("Start mmddyyyy (0=first trade)",01011990,12312100,01011995); A:=ValueWhen(1,firstDate=((Month()*1000000) + DayOfMonth()*10000+ (Year())),C); A; in the firstdate function your maximum valueshould be 12312100 = Dec 31,2100
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.