You are on page 1of 9

Stocks & Commodities V.

21:9 (44-55): Detecting Breakouts In Intraday Charts by Markos Katsanos


INDICATORS

The Infinitely Useful FVE

Detecting Breakouts In
Intraday Charts
Here’s an important enhancement to the finite volume elements Where:
indicator that’s especially useful with intraday minute charts. C= Today’s closing price
H= Today’s high
by Markos Katsanos L= Today’s low
Typical = (H+L+C)/3
the April 2003 STOCKS & COMMODITIES, I Typical-1= Yesterday’s typical price

In
introduced the finite volume elements indi- Cutoff coefficient = 0.3%
cator (FVE) and demonstrated how it can be
used to detect breakouts in daily charts. To The component on the right-hand side of (2) is the thresh-
refresh your memory, the FVE is a money old parameter of the indicator and is a function of price only.
flow indicator, but it has two important inno- I tested the indicator on daily charts and found that 0.3% was
vations: first, the FVE takes into account both intra- and the optimal value for the cutoff coefficient. I did not take
interday price action, and second, minimal price changes are volatility into account, thus avoiding the extra complication
taken into account by introducing a price threshold. in the formula and the controversy surrounding the subject of
Those innovations were introduced to improve on two whether stock price changes are normally distributed. The
important limitations of existing money flow indicators: drawback of this method, however, is that the constant cutoff
coefficient will overestimate price changes in minute charts
■ Intraday money flow indicators (such as Chaikin’s and underestimate corresponding changes in weekly or
money flow or intraday intensity) leave out all price monthly charts.
action from the close to the next day’s open. This Based on the rule of square root of time, price changes of
omission should not go unnoticed, since major news a random time series (such as stocks) move approximately
such as earnings numbers are usually released over- proportional to the square root of the interval difference (see
night. “Suggested reading and references”). The constant cutoff
coefficient, therefore, should be adjusted to take into account
■ Similar interday money flow indicators such as on- the appropriate price interval using the formula below:
balance volume† (OBV) add or subtract the volume from
a running total, depending on whether the stock closed T
higher or lower. Thus, OBV will increase by all the day’s Cutofft = cutoffd * (3)
390
volume even if the security closed just one cent higher
than the previous close. In designing FVE, I introduced a Where:
threshold that will exclude minimal price changes. T = Chart interval in minutes
CutoffT = Cutoff for chart interval T
The FVE formula is: Cutoffd = Cutoff for daily chart
t
Σ (+V, V, 0)
1
FVE = * 100 (1) Cutoff coefficients have been calculated for all time frames
MA (V, t) * t
provided in Figure 1. These will have to be adjusted manually
Where: in the FVE formula.
t = Time segment chosen If you are using a tick interval chart, keep in mind that it has
MA(V, t) = t-day moving average of volume no intrabar extremes. The intraday component will vanish
V = Volume. It can take a +/- sign or zero value and the FVE formula will be reduced to a finite segment OBV
according to whether: indicator, but it will be more useful than OBV since it will
oscillate between zero and +/-100. This will make it easier to
H+L determine whether it is in a bullish or bearish state.
C + typical typical-1 > cutoff * C (2) An alternative way to calculate the cutoff coefficient,
2
or < -cutoff * C which will adjust to all time frames automatically, would be
to take volatility into account.
Copyright (c) Technical Analysis Inc.
Stocks & Commodities V. 21:9 (44-55): Detecting Breakouts In Intraday Charts by Markos Katsanos

DETERMINING VOLATILITY CUTOFF COEFFICIENTS FOR ALL TIME FRAMES


