Welcome Features News Download Registration Support FAQ Wish list Links
Advanced stock charting and analysis program

AFL Library

This is read-only version of AFL library entry. Ability to add user formulas and comment is only available from members-only area.

Details:

Formula name: Gap and Circuit
Author/Uploader: Ravi S Ghosh - ravisghosh [at] gmail.com
Date/Time added: 2008-02-25 08:16:50
Origin: Bangalore, India
Keywords:
Level: medium
Flags: exploration

DISCLAIMER: Most formulas present in AFL on-line library are submitted by the users and are provided here on an "as is" and "as available" basis. AmiBroker.com makes no representations or warranties of any kind to the contents or the operation of material presented here. We do not maintain nor provide technical support for 3rd party formulas.
Description:

It is an exploration that scans those scrips that open and close above earlier day's price for 2 consecutive days thus forming a bullish pattern (long candidates) or those scrips open and close below earlier day's price for 2 consecutive days thus forming a bearish pattern (shorting candidates). Usually, these stocks hit circuits. This kind of gaps appear very frequently and mostly every day in some stocks which make them multibagger. I have tried to create "sell" for long positions and "cover" for short positions, but I feel they are inadequate. Please suggest improvements in this exploration.

Formula:

//Gap and Circuit
//Coded by Ravi S Ghosh (email: ravisghosh@gmail.com)
//It is an exploration that scans those scrips that open and close above earlier
day's price for 2 consecutive days thus forming a bullish pattern (long
candidates) or those scrips open and close below earlier day's price for 2
consecutive days thus forming a bearish pattern (shorting candidates). Usually,
these stocks hit circuits. This kind of gaps appear very frequently and mostly
every day in some stocks which make them multibagger. I have tried to create
"sell" for long positions and "cover" for short positions, but I feel they are
inadequate. Please suggest improvements in this exploration.

Buy = 	Low > Ref( High , -1 )
	AND Close == High 
	AND Ref( Low , -1 ) > Ref( High , -2 )
	AND Ref( Close , -1 ) == Ref( High , -1 );

Sell = 	Low < Ref( High , -1 )
	AND Ref( Low , -1 ) > Ref( High , -2 );

Short = 	High < Ref( Low , -1 )
	AND Close == Low 
	AND Ref( High , -1 ) < Ref( Low , -2 )
	AND Ref( Close , -1 ) == Ref( Low , -1 );

Cover = 	High > Ref( Low , -1 )
	AND Ref( High , -1 ) < Ref( Low , -2 );

Comments:

Ravi S Ghosh
ravisghosh [at] gmail.com
2008-02-26 22:56:10
problem in the above formula:

The above formua finds stocks which meet the condition on consecutive days. Whereas the better thing would be to find stocks which meet the same condition frequently since it will include some other stocks which did not show the above feature on consecutive days. How can one add "frequency" in an afl??
AbdulKareem
AlGhamdi1 [at] hotmail.com
2008-03-05 20:32:13
Thanks Ravi,
instead of (Low > Ref( High , -1 )), use GapUp().
and instead of (High < Ref( Low , -1 )), use GapDown()

and instead of (Ref( Low , -1 ) > Ref( High , -2 )), use Ref(GapUp(), -1).

and instead of (Ref( High , -1 ) < Ref( Low , -2 )), use Ref(GapDown(), -1)

Also, you can find islands using GapUp() and GapDown() functions in day before and day after.
AbdulKareem
AlGhamdi1 [at] hotmil.com
2008-03-14 16:02:38
Ravi,

I hope that I understood your need:

_SECTION_BEGIN("Frequency Tings ");
Period = Param("Period", 5, 2);

Plot(LLV(C, Period), "", colorRed);
Plot(HHV(C, Period), "", colorGreen);
_SECTION_END();
Ravi S Ghosh
ravisghosh [at] gmail.com
2008-03-25 11:13:40
Abdul, after the initial changes suggested by you, the formula will look like this:

Buy = GapUp()
AND Close == High
AND Ref(GapUp(), -1)
AND Ref( Close , -1 ) == Ref( High , -1 );

Sell = Low < Ref( High , -1 )
AND Ref(GapUp(), -1);

Short = GapDown()
AND Close == Low
AND Ref(GapDown(), -1)
AND Ref( Close , -1 ) == Ref( Low , -1 );

Cover = High > Ref( Low , -1 )
AND Ref(GapDown(), -1);


Now this has the same effect as the earlier one but it is simple. Still, it searches for consecutive gaps rather then frequency of it. The changes u suggested regarding frequency were outside my understanding (sorry, i'm a noob). Could you please put that in the formula.
Ravi S Ghosh
ravisghosh [at] gmail.com
2008-03-28 22:55:18
Abdul, after you recommendations, the afl looks like this.

Buy = GapUp()
AND Close == High
AND Ref(GapUp(), -1)
AND Ref( Close , -1 ) == Ref( High , -1 );

Sell = Low < Ref( High , -1 )
AND Ref(GapUp(), -1);

Short = GapDown()
AND Close == Low
AND Ref(GapDown(), -1)
AND Ref( Close , -1 ) == Ref( Low , -1 );

Cover = High > Ref( Low , -1 )
AND Ref(GapDown(), -1);

It has the same effect as the previous one but only less coding.

Now, how to put your later recommends about frequency. Sorry, if that is a newbie question (since I'm one).


About | Privacy | Terms of Use | Contact information
Copyright © 2001 AMIBROKER.COM