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

Notification

Icon
Error

2 Pages12>
Options
Go to last post Go to first unread
robcpettit  
#1 Posted : Tuesday, June 14, 2005 2:21:58 PM(UTC)
robcpettit

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 5/6/2005(UTC)
Posts: 52
Location: England

Hi, using the formula CloseDiff:= LastValue(C)-C ; CloseDiff; gives me negative and positive results which is what i want. This is plotted in a seperate window whis an advisor which simply plots a vertical line 41 days ago for quick reference. I also have a horizontal line at 0.0. What I would now like to do is 1 of 2 things. Is it possible to count all values smaller than 0 (negative values) up to the point that they turn positive. So if the first 5 = -ve thats all that would be counted regardless of whar happens after. Secondly, and not as important because it would be more a luxury, is it possible to count -ve from 41 days ago then whan it changes the positive then when it changes the -ve etc, but not acumalating them but as individaul results. Ie 5=-ve then 10+ve then 5-ve then 20 +ve, and possibly listed in sequence. As I say the seconds not important. Once again thanks for any help. Regards Robert
wabbit  
#2 Posted : Tuesday, June 14, 2005 2:44:11 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)
rob, Its a bit late for me to strat thinking too ghard on this one, but I would start by defining when 41 bars ago occurs: you can then start counting from there: CloseDiff:=LastValue(C)-C; x0:=Cum(1)>(LastValue(Cum(1))-41); x1:=If(x0=1 AND CloseDiff<0 AND BarsSince(x0=1 AND CloseDiff>0)>0, PREV+CloseDiff,PREV); x1; Does this do what you want? I didnt get the full grasp of exactly what you were looking for. Perhaps a drawing or graph might help? wabbit :D
wabbit  
#3 Posted : Tuesday, June 14, 2005 3:16:07 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)
or another possibility: {uses Roy Larsen's latch} lookback:=41; CloseDiff:=LastValue(C)-C; x0:=Cum(1)>(LastValue(Cum(1))-lookback); N:=x0=1 AND CloseDiff<0; X:=x0=1 AND CloseDiff>=0; I:=Cum(N+X>-1)=1; Tr:=BarsSince(I OR N)<BarsSince(I OR X); If(Tr,PREV+CloseDiff,PREV); wabbit :D
wabbit  
#4 Posted : Tuesday, June 14, 2005 3:35:03 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)
robcpettit wrote:
Secondly, and not as important because it would be more a luxury, is it possible to count -ve from 41 days ago then whan it changes the positive then when it changes the -ve etc, but not acumalating them but as individaul results. Ie 5=-ve then 10+ve then 5-ve then 20 +ve, and possibly listed in sequence.
You cannot list them, but you can certainly count them to return the total days: Just return the +ve days and -ve days: {uses Roy Larsen's latch} lookback:=41; CloseDiff:=LastValue(C)-C; x0:=Cum(1)>(LastValue(Cum(1))-lookback); Up:=If(x0=1 AND CloseDiff>0,PREV+1,PREV); Dn:=If(x0=1 AND CloseDiff<0,PREV+1,PREV); Up; -Dn; To count the number of consecutive days: {uses Roy Larsen's latch} lookback:=41; CloseDiff:=LastValue(C)-C; x0:=Cum(1)>(LastValue(Cum(1))-lookback); N:=x0=1 AND CloseDiff<0; X:=x0=1 AND CloseDiff>0; I:=Cum(N+X>-1)=1; Tr:=BarsSince(I OR N)<BarsSince(I OR X); Dn:=-If(Tr,BarsSince(tr=0),0); Tr:=BarsSince(I OR X)<BarsSince(I OR N); Up:=If(Tr,BarsSince(tr=0),0); Up; Dn; Thats about the limit of my imagination tonight.... Let me know how it goes. wabbit :D
wabbit  
#5 Posted : Tuesday, June 14, 2005 3:50:32 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)
repalce Up and Dn with: ValueWhen(1,x0,Up); {green histogram} ValueWhen(1,x0,Dn); {red histogram} and format as described.... just a little more funky wabbit :D
robcpettit  
#6 Posted : Tuesday, June 14, 2005 4:42:53 PM(UTC)
robcpettit

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 5/6/2005(UTC)
Posts: 52
Location: England

Wabbit, just got back in, thanks for all the info, something to be getting on with this evening, let you know how it goes. Regards Robert
robcpettit  
#7 Posted : Tuesday, June 14, 2005 9:51:36 PM(UTC)
robcpettit

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 5/6/2005(UTC)
Posts: 52
Location: England

quick update, got sidetracked as downloaded roys doc on latches. Interesting stuff, take a few reads to grasp, just shows again the benefit of this group, had I not asked this question I would have not known about the existence of latches, I wont say benefit yet as not read doc. Thanks Wabbit Regards Robert
wabbit  
#8 Posted : Tuesday, June 14, 2005 10:24: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)
also proves the age old.... Don't ask - don't get wabbit :D
robcpettit  
#9 Posted : Wednesday, June 15, 2005 11:05:47 AM(UTC)
robcpettit

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 5/6/2005(UTC)
Posts: 52
Location: England

Wabbit, The last one is the one Ive Used lookback:=41; CloseDiff:=LastValue(C)-C; x0:=Cum(1)>(LastValue(Cum(1))-lookback); N:=x0=1 AND CloseDiff<0; X:=x0=1 AND CloseDiff>0; I:=Cum(N+X>-1)=1; Tr:=BarsSince(I OR N)<BarsSince(I OR X); Dn:=-If(Tr,BarsSince(tr=0),0); Tr:=BarsSince(I OR X)<BarsSince(I OR N); Up:=If(Tr,BarsSince(tr=0),0); ValueWhen(1,x0,Up); {green histogram} ValueWhen(1,x0,Dn); {red histogram} Ive got it as a histogram and it looks good. What I tried to do this morning is were the details show in the title is to alter it so rather then show the latest count for either up or down it would show consective count since -41. Ie plotted on my chart I got histogram from -41 I got -9,+21,-4,+4,-3. I thought if there was a way of displaying this in the tilte bar it would be a qhick reference. I thought maybe Id have to create several indicators, but I couldnt work out how to tell ms to stop when first count completed, then the next indicator to use this value to alter the lookback parameters. Good fun though. Regards Robert
robcpettit  
#10 Posted : Wednesday, June 15, 2005 11:37:42 AM(UTC)
robcpettit

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 5/6/2005(UTC)
Posts: 52
Location: England

Wabbit. I thought Id explain what Im doing. I dont know how to add pictures. Basically I have a weekly chart with 41 week centered m/a. (plotted 20 weeks prev). on this chart I have a horizontal line marking the point 41 weeks ago. This is my drop point for the average. As Im sure you know the next calculated m/a point is add this weeks close and drop close 41 periods ago. This is all from brian Millards Books. Imagine youve printed two copys of your charts, one you place infront of you, the other you cut through the horizontal line and discard the piece prev to this point. taking the remaing piece with todays prices on lay at the end of your other copy. This gives a quick visual as to wether tommorows m/a wil rise or fall. Ie if price greater than 41 weeks ago then rise and vica versa. I cant really to this for 100 or so shares in metastock so I thought an Indicator taking todays close from 41s ago would be as good. if its minus then rising positve then falling. Taking it one stage further and anticipating the future, Ive assumed todays close will be tommorows and day after and forever. (obviously it wont). The todays close - 41, then -40, -then -39 etc which I have with CloseDiff:= LastValue(C)-C ; CloseDiff; Now with the indicator rabbits advised I have quick visual on the amount of weeks the m/a would rise or fall if the price remained the same. I have to emphasise this is in no way a buy/sell indicator, it is a quick visual aid to the m/a anticipated performance. What Ive found though is the greater the distance from 0, you would have to have a dramatic price change today to alter the m/a. The reason for the ability to show the data in the title bar is twofold, 1 im lazy it saves me counting the bars when scanning through 100 shares and 2, when doing an exploration I d like to able to ask for shares which have been +ve for more than 5 weeks from 41 weeks ago. Sorry if Ive waffled on Regards Robert
wabbit  
#11 Posted : Wednesday, June 15, 2005 12:14: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)
mmmm.... I am not exactly sure where to start in the response to your last post :roll: Although I sure Dr Millard PhD is happy he knows what he is doing, I will question his ability to make money in the market. A quick gogle did not reveal a lot of answers to his methodologies; it did however lead to a lot of book sales (many of which were second hand!) This does not bode well that the system developed by this person is much chop.. but I will let you decide the worth of his system yourself. Without making some very complex switches and latches, I think what you are looking for is a little beyond the 'normal' application of the MS coding system I am sure Jose will want to have a stab this one when he gets back from his holidays, because he just loves challenges like this one! My suggestion in the short term is to define whether you want to count every series above and below the zero difference line and return each count (very hard to do - not impossible though) or just return the longest consecutive run which can be dine by implementing the first code response for counting and running it over the ValueWhen(1,x0,Up) variables: e.g Highest(ValueWhen(1,x0,Up)) Hope this helps. wabbit :D P.S. I still think you might have to find a better way to decribe this baffling system! Open a chart, plot your indicators, add comments and text and symbols to the chart. Save as HTML. Post here and add the .jpg file as an attachment. Might help.
robcpettit  
#12 Posted : Wednesday, June 15, 2005 12:47:53 PM(UTC)
robcpettit

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 5/6/2005(UTC)
Posts: 52
Location: England

First attempt attachment. You may be searching the wrong millard, its Brian Millard Channel Analysis based on J hurst. Here Goes. Regards Robert
wabbit  
#13 Posted : Wednesday, June 15, 2005 1:09:39 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)
Robert, See http://www.qudospubs.co.uk/ Do you have a fast internet connection at your place? ADSL, broadband or something similar? Do you use VoIP? I use and avocate SkyPE. It would be easier to talk to you, if you dont we could meet in the MS chat system sometime - not tonight, but maybe at about this time (13:00 GMT) tomorrow? wabbit :D
robcpettit  
#14 Posted : Wednesday, June 15, 2005 1:32:08 PM(UTC)
robcpettit

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 5/6/2005(UTC)
Posts: 52
Location: England

Wabbit, Ive got broadband, tommorow Im back at work, I work shift, next 4 days Im on days. Ill look at skype and have a look at ms chat, didnt realise there was a chat room. Ive seen the quodos site before, and have his software, but its very unflexible and ties you into his ideas, which although I like some, its of no benefit if I cant try others. Regards Robert
wabbit  
#15 Posted : Wednesday, June 15, 2005 1:41:53 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)
MS chat is actually the MS community button in the toolbar.... You have to get a fix for it (in most circumstances) if your system wont connect to the chat server. Patrick posted a fix here on the forum (somewhere). A search will find it fast. SkyPE is good. Chat is good. I dont really care which, although I can talk faster than I can type! 'nd me torking is godder than my sepling! :lol: wabbit :D
edwin4400  
#16 Posted : Saturday, June 25, 2005 9:25:55 AM(UTC)
edwin4400

Rank: Member

Groups: Registered, Registered Users
Joined: 6/22/2005(UTC)
Posts: 29
Location: Singapore

Hi, I need a formula to add to itself whenever a condition is true. But the numbers i check manually is incorrect. I have tried to use PREV function in the bold section to make it remember the last X value but it still won't work. Please help. Thanks, Edwin C1:=(O<=Ref(H,-1) AND O>=Ref(C,-1)); X:=Cum(Fml("open-close")); C2:=If(C1,X,Ref(X,-1)); C2
wabbit  
#17 Posted : Saturday, June 25, 2005 10:23:59 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)
Is This it? C1:=(O<=Ref(H,-1) AND O>=Ref(C,-1)); C2:=If(C1,Fml("open-close"),PREV); C2 wabbit :D P.S. I dont know what is in Fml("open-close"). Maybe its something here that is causing the problem? If the formula is as simple as the name suggests, try this for faster execution: C1:=(O<=Ref(H,-1) AND O>=Ref(C,-1)); C2:=If(C1,O-C,PREV); C2
edwin4400  
#18 Posted : Saturday, June 25, 2005 10:50:36 AM(UTC)
edwin4400

Rank: Member

Groups: Registered, Registered Users
Joined: 6/22/2005(UTC)
Posts: 29
Location: Singapore

Hi Wabbit, Thanks for the prompt response. Yes, fml("open-close") is indeed Open-Close price. I tried exactly the Prev function as what u suggested earlier on but the summation value is still incorrect. This are my results: C1:=(O<=Ref(H,-1) AND O>=Ref(C,-1)); C2:=If(C1,Fml("open-close"),PREV); C2 Bar1 - C1 is False, Open-close=0.25, therefore C2 return value of 0 Bar2 - C1 is True, Open-close=0.75, C2 returns value of 1 (bar1+bar2) or 0.75 I still cant figure it out. Maybe u can try on yr stocks to see what I mean. Thanks, Edwin
edwin4400  
#19 Posted : Saturday, June 25, 2005 11:01:31 AM(UTC)
edwin4400

Rank: Member

Groups: Registered, Registered Users
Joined: 6/22/2005(UTC)
Posts: 29
Location: Singapore

Hi Wabbit, U have removed the Cum function. Which means that the value from O-C cannot be summed up. I need it to sum up so that it can be an equity line whenever the condition C1 is true. Hope I made it clear. Thanks, Edwin
Patrick  
#20 Posted : Saturday, June 25, 2005 3:20:09 PM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
Do you not want to reset it? like: C1:=(O<=Ref(H,-1) AND O>=Ref(C,-1)); C2:=If(C1,Fml("open-close")+PREV,PREV); C2 Patrick :mrgreen:
Users browsing this topic
Similar Topics
Add counting date to the indicator (Formula Assistance)
by kkrishna79 4/4/2023 7:40:03 AM(UTC)
Counting Closes (Formula Assistance)
by OrsonCarte 9/8/2020 4:49:11 PM(UTC)
Bar counting (Basic Coding Techniques)
by Flexi 8/1/2014 1:18:19 PM(UTC)
Counting bars to locate Fib and Lucas numbers. (Formula Assistance)
by singhvi 7/1/2012 3:19:58 AM(UTC)
counting reset (MetaStock)
by Flexi 1/30/2012 11:32:13 AM(UTC)
Counting days above a moving average (Formula Assistance)
by dexter 12/1/2010 6:20:50 AM(UTC)
Counting bars (Basic Coding Techniques)
by Flexi 9/27/2010 10:34:55 PM(UTC)
Counting of days (MetaStock)
by DonVinci 9/16/2008 2:58:42 AM(UTC)
CODING COUNTING FOR DEMARKS COMBO OR SEQUENTIAL WITH ALERTS, & SYMBOLS,ETC (Formula Assistance)
by shadmax 3/25/2008 7:42:16 PM(UTC)
Counting consecutive bars [RESOLVED] (Formula Assistance)
by ferrdav 7/7/2006 6:54:19 PM(UTC)
Counting bars dilemma [RESOLVED] (Formula Assistance)
by Perigon 6/5/2006 8:34:52 AM(UTC)
Mark-to-market accounting [RESOLVED] (General Chat)
by StorkBite 2/15/2006 8:21:31 AM(UTC)
Counting bars of previous events without using lastvalue (MetaStock)
by weird 2/4/2006 9:17:15 AM(UTC)
2 Pages12>
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.