In calculating the historical volatility, the following
problems had to be addressed: Chart interval Minutes Sq. root Cutoff Period
of time coefficient for FVE
■ The shape of the distribution of stock price Tick 0.00 180
changes deviates from the norm and is usually
Minute 1 0.051 0.02 160
positively skewed (off-center)
5 min 5 0.113 0.03 100
10 min 10 0.160 0.05 75
■ Variance is not constant over time.
1/4 hr 15 0.196 0.06 60
1/2 hr 30 0.277 0.08 50
One appropriate method to remove anomalies
Hourly 60 0.392 0.12 40
and bring the distribution back to normal is to
Daily 390 1.000 0.30 22
convert prices to natural logarithms. The dynamic
Weekly 1950 2.236 0.67 13
effect of variance was addressed by calculating a
Monthly 40950 10.247 3.07 5
moving standard deviation over a short time span
equal to the finite time segment used to calculate FIGURE 1: The third column displays the square root of time relationship between different time
FVE. I forced the standard deviation to “move” by intervals. The fourth column displays the proposed cutoff coefficients for the old FVE formula
adding the most recent and dropping the oldest only. These are not to be used with the new volatility-enhanced formula. The fifth column
displays the proposed time span (in bars) for FVE and for different time interval charts.
value from the calculation.
Historical volatility involves two distinct compo-
nents: interday and intraday. Interday volatility was
calculated by taking the moving standard deviation of the Threshold = Cutoff*C
change of the log of the typical price (H+L+C)/3 over the most
recent time period. Intraday volatility was calculated by taking The cutoff is calculated according to volatility formula (4).
the moving standard deviation of the difference of the logs of Formula (4) is self-adjusting for each time interval. The
the day’s extreme values according to the following formulas: cutoff coefficients in Figure 1 should only be applied to the
constant threshold cutoff formula (2).
INTERV = standard deviation (ln(Typ)– ln(Typ–1))
INTRAV = standard deviation (ln(H)– ln(L)) DETECTING BREAKOUTS IN INTRADAY CHARTS
The most common setup for a breakout is when the FVE
Thus, the cutoff coefficient in inequality (2) was modified crosses the zero line at a steep angle, and in the process makes
according to the following formula: higher highs and higher lows. Major breakouts were better
detected on 30- or 60-minute charts. Stocks that were moving
Cutoff = 0.1* INTERV+ INTRAV sideways for some time, or basing for a relatively long period
(4) of time, produced the most violent breakouts. In order to
reduce noise, the time period used to calculate FVE in intraday
Where: minute charts had to be increased. The square root of time
Typical = (H+L+C)/3 relationship used to convert price changes did not produce the
Typical-1 = Yesterday’s typical price best results, as the time segments were too large.
INTERV = Interday volatility By testing on a number of stocks for different time frames,
INTRAV = Intraday volatility I found that an approximate cubic root relationship existed
ln = natural (to the base e) logarithm between the time segment used and the chart interval. This
can be expressed mathematically with the following formula:
The constant 0.1 is a universal optimum value derived by
testing and is valid for all time frames.
The TradeStation and MetaStock codes for the modified Period T = periodd *
3 390
T (5)
FVE calculation are included in sidebars 1 and 2, respectively.
I have also included a formula to calculate color-coded Where:
volume bars according to inequality (2). Green is used for up PeriodT = Period for chart interval t in bars
volume (that is, MF>threshold), red for down volume (MF<- Periodd = Period for daily chart in bars
threshold), and blue when the stock does not move either way
by more than the threshold, where: Thus, to convert from a 22-day period on daily charts to the
appropriate period to use in a 60-minute chart, I multiply 22
H +L by the cube root of 390/60 to get 41 bars. Values for the most
MF = C + Typical Typical -1
2 common minute charts can be found in Figure 1. Unless
and optimization produces any better ones, these values can be
Copyright (c) Technical Analysis Inc.
Stocks & Commodities V. 21:9 (44-55): Detecting Breakouts In Intraday Charts by Markos Katsanos

used in intraday charts. If you use values smaller than those ■ Condition 3: FVE should be above its 40-day expo-
proposed, it will make the indicator more sensitive but at the nential average.
expense of superfluous readings that are only suitable for
very short-term trading. Condition 2 reduced the undesirable effect of whipsawing
around the zero line, and the combination of conditions 2 and
EXAMPLES 3 ensured that FVE was rising from below.
From February 14, 2003, until March 17, 2003 (Figure 2), the The requirement for the stock to be moving sideways was:
stock of Geron Corp. (GERN) was moving sideways or slightly
down. On March 12, FVE started diverging (on the 60-minute ■ Condition 4: The stock’s 30-bar linear regression
charts), rising sharply to cross the zero line
at 15:30 on March 13. Three trading days 60-MINUTE CHART OF GERON CORP. (GERN) FROM 3/5/03 TO 4/10/03
later, GERN had surged an astonishing 215%
after announcing an important breakthrough
in its cancer research. The same setup was
repeated a few days later as FVE, diverging
from price, crossed the zero line at a very
steep angle. On March 27 at 15:30 it made
a series of two higher lows and two higher
highs. Two trading days after that, the stock
was up again by more than 100%. It looked
as if the sky was the limit for GERN.
The next day, just as the stock price
made another high, FVE started making FVE
lower highs. On 4/3/03 it nosedived to
cross its 30-day moving average, thus warn-
ing traders to get out.
On the 30-minute chart of Transmeta
Corp. (TMTA) displayed in Figure 3, the

