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

Notification

Icon
Error

Options
Go to last post Go to first unread
osolo  
#1 Posted : Tuesday, August 11, 2015 10:27:30 PM(UTC)
osolo

Rank: Member

Groups: Registered Users, Subscribers, Unverified Users
Joined: 7/1/2015(UTC)
Posts: 12

Thanks: 1 times

Hi All

I am hoping to find help in creating a formula that can explore, and gives the list of stocks that increase in 25% in value from the lowest close value in one year. 

Thanks

mstt  
#2 Posted : Thursday, August 13, 2015 4:50:14 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 osolo Here's an exploration that I think finds the securities you're looking for. Following the exploration there's an indicator using essentially the same code as the exploration. The indicator allows you to measure all CLOSEs that are greater than 25% above the lowest CLOSE in the past year. 252 trading days can be used as a rough 12 month trading period, but I've used a more consistent (and accurate) method for measuring the look-back range. Only those securities that trigger the 25% gain rule on the current bar will be included in the explorations results. The indicator, however, will show appropriate percentage gains for all bars where the 25% threshold is met. Hope this helps. Roy {One Year 25% Rise Filter} {Exploration} {Find stocks increasing 25% in value} {from the lowest CLOSE in the past year} {colA: % Rise} D:=DayOfMonth(); M:=Month(); Y:=Year(); Range:=D>=LastValue(D) AND M>=LastValue(M) AND Y=LastValue(Y)-1; R:=Cum(Range)=1; BasePrice:=LowestSince(1,R,C); Target:=CLOSE>=BasePrice*1.25; ValidRise:=100*(Target*C/BasePrice-Target); ValidRise; {ColB: CLOSE} C; {Filter} colA; {One Year 25% Rise Filter} {Indicator} {Find stocks increasing 25% in value} {from the lowest CLOSE in the past year} D:=DayOfMonth(); M:=Month(); Y:=Year(); Range:=D>=LastValue(D) AND M>=LastValue(M) AND Y=LastValue(Y)-1; R:=Cum(Range)=1; BasePrice:=LowestSince(1,R,C); Target:=CLOSE>=BasePrice*1.25; ValidRise:=100*(Target*C/BasePrice-Target); ValidRise;
osolo  
#3 Posted : Thursday, August 13, 2015 12:35:47 PM(UTC)
osolo

Rank: Member

Groups: Registered Users, Subscribers, Unverified Users
Joined: 7/1/2015(UTC)
Posts: 12

Thanks: 1 times
Thank you for writing the code.
osolo  
#4 Posted : Friday, August 14, 2015 4:12:01 AM(UTC)
osolo

Rank: Member

Groups: Registered Users, Subscribers, Unverified Users
Joined: 7/1/2015(UTC)
Posts: 12

Thanks: 1 times

 

Hey mstt

I tried the explorations code, but in the end results it didn't pick any securities at all.

May be I didn't set the formula correct in the exploration editor. 

if you have any ideas, please let me know.

 

Thanks again

mstt  
#5 Posted : Friday, August 14, 2015 5:26:43 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 osolo I think I know what your problem is, but first did you use the indicator on any charts to check the results that should have come up in the exploration? If you've checked a few likely charts and the indicator has shown more than a straight line of zeros then you've just verified that the code works OK. There's really no difference between the indicator and column A on the exploration and the indicator. How many bars do you plot on a normal chart? And how many bars do you load for an exploration? I'm guessing that your Explorer is set to "Load Minimum Records", and if you are then that's the problem. Some MetaStock functions force the Explorer to load about 30% more data. Sadly quite a few function functions don't do that, and LowestSince() is one of those. You must load at least enough bars to look back beyond the one-year point. To put it simply, if you use "Load Minimum Records" for the Explorer then you're pretty much guaranteed of getting no results or false results on a regular basis. As I said, some functions will force the Explorer to load sufficient records, but the down side is that a significant number don't. For example, the Directional Movements (ADX etc.) functions will return inaccurate results using Minimum Records, and the list of others in the same boat is quite a long one. Hope this helps. Roy
osolo  
#6 Posted : Friday, August 14, 2015 9:37:50 AM(UTC)
osolo

Rank: Member

Groups: Registered Users, Subscribers, Unverified Users
Joined: 7/1/2015(UTC)
Posts: 12

Thanks: 1 times

So here are some details,

I am using 250 period display, and load 5000. Also the indicator formula is working.

I guess the 25% rule can't be much on the exploration search.

Thanks again for the entire help

mstt  
#7 Posted : Friday, August 14, 2015 10:15:21 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 osolo So the indicator is working but the exploration is not? Before posting the exploration I ran it on the US S&P 500 (my US data ends in December 2014) and I got a hit rate of just over 50%. That was a much higher hit rate than i expected, and just now I ran it on the Russell 1000 and got pretty much the same result. That result had small a percentage with much higher returns. Roy
osolo  
#8 Posted : Friday, August 14, 2015 12:04:32 PM(UTC)
osolo

Rank: Member

Groups: Registered Users, Subscribers, Unverified Users
Joined: 7/1/2015(UTC)
Posts: 12

Thanks: 1 times

Can you s[censored] an example how you put the code in the exploration editor?

 

osolo  
#9 Posted : Friday, August 14, 2015 12:05:58 PM(UTC)
osolo

Rank: Member

Groups: Registered Users, Subscribers, Unverified Users
Joined: 7/1/2015(UTC)
Posts: 12

Thanks: 1 times

Can you show how you put the code in the exploration editor?

 

mstt  
#10 Posted : Saturday, August 15, 2015 1:25:37 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 osolo The following ZIP file link provides a self-installing EXE for MetaStock version 9.1 or above. This EXE just has the the indicator and exploration that I created for you a few days ago. The EXE was generated by the MetaStock Development Kit (MDK) and there are no DLLs or other unwanted material included. http://www.metastocktips...ator_and_exploration.zip Roy
osolo  
#11 Posted : Monday, August 17, 2015 11:24:04 AM(UTC)
osolo

Rank: Member

Groups: Registered Users, Subscribers, Unverified Users
Joined: 7/1/2015(UTC)
Posts: 12

Thanks: 1 times

Hey Roy

Thanks for sending me the ZIP file, I run the file, and got the exploration.  But even that the results is still empty, I am guessing something is wrong with my settings.  Should I increase in "Load Option", the "Display" to 250 periods?

Thanks again

mstt  
#12 Posted : Monday, August 17, 2015 7:25:36 PM(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 osolo 260 bars (records) is the absolute minimum you should load, but 300 to 500 would be a safer choice. I used 500 records for testing the exploration. Roy
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.