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