TRADESTATION
breakout can be detected more easily. The Volume bars
stock price had dropped from a high of
$1.60 only a couple of months ago to less
FIGURE 2: You can see the 40-bar FVE moving sharply higher on 3/12/03 while the stock price was moving
than a dollar on April 22. But not for long. sideways. On 3/18/03 the price of the stock surged. Color-coded volume bars calculated by the volatility
On that date, the relentless selling abated formula are displayed in the bottom window.
and the stock started building a base, mov-
ing sideways for a week. FVE was limping 30-MINUTE CHART OF TRANSMETA CORP. (TMTA) FROM 4/21/03 TO 5/7/03
along below the zero line until May 2, when
it came to life abruptly, rose sharply, and
crossed the zero line. Two days later, the
stock broke out, rising more than 50%.

SYSTEM TESTING
In order to translate the setup described to
TradeStation EasyLanguage or MetaStock
formula language or any other software code,
I had to define it precisely. I did not use the
FVE
cross function available in both programs
because it produced too few or no trades at all.
Instead, the following two conditions de-
scribed FVE crossing the zero line:

■ Condition 1: FVE had to be between


-20 and 10.

■ Condition 2: The angle of the FVE


linear regression line had to be greater FIGURE 3: On 5/2/03 the FVE(50) rose sharply. Two days later the price of the stock rose more than 50%.
than 30 degrees.
Copyright (c) Technical Analysis Inc.
Stocks & Commodities V. 21:9 (44-55): Detecting Breakouts In Intraday Charts by Markos Katsanos

line should not rise more than DAILY CHART OF ATMEL CORP. (ATML) FROM 10/12/01 TO 3/31/03
0.6% or fall less than
FVE exit
-0.3% per day (for daily charts) FVE exit
or the corresponding percentages
in intraday charts.
FVE exit
Buy
Buy
This was expressed mathematically as Buy
follows:
FVE exit
LRV LRV -30
> -0.3% (6)
30 * LRV -30
Buy
Buy

which can be expressed in terms of the


linear regression slope:

LRS > -0.03%*LRV -30 (7)

By substituting for:

LRV LRV -30 FIGURE 4: This is a terrible-looking chart, the envy of ski-slope developers and the darling of short sellers.
LRS = tanα = (8)
30 This test detected all major breakouts and resulted in a respectful $17,000 profit with no short sales.

Where:
LRV = Linear regression value of 15-MINUTE CHART OF ATMEL CORP. (ATML) FROM 3/10/03 TO 5/6/03
the linear regression line at the FVE exit
latest bar
LRV-30 = Linear regression value of
the linear regression line 30 bars
ago
LRS = Slope of the 30-bar linear FVE exit

regression line FVE exit FVE exit FVE exit


FVE exit

This condition did not achieve a perfect Buy Buy


base, since it only ensured that the linear FVE exit
Buy Buy
Buy
Buy
regression line remained relatively flat
but did not exclude intermediate swings of
the stock price. I tried further constraints
Buy
but abandoned them, as they overwhelmed
the system and produced very few trades. FVE
No optimization was carried out. I used
the value for the FVE period proposed in
Figure 1 for each intraday interval, except
for the five-minute interval, where it had to
be increased slightly from 100 to 120 bars.
FIGURE 5: This was the clear winner, resulting in a net profit of $8,000.
Technical analysis is not an exact science.
I have found out by testing that in the case
of very small time intervals of five minutes
or less, the cube root of time relationship in None of the above strategies were particularly
formula (5) does not always work well for suitable for daytrading, since they involved keeping
every stock. The values proposed in Figure open positions overnight. Not surprisingly, the most
1 might have to be adjusted in the range of appropriate for daytrading was the five-minute
+/- 25%, but in order to obtain the best
results, they should not be adjusted less or strategy, with the average trade lasting no more than
more than the higher or lower time interval two calendar days or eight trading hours.
value, respectively.
Copyright (c) Technical Analysis Inc.
Stocks & Commodities V. 21:9 (44-55): Detecting Breakouts In Intraday Charts by Markos Katsanos

