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

Notification

Icon
Error

Options
Go to last post Go to first unread
dlcheetham  
#1 Posted : Friday, June 2, 2006 12:04:46 PM(UTC)
dlcheetham

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 5/31/2006(UTC)
Posts: 7

Hi, could anyone show me how to test if the current price is above or below the high price on the last 'significant day'. i.e. I want to ignore any 'inside days' in the test. Thanks in advance. :D
StorkBite  
#2 Posted : Friday, June 2, 2006 5:30:03 PM(UTC)
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)
Hi dlc- What about something like this?
Quote:
a:=ValueWhen(1,Inside(),C); b:=If(C>a,1,If(C<a,-1,0)); b;0
or [code:1:227f885abe]a:=LastValue(ValueWhen(1,Inside(),C)); b:=If(C>a,1,0); b[/code:1:227f885abe]
dlcheetham  
#3 Posted : Saturday, June 3, 2006 8:51:57 AM(UTC)
dlcheetham

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 5/31/2006(UTC)
Posts: 7

Hi, thanks for the reply, but is there any chance you could explain how this works ? I'm very new to all this (as you can tell) and I'm trying to get to grips with the syntax using examples such as these. Thanks in advance. =D>
wabbit  
#4 Posted : Saturday, June 3, 2006 9:38:17 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)
dlcheetham, Using your MS Users Manual and the Formula Primer, read each line of code and then put the whole pictude together: a:=ValueWhen(1,Inside(),C); Return the value of the CLOSE on the last time there was an Inside() day and store this value in the variable 'a' b:=If(C>a,1,If(C<a,-1,0)); If the CLOSE is larger than the value stored in the variable 'a' then store a value of '1', otherwise, if the CLOSE is less than 'a' store a value of '-1', otherwise store a value '0': values are stored in the variable 'b' b;0 Draw line of the variable 'b' and another line at zero -- a:=LastValue(ValueWhen(1,Inside(),C)); Same as before, but this time we will only take the very last value of 'a' b:=If(C>a,1,0); Could have been re-written: b:=C>a; If the CLOSE is bigger than 'a' then return a value of '1' otherwise return zero. b plot the line of the value of 'b' Hope this helps. wabbit :D P.S. G_ has answered what he believed your question was; I don't think that he has answered your problem about 'significant days.' Perhaps what you should have done was to very clearly explain what makes a day "significant' and then there would be no confusion.
dlcheetham  
#5 Posted : Saturday, June 3, 2006 1:57:55 PM(UTC)
dlcheetham

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 5/31/2006(UTC)
Posts: 7

Guys, first off, this is great. This forum is really something, thanks. To clarify my question.... In terms of what I am looking for, an 'inside day' is one in which the price does not exceed the previous day. The 'significant day' is the opposite i.e. one in which the price has exceeded the price of the previous day. I have attached a picture to show what I mean as I think its easier to understand. UserPostedImage I don't believe the MS definition of inside day fits what I am looking for. For the system I am trying to write, I want the move to be confirmed by waiting for the price to move above the highest point on the last 'significant day' for going long and for the price to move below the lowest point on the last 'significant day' for going short. Once again guys, thanks for your help. I feel as though the fog is lifting, its just not lifting fast enough yet..... :wink:
Jose  
#6 Posted : Saturday, June 3, 2006 7:33:52 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)
Dlcheetham, perhaps the fog needs to lift a little more... :) Your definition of an inside day is at odds with the generally accepted view: A day in which the total range of price is inside the range of the previous day's price range. You'll have a better chance of resolving your TA issue if you label chart conditions in a more conventional way: [code:1:cca772550a]HiDay:= H>Ref(H,-1); HiDayReversal:= H<Ref(H,-1); LoDay:= L<Ref(L,-1); LoDayReversal:= L>Ref(L,-1); [/code:1:cca772550a] Looking at your last pic still leaves me confused as to what your required condition is about. I'll leave it up to others to decipher it. :) jose '-)
StorkBite  
#7 Posted : Saturday, June 3, 2006 11:02:26 PM(UTC)
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)
Hi DLC- Sorry about that... suppose I wasn't clear on your query. MS defines inside days like this:
UsersManual wrote:
Plots a "+1" when an inside day occurs. An inside day occurs when today's high is less than or equal to the high for the previous rally or reaction day and today's low is greater than or equal to the previous rally or reaction day's low. A range is determined by the first Inside Day and is only broken by a Rally, Reaction, or Outside day.
Perhaps then, you might be calling an Outside day as significant? MS defines outside days like this:
UsersManual wrote:
Plots a "+1" when an outside day occurs. An outside day occurs when today's high is greater than the high for the previous rally or reaction day and today's low is less than the previous rally or reaction day's low. A range is determined by the first Outside Day and is only broken by a Rally, Reaction, or Inside day.
There are a variety of ways that you might develop rules that interact with these functions. I thought you just wanted a nudge in the right direction... Yes W, my code could have been abbreviated, but I thought seeing it expressed long hand might be useful! [size=9:62bfc538d7][whispering="Geesh..."][/size:62bfc538d7] :P In addition the ones listed in this thread already, here are some more snippets that you might be able to use: [code:1:62bfc538d7]{ last inside day } lid:=Inside(); { high of last inside day } hlid:=ValueWhen(1,Inside(),H); { no output directed; just for reference } [/code:1:62bfc538d7] [code:1:62bfc538d7]{ last outside (significant??) day } lod:=Outside(); { line not used... just for reference } { high of last outside day } hlod:=ValueWhen(1,Outside(),H); { marker } Cross(C,hlod)[/code:1:62bfc538d7] You might also look up 'range switch' and 'breakout' type indicators. If you get stuck putting your thoughts together, just post back what you have and we will work through it with you.
dlcheetham  
#8 Posted : Sunday, June 4, 2006 8:39:13 AM(UTC)
dlcheetham

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 5/31/2006(UTC)
Posts: 7

Thanks guys, you have given me plenty to work with for now. I'll have a go and get back to you if I get stuck. One last quick question. Are there any tools available for creating test data, that I could use to verify my code when it is finished or do I just have to create the data by hand ? Regards Dave C :D
wabbit  
#9 Posted : Sunday, June 4, 2006 10:41:02 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)
There are many ways to get test data: The easiest is just to use a "typical" stock. Pick one of your favourites, or a stock where you "know" something about he prices etc The other is to use a tool like Excel and create your own data. I have two sets of data, one is randomly generated and the other follows a specific pattern as required by my testing regime. After you have created the data, just use the Downloader to convert into MS. wabbit :D
dlcheetham  
#10 Posted : Sunday, June 4, 2006 11:18:57 AM(UTC)
dlcheetham

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 5/31/2006(UTC)
Posts: 7

Thanks again, I'll mark this thread as resolved for now as I think I have everything I need. If I do get stuck, I'll create a new thread. Regards Dave C
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.