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:
Follow the Leader
Author/Uploader:
Kelly Griffiths - (email hidden)
Date/Time added:
2004-10-06 00:45:08
Origin:
Kelly Griffiths (October 5, 2004)
Keywords:
volume institution profit loss stopbars
Level:
basic
Flags:
system
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:
This follows institutional investing by using volume as an indicator.
Formula:
/*
Follow The Leader.
Kelly Griffiths (4Oct04)
Large volume trades can have a quick impact on the price of a position up or
down (supply and demand). Institutions are typically responsible for
most large volume trades. I developed this formula to track the trading
activity of institutional investors, so that a small investor can capitalize
on thier research without doing the research.
Some assumptions are made that are typical of institutional investors. The
first assumption is that institutional investors follow trading practices
that require them to sell at certain percentage gains or losses. The next
assumption is that institutional investors will not hold on to a stock
for more than a given number of days in order to minimize their exposure.
The final assumption is that institutional investors have done their
homework and know when to buy, hold or sell.
This formula identifies the days when institutional investors buy or sell
(SinceLastHit). It also records the price that was paid on that day
(CLast). It then tracks the profit/loss that the institutional holders
have made since their purchase (ChLast). Using some averages, I came up
with some settings to determine what the selling points will be
(SellHigh and SellLow) and how many days to hold the position (StopBars).
My goal is not to present the most optimal solution, although this is not bad
as it stands. My intent is to share the fundamental formula so that others
can integrate it with their own trading systems.
*/
// Settings
SellHigh = 15; // Selling percentage for profit
SellLow = -11; // Selling percentage for loss
StopBars = 70; // Time window to hold position
BackRef = 150; // Number of days to look back (identify peaks)
MaxChLast = 2.8; // This ensures the profit is not already gone
RSIMin = 40; // Minimum RSI for entry
// Number of bars since the last volume spike
SinceLastSpike = BarsSince(V>(MA(V,BackRef)+StDev(V,BackRef)));
// Closing price since the last volume spike
CLast = Ref(C,-SinceLastSpike);
// Profit/loss percentage (multiplied by 100)
ChLast = ((C-CLast)/CLast)*100;
// Trading rules
PositionScore = RSI();
Buy = Cross(ChLast,0) AND (ChLast<MaxChLast) AND IIf(RSI()>RSIMin,1,0);
Sell = Cross(ChLast,SellHigh) OR Cross(SellLow,ChLast);
ApplyStop(stopTypeNBar,stopModeBars,StopBars);
// Exploration
Filter = Buy OR Sell;
AddColumn(IIf(Buy,66,83),"Signal",formatChar);
AddColumn(SinceLastSpike,"Bars since last spike");
AddColumn(ChLast,"Change % since last spike");
AddColumn(RSI(),"Reletive strength");
Comments:
Neil neil-p [at] westek.co.za 2004-10-11 06:47:39
Hi Kelly,
Excuse my ignorance here.
If I run explore I get the columns you specify in exploration.
How do I get the rest to work?
{This formula identifies the days when institutional investors buy or sell
(SinceLastHit). It also records the price that was paid on that day
(CLast). It then tracks the profit/loss that the institutional holders
have made since their purchase (ChLast). Using some averages, I came up
with some settings to determine what the selling points will be
(SellHigh and SellLow) and how many days to hold the position (StopBars). }
Thanks,
Neil.
Kelly Griffiths
2004-10-11 10:59:11
You could try running a backtest to get a feel for how well it performs. The main goal is to track prices and price change on large volume days. You could add the following line to see a chart of the results:
Graph1=ChLast;
Neil
2004-10-13 09:17:40
Thank you.
ntk98_2000
2004-10-13 19:29:31
ooops why chlast is always 0!
ntk98_2000
2004-10-14 01:43:24
ooops why chlast is always 0!
Gary gary [at] colonycapital.net 2010-04-07 12:33:46
Quick question, can this work with the S&P e-minis?