The square root of time relationship in


TOP CHART: 30-MINUTE CHART OF ATMEL CORP. (ATML) FROM 1/7/03 TO 5/2/03
formula (3) was used to calculate the linear
regression percentages suggested in the FVE exit
fourth condition for the different time FVE exit
frames. This relationship produced good TimeBarsLX
FVE exit
results up to the smallest time interval of the
Buy Buy FVE exit FVE exit
tests, and there was no need for any further FVE exit
FVE exit
adjustments. Buy Buy
Buy
Buy
The trade was exited after a certain number FVE exit Buy
Buy
of bars or when FVE declined at a steep angle.
More precisely, the exit conditions were: Buy

■ Condition 5: The linear regression line


of 20-bar FVE had to decline at an
angle of -20 degrees or less.

■ Condition 6: A 50-bar time exit was


applied to the daily charts. The exit
period was increased for intraday charts. Volume bars

In practice, a stop-loss condition should


also be applied. This was not included here, FIGURE 6: All three major breakouts were detected, but there was one big loss that reduced net profits.
as the purpose of the test was to compare the
efficacy of the different time frames. was the five-minute strategy, with the average trade lasting no
Tests were performed on the daily chart of Atmel Corp. more than two calendar days or eight trading hours.
(ATML) from September 4, 2001, to May 20, 2003, and on Different programs calculate and present the profit/loss
intraday 30-, 15-, and five-minute charts from January 10, report data differently, so these had to be checked manually.
2003, to May 20, 2003. I had to search through the usual plethora of test metrics to
The daily chart test (Figure 4) produced excellent results. present the most useful in Figure 7.
Despite the stock being in a precipitous decline, a long-only For the test to begin calculating FVE and its moving
test returned an astonishing $17,000 profit on $10,000 per average (2n1+n2–1), extra bars need to be loaded before the
trade capital, producing three winning long trades against actual start test date, where: n1= FVE period and n2= moving
the main trend. The buy and hold strategy lost a catastrophic average period. The variable n1 was added twice, once for the
$7,500. The test detected all three major breakouts in Octo- moving standard deviation and once for the FVE calculation.
ber 2001, March 2002, and October 2002, but only the last To calculate the buy and hold profit, the first date I used
one of the smaller breakouts in 2003, which was still open by was the date that the test could start producing trades — that
the end of the test. is, the first date loaded plus (2n1+n2–1). To calculate the
The stock was moving sideways during the intraday test system profitability, I used the following useful formula
period. There were three brief major breakouts, one in the published by Michael Harris in the September 2002 STOCKS
middle of March, a smaller one in the middle of April, and & COMMODITIES:
the last one at the beginning of May. All intraday tests
performed very well and produced at least $4,500 in profit, 1
Profitability = P
versus the small loss suffered by buy and hold investors. 1 + R wl (9)
The clear winner was the 15-minute test (Figure 5) with Where:
net profit of $8,000 versus a $500 buy and hold loss. It
N
detected all three breakouts and suffered no major losses. P= W (10)
N
The runnerup was the five-minute test. Despite missing two
out of the three major breakouts, it came ahead of the 30-
AvgW
minute test by detecting several minor ones only visible on R WL = (11)
AvgL
intraday charts.
The test on 30-minute charts (Figure 6) detected all three
major breakouts, but the results were impaired by a big loss. AvgW= Average winning trade
This could have been prevented with a stop-loss condition. AvgL= Average losing trade
None of the above strategies were particularly suitable for N= Total number of trades
daytrading, since they involved keeping open positions over- Nw= Number of winning trades
night. Not surprisingly, the most appropriate for daytrading Values below zero indicate losing systems.
Copyright (c) Technical Analysis Inc.
Stocks & Commodities V. 21:9 (44-55): Detecting Breakouts In Intraday Charts by Markos Katsanos
SYSTEM REPORT - FVE STRATEGY, Atmel Corporation. (NASDAQ: ATMEL)
Chart Interval 5-minute 15-minute 30-minute Daily
Figure - 5 6 4
Dollars per trade $10,000 $10,000 $10,000 $10,000
Commission per trade $10.00 $10.00 $10.00 $10.00
Total net profit (dollars/per trade constant) $4,668.30 $7,821.90 $4,495.70 $16,943.70
Annual percent gain/loss 122.6% 211.5% 125.3% 99.1%
Buy and hold profit -$505.37 -$465.98 -$1,230.15 -$7,513.31
Annual buy and hold percent gain/loss -13.3% -12.6% -34.3% -43.9%
Total number of trades 11 13 9 4
Winning trades 7 8 5 3
Losing trades 4 5 4 1
Percent profitable 63.64% 61.54% 55.56% 75.00%
Avg. trade profit/loss $424.39 $601.68 $499.52 $3,931.55
Avg. winning trade $783.11 $1,132.42 $1,386.80 $5,707.07
Avg. losing trade $203.37 -$247.50 -$609.57 -$1,395.00
Ratio avg. win/avg. loss 3.85 4.58 2.28 4.09
Profitability 1.54 1.42 0.94 2.80
Max. trade drawdown -$588.00 -$918.40 -$1,458.00 -$1,625.00
Reference bars needed 279 159 139 87
Start date/loaded data 12/26/02 12/26/02 12/26/02 5/1/01
Start date/test 01/02/03 01/06/03 01/10/03 09/04/01
End date 05/20/03 05/20/03 05/20/03 05/20/03
Test period/days 139 135 131 624
Time in the market (days) 21.2 34.1 33.1 142
% of time in the market 15.27% 25.25% 25.24% 22.76%
Avg. time in trades (days) 1.93 2.63 3.67 36
Avg. time in trades (bars) 92 43 36 25
Stock price at start of test 2.42 2.41 2.62 9.24
Stock price at end of test 2.30 2.30 2.30 2.30
SYSTEM PARAMETERS
FVE period 120 60 50 24
FVE entry lower bound -20 -20 -20 -20
FVE entry upper bound 10 10 10 10
FVE exp. moving average period 40 40 40 40
Linear regression period (bars) 20 20 20 20
Linear regression angle: entry (degrees) 30 30 30 30
Linear regression angle: exit (degrees) -20 -20 -30 -30
Closing price linear regression period (bars) 30 30 30 30
Upper bound (%) 0.07 0.12 0.17 0.6
Lower bound (%) -0.02 -0.04 -0.06 -0.2
Time exit (bars) 150 90 70 50
FIGURE 7: PROFIT/LOSS REPORT FOR FVE STRATEGY. Here you can see the results for the five-minute, 15-minute, 30-minute, and daily charts.

