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 : Friday, November 20, 2015 11:37:44 AM(UTC)
osolo

Rank: Member

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

Thanks: 1 times

Hi All

I need some help to create a explorations formula to find securities that have gap down of more then 20% in the last year.

Thanks

Edited by user Friday, November 20, 2015 11:40:55 AM(UTC)  | Reason: Not specified

MS Support  
#2 Posted : Friday, November 20, 2015 4:34:51 PM(UTC)
MS Support

Rank: Advanced Member

Groups: Moderators, Registered, Registered Users, Subscribers
Joined: 10/8/2010(UTC)
Posts: 1,960

Thanks: 92 times
Was thanked: 155 time(s) in 150 post(s)
Hello, You'd need to be a bit more specific in what you are looking for. Are you comparing day to day changes? Are you comparing yesterday's close to today's open, or are you comparing yesterday's low to today's high?
mstt  
#3 Posted : Saturday, November 21, 2015 12:22:31 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

Yes you do need to be more specific. However I've put together a couple of formulas that work on the CLOSE to CLOSE basis (current CLOSE compared to the previous CLOSE). If you need to work with other prices then you can copy my formulas and make relevant changes to the copies.

I like to create an indicator before attempting an exploration, for the simple reason that it's usually easier to display the results of an indicator (just drop it onto a chart) than an exploration. This approach is especially helpful if exploration results are difficult to achieve or make sense of. In this case I've created two indicators and then merged them into one exploration. The "Full Year Range" indicator identifies the most recent year of daily data, and this gives a more accurate data range for the last 12 months than, for example, looking at the last 252 data bars of a security.

Make sure that you load enough records for the exploration to include several bars PLUS the current years data. The "Load Minimum Records" option should not be used for this scan as none of the functions used will force the Explorer to load sufficient data of its own accord.


{Full Year Range}
ED:=LastValue(DayOfMonth()); SD:=ED+1;
EM:=LastValue(Month()); SM:=EM;
EY:=LastValue(Year()); SY:=EY-1;
FYR:=DayOfMonth()>=SD AND Month()=SM AND Year()
=SY OR Year()>SY OR Year()=SY AND Month()>SM;
FYR;

{Full Year Gap-Downs}
{C at least 20% lower than previous C }
{Full Year Range}
ED:=LastValue(DayOfMonth()); SD:=ED+1;
EM:=LastValue(Month()); SM:=EM;
EY:=LastValue(Year()); SY:=EY-1;
FYR:=DayOfMonth()>=SD AND Month()=SM AND Year()
=SY OR Year()>SY OR Year()=SY AND Month()>SM; Gap:= FYR AND C<ref(c,-1)*0.8;
Gap;

The exploration follows. Column A reports all current (last bar) gap downs Column B accumulates all gap downs for the most recent 12 months. The filter looks for any value of column B that is greater than zero. The "Gap" variables in columns A and B can be easily modified to use different prices and percentages (0.8 represents a 20% drop).

{Full Year Gap-Downs}
{Gaps down over last 12 Months}

{ColA: Current Gap Down}
{C at least 20% lower than previous C } Gap:= C<ref(c,-1)*0.8;
Gap;

{ColB: Full Year Gap-Downs}
{C at least 20% lower than previous C }
{Full Year Range}
ED:=LastValue(DayOfMonth()); SD:=ED+1;
EM:=LastValue(Month()); SM:=EM;
EY:=LastValue(Year()); SY:=EY-1;
FYR:=DayOfMonth()>=SD AND Month()=SM AND Year()
=SY OR Year()>SY OR Year()=SY AND Month()>SM; Gap:= FYR AND C<ref(c,-1)*0.8;
Cum(Gap);

{Filter}
colB>0;

Hope this helps.
Roy (mstt)
</ref(c,-1)*0.8;
</ref(c,-1)*0.8;
</ref(c,-1)*0.8;

Edited by user Saturday, November 21, 2015 12:41:50 AM(UTC)  | Reason: Added comment not to use "Load Minimum Records" option

thanks 1 user thanked mstt for this useful post.
osolo on 11/22/2015(UTC)
osolo  
#4 Posted : Sunday, November 22, 2015 11:06:41 AM(UTC)
osolo

Rank: Member

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

Thanks: 1 times

Hi Roy

The code is exactly what that I need, it works perfect.

Thank you

 

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.