CONCLUSION REFERENCES AND SUGGESTED READING


You can increase the resolution of daily charts by using Harris, Michael [2002]. “Improve Your System With The
intraday charts to detect major breakouts that develop in a very Profitability Rule,” Technical Analysis of STOCKS & COM-
short period of time and could not be spotted otherwise on the MODITIES , Volume 20: September.
daily charts. I found the most appropriate interval for major Hinkle, D.E., W. Wiersma, and S.G Jurs [1998]. Applied
breakouts to be the 60- or 30-minute interval. By increasing the Statistics For The Behavioral Sciences, Houghton-Mifflin.
Katsanos, Markos [2003]. “Detecting Breakouts,” Technical
resolution further to the five-minute interval, you could detect
Analysis of STOCKS & COMMODITIES , Volume 21: April.
most microbreakouts, with the adverse effect, however, of LeFèvre, Edwin [1994]. Reminiscences Of A Stock Operator,
missing out on the major ones because of the unwanted noise. John Wiley & Sons. Originally published in 1923.
The 15-minute interval was a good compromise that Long, Erik [2003]. “Making Sense Of Fractals,” Technical
could detect most major and some minor breakouts. Keep in Analysis of STOCKS & COMMODITIES , Volume 21: May.
mind that there is no such thing as a perfect system. No Murphy, Joseph E. [1988]. Stock Market Probability, Irwin
matter how good the system is, and however highly unlikely Publishing.
the possibility of a loss is, it may happen to you, so it may Parkinson, Michael [1980]. “The Extreme Value Method For
be a good idea to use a stop-loss condition. Estimating The Variance Of The Rate Of Return,” The
Journal of Business 53:1, January.
Markos Katsanos is a structural engineer and a private trader. †See Traders’ Glossary for definition S&C

Copyright (c) Technical Analysis Inc.


Stocks & Commodities V. 21:9 (44-55): Detecting Breakouts In Intraday Charts by Markos Katsanos

SIDEBAR 1: TRADESTATION 7 CODE

1) Volatility-modified FVE formula: CINTRA(.1),CINTER(.1),Samples(22);


Variables:
Inputs: AlertFactor( 1 + AlertPct /100 ),
Samples(22),PERMA(40),CINTRA(.1),CINTER(.1); AlertStr( NumToStr( AlertPct, 2 ) ),
Variables: INTRA(0),INTER(0),VINTRA(0),VINTER(0),
TP(0),TP1(0),MF(0),VolumePlusMinus(0),FVE(0), CUTOFF(0),TP(0),TP1(0),MF(0);
FVEsum(0),
FveFactor(0),INTRA(0),INTER(0),VINTRA(0),VINTER(0), TP=(High + Low + Close)/3;
CUTOFF(0); TP1=(H[1]+L[1]+C[1])/3;
INTRA=LOG(High)-LOG(Low);
TP=(High + Low + Close)/3; VINTRA=StandardDev(INTRA,SAMPLES,1);
TP1=(H[1]+L[1]+C[1])/3; INTER=LOG(TP)-LOG(TP1);
INTRA=Log(High)-LOG(Low); VINTER=StandardDev(INTER,SAMPLES,1);
VINTRA=StandardDev(INTRA,SAMPLES,1); CUTOFF=CINTRA*VINTRA+CINTER*VINTER;
INTER=LOG(TP)-LOG(TP1); MF=(Close - (High + Low)/2)+ TP-TP1;
VINTER=StandardDev(INTER,SAMPLES,1);
CUTOFF=CINTRA*VINTRA+CINTER*VINTER; If BarType >= 2 then {i.e., not tick/minute data}
MF=(Close - (High + Low)/2)+ TP-TP1; Begin
If MF>CutOff*close then FveFactor=1 Plot1( Volume, “Vol” ) ;
Else if MF<-1*CutOff*Close then FveFactor=-1 Plot2( AverageFC( Volume, AvgLength ),
Else FveFactor=0; “VolAvg” ) ;
end
If BarNumber > samples then begin Else {if tick/minute data; in the case of minute data,
VolumePlusMinus = Volume * FVEFactor; also set the “For volume, use:” field in the Format
FVEsum = Summation(VolumePlusMinus,Samples); Symbol dialog to Trade Vol or Tick Count, as desired}
FVE=(FVEsum/(Average(Volume,Samples)*Samples))*100; Begin
Plot1( Ticks, “Vol” ) ;
Plot1(Average(FVE,1),”FVE”); Plot2( AverageFC( Ticks, AvgLength ), “VolAvg”
Plot2(XAverage(FVE,PERMA),”EMAFVE”); );
Plot3(0,”0"); End ;

Alert (“FVE “); {Color criteria}


Condition1=FVE>-20 AND FVE<10 ; If MF>CutOff*close then
Condition2=FVE> XAVERAGE(FVE,PERMA); SetPlotColor( 1, UpColor )
Condition3 =LinearRegANGLEFC(FVE,20)>30; Else if MF<-1*CutOff*Close then
If CONDITION1 AND CONDITION2 AND CONDI- SetPlotColor( 1, DownColor )
TION3 then Else SetPlotColor( 1, NeutralColor );
alert(“FVE”);
End; {Alert criteria}
If Plot1 crosses over Plot2 * AlertFactor then
The above code plots FVE and its 40-day exponential Alert( “Volume breaking through “ + AlertStr + “%
moving average. It will also alert you if FVE crosses above its avg” ) ;
over -20 at a sharp angle (over 30o) and it is over its 30-
day EMA. Green is used for up volume (MF>cutoff ), red for
down volume (MF<-Cutoff), and blue for neutral
2) Volatility color-coded volume bar formula: (the stock is not moving at all or it is moving margin-
ally). It will also alert you on heavy volume (>70% of
Inputs: the 50-day average).
AvgLength( 50 ),AlertPct( 70 ), CINTRA and CINTER are the intra- and interday
UpColor( Green ), volatility coefficients. Increasing or decreasing them
DownColor( Red ), will result in more neutral (blue) bars.
NeutralColor(blue),

Copyright (c) Technical Analysis Inc.


Stocks & Commodities V. 21:9 (44-55): Detecting Breakouts In Intraday Charts by Markos Katsanos

After you verify the code and insert it into your if BarNumber> 2*Samples then begin
charts, select the volume bars, go to Format/Style, and VolumePlusMinus = Volume * FveFactor;
select Histogram. FVEsum = Summation(VolumePlusMinus,Samples);
FVE=(FVEsum /
3) FVE strategy (Average(Volume,Samples)*Samples))*100;

System-testing options: Condition1=FVE>FVEENTERL AND


Fixed dollars per trade: $10,000 FVE<FVEENTERU ;
Commissions: Entry $10, Exit: $10 Condition2=LinearRegANGLEFC(FVE,LRPERIOD)
Positions: Longs only >BANGLE;
Number of shares rounded to the nearest 10 shares Condition3=FVE> XAVERAGE(FVE,MA);
Condition4 =LinearRegSlopeFC(C,LRC)<
Inputs: UB*LINEARREGVALUE(C,LRC,LRC-1)/100 AND
Samples(50),FVEENTERL(-20),FVEENTERU LinearRegSlopeFC(C,LRC )
(10),MA(40),LRPERIOD(20),BANGLE(30), >LB*LINEARREGVALUE(C,LRC,LRC-1)/100;
SANGLE(-30), Condition5 =LinearRegANGLE(FVE,LRPERIOD
LRC(30),UB(.1),LB(-.05),BarToExitOn(70); )<SANGLE;

Variables: If MarketPosition = 0 AND Condition1 AND Condi-


CINTRA(.1),CINTER(.1),TP(0),TP1(0),MF(0), tion 2 AND Condition 3 AND Condition 4 then
CUTOFF(0),VolumePlusMinus(0), Buy ( “BUY” ) THIS BAR ON CLOSE ;
Fvesum(0),FveFactor(0),FVE(0),INTRA(0), If condition5 then Sell (“FVE EXIT”) this bar AT
INTER(0),VINTRA(0),VINTER(0); CLOSE;
TP=(High + Low + Close)/3; If BarsSinceEntry = BarToExitOn then
TP1=(H[1]+L[1]+C[1])/3; Sell ( “TimeBarsLX” ) this bar AT CLOSE;
INTRA=LOG(High)-LOG(Low); End;
VINTRA=StandardDev(INTRA,SAMPLES);
INTER=LOG(TP)-LOG(TP1); The period for calculating FVE was adjusted for
VINTER=StandardDev(INTER,SAMPLES); each time frame according to the values in the table
CUTOFF=CINTRA*VINTRA+CINTER*VINTER; in Figure 1.
The stock price linear regression percentage bounds
MF=(Close - (High + Low)/2)+ TP-TP1; were also adjusted according to the square root of time
If MF>CutOff*close then FveFactor=1 relationship. The final values can be found in Figure 7.
Else if MF<-1*CutOff*Close then FveFactor=-1
Else FveFactor=0; —M.K.

Copyright (c) Technical Analysis Inc.


Stocks & Commodities V. 21:9 (44-55): Detecting Breakouts In Intraday Charts by Markos Katsanos

SIDEBAR 2: METASTOCK 7.2 CODE VINTER:=Stdev(INTER,PERIOD);


CUTOFF:=COEF*(VINTER+VINTRA)*C;
1) Volatility-modified FVE formula: MF:=C-(H+L)/2+Typical()-Ref(Typical(),-1);
VNEUT:=If(MF<CUTOFF AND MF>-CUTOFF ,V,0);
PERIOD:= Input(“PERIOD FOR FVE”,5,80,22);
VNEUT
COEF:=Input(“COEF FOR CUTOFF”,0,2,.1);
INTRA:=Log(H)- 3) System test
Log(L);VINTRA:=Stdev(INTRA,PERIOD);
INTER:=Log(Typical())-Log(Ref(Typical(),-1)); System-testing options:
VINTER:=Stdev(INTER,PERIOD); Initial capital: $10,000
CUTOFF:=COEF*(VINTER+VINTRA)*C; Commissions: Entry $10, exit: $10
MF:=C-(H+L)/2+Typical()-Ref(Typical(),-1); Entry price: Close, exit price: Close
FVE:=Sum(If(MF>CUTOFF, +V, If(MF <-CUTOFF, - Positions: Longs only
V,0)),PERIOD)/Mov(V,PERIOD,S)/PERIOD*100;
FVE Enter Long:
PERIOD:=24; COEF:=.1;
2) Volatility color-coded volume bar formula: INTRA:=Log(H)-Log(L);
VINTRA:=Stdev(INTRA,PERIOD);
Since you can’t program colors in MetaStock code, I have INTER:=Log(Typical())-Log(Ref(Typical(),-1));
created three different indicators: one for up volume, one for VINTER:=Stdev(INTER,PERIOD);
down volume, and a third for neutral volume. CUTOFF:=COEF*(VINTER+VINTRA)*C;
Insert all three in the same inner window. Double-click- MF:=C-(H+L)/2+Typical()-Ref(Typical(),-1);
ing on each will open its properties. Select Style/Histogram FVE:=Sum(If(MF>CUTOFF, +V,If(MF<-CUTOFF,-
for all and the color green, red, and blue for the up volume, V,0)),PERIOD)
down volume, and neutral volume, respectively. /Mov(V,PERIOD,S)/PERIOD*100;
FVE<10 AND FVE>-20 AND
The formula for the up volume (green) is:
LinRegSlope(FVE,20)>.58 AND
PERIOD:= Input(“PERIOD FOR FVE”,10,80,22); FVE>Mov(FVE,40,E) AND LinRegSlope(C,30)<
COEF:=Input(“COEF FOR CUTOFF”,0,2,.1); Ref(C,-30) *.6/100 AND LinRegSlope(C,30)>-
INTRA:=Log(H)- Ref(C,-30)*.3/100
Log(L);VINTRA:=Stdev(INTRA,PERIOD);
Close Long:
INTER:=Log(Typical())-Log(Ref(Typical(),-1));
PERIOD:=24; COEF:=0.1;
VINTER:=Stdev(INTER,PERIOD);
INTR:=Log(H)-Log(L);
CUTOFF:=COEF*(VINTER+VINTRA)*C;
VINTRA:=Stdev(INTR,PERIOD);
MF:=C-(H+L)/2+Typical()-Ref(Typical(),-1);
INTER:=Log(Typical())-Log(Ref(Typical(),-1));
VPLUS:=If(MF>CUTOFF ,V,0);
VINTER:=Stdev(INTER,PERIOD);
VPLUS
CUTOFF:=COEF*(VINTER+VINTRA)*C;
The formula for the down volume (red) is: MF:=C-(H+L)/2+Typical()-Ref(Typical(),-1);
FVE:=Sum(If(MF>CUTOFF, +V, If(MF <-CUTOFF, -
PERIOD:= Input(“PERIOD FOR FVE”,10,80,22); V,0)),PERIOD)/Mov(V,PERIOD,S)/PERIOD*100;
COEF:=Input(“COEF FOR CUTOFF”,0,2,.1); LinRegSlope(FVE,20)<-0.58
INTRA:=Log(H)-Log(L); The parameters above are for the daily test only. For the intraday
VINTRA:=Stdev(INTRA,PERIOD); tests, the FVE period and the linear regression percentages have
INTER:=Log(Typical())-Log(Ref(Typical(),-1)); to be adjusted according to the values in Figure 7.
VINTER:=Stdev(INTER,PERIOD); The Time exit stops could be adjusted by selecting Edit/
CUTOFF:=COEF*(VINTER+VINTRA)*C; Stops/Inactivity and filling the period values by the corre-
MF:=C-(H+L)/2+Typical()-Ref(Typical(),-1); sponding values in Figure 7. In MetaStock 8.0, this can be
VMINUS:=If(MF<-CUTOFF ,V,0); done by adding:
VMINUS
Simulation.CurrentPositionAge>=50
And the formula for the neutral volume (blue) is:
at the end of the close long conditions.
PERIOD:= Input(“PERIOD FOR SD”,10,80,22); The linear regression angle function is not available in
COEF:=Input(“COEF FOR CUTOFF”,0,2,.1); MetaStock 7.20, but this is not a problem, as it can be
INTRA:=Log(H)- substituted by the linear regression slope function, which is
Log(L);VINTRA:=Stdev(INTRA,PERIOD); of course the tangent of the linear regression angle.
INTER:=Log(Typical())-Log(Ref(Typical(),-1)); —M.K.

Copyright (c) Technical Analysis Inc.

You might also like