Sei sulla pagina 1di 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


Heres an important enhancement to the finite volume elements indicator thats especially useful with intraday minute charts. by Markos Katsanos the April 2003 STOCKS & COMMODITIES, I introduced the finite volume elements indicator (FVE) and demonstrated how it can be used to detect breakouts in daily charts. To refresh your memory, the FVE is a money flow indicator, but it has two important innovations: first, the FVE takes into account both intra- and interday price action, and second, minimal price changes are taken into account by introducing a price threshold. Those innovations were introduced to improve on two important limitations of existing money flow indicators:

In

Where: C= Todays closing price H= Todays high L= Todays low Typical = (H+L+C)/3 Typical-1= Yesterdays typical price Cutoff coefficient = 0.3% The component on the right-hand side of (2) is the threshold parameter of the indicator and is a function of price only. I tested the indicator on daily charts and found that 0.3% was the optimal value for the cutoff coefficient. I did not take volatility into account, thus avoiding the extra complication in the formula and the controversy surrounding the subject of whether stock price changes are normally distributed. The drawback of this method, however, is that the constant cutoff coefficient will overestimate price changes in minute charts and underestimate corresponding changes in weekly or monthly charts. Based on the rule of square root of time, price changes of a random time series (such as stocks) move approximately proportional to the square root of the interval difference (see Suggested reading and references). The constant cutoff coefficient, therefore, should be adjusted to take into account the appropriate price interval using the formula below:

Intraday money flow indicators (such as Chaikins money flow or intraday intensity) leave out all price action from the close to the next days open. This omission should not go unnoticed, since major news such as earnings numbers are usually released overnight. Similar interday money flow indicators such as onbalance volume (OBV) add or subtract the volume from a running total, depending on whether the stock closed higher or lower. Thus, OBV will increase by all the days volume even if the security closed just one cent higher than the previous close. In designing FVE, I introduced a threshold that will exclude minimal price changes. The FVE formula is:
t

Cutofft = cutoffd *

T 390

(3)

Where: T = Chart interval in minutes CutoffT = Cutoff for chart interval T Cutoffd = Cutoff for daily chart Cutoff coefficients have been calculated for all time frames provided in Figure 1. These will have to be adjusted manually in the FVE formula. If you are using a tick interval chart, keep in mind that it has no intrabar extremes. The intraday component will vanish and the FVE formula will be reduced to a finite segment OBV indicator, but it will be more useful than OBV since it will oscillate between zero and +/-100. This will make it easier to determine whether it is in a bullish or bearish state. An alternative way to calculate the cutoff coefficient, which will adjust to all time frames automatically, would be to take volatility into account.

FVE =

(+V,
1

V, 0) * 100 MA (V, t) * t

(1)

Where: t = Time segment chosen MA(V, t) = t-day moving average of volume V = Volume. It can take a +/- sign or zero value according to whether:

H+L + typical typical-1 > cutoff * C 2 or < -cutoff * C

(2)

Copyright (c) Technical Analysis Inc.

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

DETERMINING VOLATILITY
In calculating the historical volatility, the following problems had to be addressed: The shape of the distribution of stock price changes deviates from the norm and is usually positively skewed (off-center) Variance is not constant over time.

CUTOFF COEFFICIENTS FOR ALL TIME FRAMES Chart interval Tick Minute 5 min 10 min 1/4 hr 1/2 hr Hourly Daily Weekly Monthly Minutes Sq. root of time 0.051 0.113 0.160 0.196 0.277 0.392 1.000 2.236 10.247 Cutoff coefficient 0.00 0.02 0.03 0.05 0.06 0.08 0.12 0.30 0.67 3.07 Period for FVE 180 160 100 75 60 50 40 22 13 5

One appropriate method to remove anomalies and bring the distribution back to normal is to convert prices to natural logarithms. The dynamic effect of variance was addressed by calculating a 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 intervals. The fourth column displays the proposed cutoff coefficients for the old FVE formula FVE. I forced the standard deviation to move by only. These are not to be used with the new volatility-enhanced formula. The fifth column adding the most recent and dropping the oldest displays the proposed time span (in bars) for FVE and for different time interval charts. value from the calculation. Historical volatility involves two distinct components: 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 days 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(Typ1)) INTRAV = standard deviation (ln(H) ln(L)) DETECTING BREAKOUTS IN INTRADAY CHARTS Thus, the cutoff coefficient in inequality (2) was modified according to the following formula: The most common setup for a breakout is when the FVE crosses the zero line at a steep angle, and in the process makes higher highs and higher lows. Major breakouts were better detected on 30- or 60-minute charts. Stocks that were moving sideways for some time, or basing for a relatively long period of time, produced the most violent breakouts. In order to reduce noise, the time period used to calculate FVE in intraday minute charts had to be increased. The square root of time relationship used to convert price changes did not produce the best results, as the time segments were too large. By testing on a number of stocks for different time frames, I found that an approximate cubic root relationship existed between the time segment used and the chart interval. This can be expressed mathematically with the following formula:
3

1 5 10 15 30 60 390 1950 40950

Cutoff = 0.1* INTERV+ INTRAV


Where: Typical = (H+L+C)/3 Typical-1 = Yesterdays typical price INTERV = Interday volatility INTRAV = Intraday volatility ln = natural (to the base e) logarithm

(4)

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 FVE calculation are included in sidebars 1 and 2, respectively. I have also included a formula to calculate color-coded volume bars according to inequality (2). Green is used for up volume (that is, MF>threshold), red for down volume (MF<threshold), and blue when the stock does not move either way by more than the threshold, where:

Period T = periodd *

390 T

(5)

Where: PeriodT = Period for chart interval t in bars Periodd = Period for daily chart in bars 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 by the cube root of 390/60 to get 41 bars. Values for the most common minute charts can be found in Figure 1. Unless optimization produces any better ones, these values can be

MF = C
and

H +L + Typical Typical -1 2

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 proposed, it will make the indicator more sensitive but at the expense of superfluous readings that are only suitable for very short-term trading.

Condition 3: FVE should be above its 40-day exponential average. Condition 2 reduced the undesirable effect of whipsawing around the zero line, and the combination of conditions 2 and 3 ensured that FVE was rising from below. The requirement for the stock to be moving sideways was:

EXAMPLES

From February 14, 2003, until March 17, 2003 (Figure 2), the stock of Geron Corp. (GERN) was moving sideways or slightly down. On March 12, FVE started diverging (on the 60-minute Condition 4: The stocks 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 FVE made another high, FVE started making lower highs. On 4/3/03 it nosedived to cross its 30-day moving average, thus warning traders to get out. On the 30-minute chart of Transmeta Corp. (TMTA) displayed in Figure 3, the 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, moving 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 cross function available in both programs because it produced too few or no trades at all. Instead, the following two conditions described 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 than 30 degrees.

FVE

FIGURE 3: On 5/2/03 the FVE(50) rose sharply. Two days later the price of the stock rose more than 50%.

Copyright (c) Technical Analysis Inc.

TRADESTATION

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

line should not rise more than 0.6% or fall less than -0.3% per day (for daily charts) or the corresponding percentages in intraday charts. This was expressed mathematically as follows:

DAILY CHART OF ATMEL CORP. (ATML) FROM 10/12/01 TO 3/31/03


FVE exit FVE exit

FVE exit Buy Buy Buy

FVE exit

LRV LRV -30 > -0.3% 30 * LRV -30

(6)
Buy Buy

which can be expressed in terms of the linear regression slope:

LRS > -0.03%*LRV -30


By substituting for:

(7)

LRS = tan =

LRV

LRV -30 30

(8)

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

Where: LRV = Linear regression value of the linear regression line at the latest bar LRV-30 = Linear regression value of the linear regression line 30 bars ago LRS = Slope of the 30-bar linear regression line This condition did not achieve a perfect base, since it only ensured that the linear regression line remained relatively flat but did not exclude intermediate swings of the stock price. I tried further constraints but abandoned them, as they overwhelmed the system and produced very few trades. 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. 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 formula (5) does not always work well for every stock. The values proposed in Figure 1 might have to be adjusted in the range of +/- 25%, but in order to obtain the best results, they should not be adjusted less or more than the higher or lower time interval value, respectively.

15-MINUTE CHART OF ATMEL CORP. (ATML) FROM 3/10/03 TO 5/6/03


FVE exit

FVE exit FVE exit FVE exit FVE exit FVE exit Buy FVE exit Buy Buy Buy Buy Buy

Buy

FVE

FIGURE 5: This was the clear winner, resulting in a net profit of $8,000.

None of the above strategies were particularly suitable for daytrading, since they involved keeping open positions overnight. Not surprisingly, the most appropriate for daytrading was the five-minute strategy, with the average trade lasting no more than two calendar days or eight trading hours.
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 formula (3) was used to calculate the linear regression percentages suggested in the fourth condition for the different time frames. This relationship produced good results up to the smallest time interval of the tests, and there was no need for any further adjustments. The trade was exited after a certain number of bars or when FVE declined at a steep angle. More precisely, the exit conditions were: 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.

TOP CHART: 30-MINUTE CHART OF ATMEL CORP. (ATML) FROM 1/7/03 TO 5/2/03
FVE exit FVE exit TimeBarsLX FVE exit Buy Buy FVE exit Buy FVE exit Buy Buy Buy Buy Buy FVE exit FVE exit FVE exit Buy

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 was the five-minute strategy, with the average trade lasting no efficacy of the different time frames. more than two calendar days or eight trading hours. Tests were performed on the daily chart of Atmel Corp. Different programs calculate and present the profit/loss (ATML) from September 4, 2001, to May 20, 2003, and on report data differently, so these had to be checked manually. intraday 30-, 15-, and five-minute charts from January 10, I had to search through the usual plethora of test metrics to 2003, to May 20, 2003. present the most useful in Figure 7. The daily chart test (Figure 4) produced excellent results. For the test to begin calculating FVE and its moving Despite the stock being in a precipitous decline, a long-only average (2n1+n21), extra bars need to be loaded before the test returned an astonishing $17,000 profit on $10,000 per actual start test date, where: n1= FVE period and n2= moving trade capital, producing three winning long trades against average period. The variable n1 was added twice, once for the the main trend. The buy and hold strategy lost a catastrophic moving standard deviation and once for the FVE calculation. $7,500. The test detected all three major breakouts in OctoTo calculate the buy and hold profit, the first date I used ber 2001, March 2002, and October 2002, but only the last was the date that the test could start producing trades that one of the smaller breakouts in 2003, which was still open by is, the first date loaded plus (2n1+n21). To calculate the the end of the test. system profitability, I used the following useful formula The stock was moving sideways during the intraday test published by Michael Harris in the September 2002 STOCKS period. There were three brief major breakouts, one in the & COMMODITIES: middle of March, a smaller one in the middle of April, and 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 (9) versus the small loss suffered by buy and hold investors. 1 + R wl Where: The clear winner was the 15-minute test (Figure 5) with net profit of $8,000 versus a $500 buy and hold loss. It N P= W (10) detected all three breakouts and suffered no major losses. N The runnerup was the five-minute test. Despite missing two out of the three major breakouts, it came ahead of the 30AvgW (11) minute test by detecting several minor ones only visible on R WL = AvgL intraday charts. The test on 30-minute charts (Figure 6) detected all three AvgW= Average winning trade major breakouts, but the results were impaired by a big loss. AvgL= Average losing trade This could have been prevented with a stop-loss condition. N= Total number of trades None of the above strategies were particularly suitable for Nw= Number of winning trades daytrading, since they involved keeping open positions overValues below zero indicate losing systems. night. Not surprisingly, the most appropriate for daytrading 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
Figure Dollars per trade Commission per trade Total net profit (dollars/per trade constant) Annual percent gain/loss Buy and hold profit Annual buy and hold percent gain/loss Total number of trades Winning trades Losing trades Percent profitable Avg. trade profit/loss Avg. winning trade Avg. losing trade Ratio avg. win/avg. loss Profitability Max. trade drawdown Reference bars needed Start date/loaded data Start date/test End date Test period/days Time in the market (days) % of time in the market Avg. time in trades (days) Avg. time in trades (bars) Stock price at start of test Stock price at end of test

5-minute
$10,000 $10.00 $4,668.30 122.6% -$505.37 -13.3% 11 7 4 63.64% $424.39 $783.11 $203.37 3.85 1.54 -$588.00 279 12/26/02 01/02/03 05/20/03 139 21.2 15.27% 1.93 92 2.42 2.30

15-minute
5 $10,000 $10.00 $7,821.90 211.5% -$465.98 -12.6% 13 8 5 61.54% $601.68 $1,132.42 -$247.50 4.58 1.42 -$918.40 159 12/26/02 01/06/03 05/20/03 135 34.1 25.25% 2.63 43 2.41 2.30

30-minute
6 $10,000 $10.00 $4,495.70 125.3% -$1,230.15 -34.3% 9 5 4 55.56% $499.52 $1,386.80 -$609.57 2.28 0.94 -$1,458.00 139 12/26/02 01/10/03 05/20/03 131 33.1 25.24% 3.67 36 2.62 2.30

Daily
4 $10,000 $10.00 $16,943.70 99.1% -$7,513.31 -43.9% 4 3 1 75.00% $3,931.55 $5,707.07 -$1,395.00 4.09 2.80 -$1,625.00 87 5/1/01 09/04/01 05/20/03 624 142 22.76% 36 25 9.24 2.30

SYSTEM PARAMETERS
FVE period FVE entry lower bound FVE entry upper bound FVE exp. moving average period Linear regression period (bars) Linear regression angle: entry (degrees) Linear regression angle: exit (degrees) Closing price linear regression period (bars) Upper bound (%) Lower bound (%) Time exit (bars) 120 -20 10 40 20 30 -20 30 0.07 -0.02 150 60 -20 10 40 20 30 -20 30 0.12 -0.04 90 50 -20 10 40 20 30 -30 30 0.17 -0.06 70 24 -20 10 40 20 30 -30 30 0.6 -0.2 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
You can increase the resolution of daily charts by using intraday charts to detect major breakouts that develop in a very short period of time and could not be spotted otherwise on the daily charts. I found the most appropriate interval for major breakouts to be the 60- or 30-minute interval. By increasing the resolution further to the five-minute interval, you could detect most microbreakouts, with the adverse effect, however, of missing out on the major ones because of the unwanted noise. The 15-minute interval was a good compromise that could detect most major and some minor breakouts. Keep in mind that there is no such thing as a perfect system. No matter how good the system is, and however highly unlikely the possibility of a loss is, it may happen to you, so it may be a good idea to use a stop-loss condition. Markos Katsanos is a structural engineer and a private trader.

REFERENCES AND SUGGESTED READING


Harris, Michael [2002]. Improve Your System With The Profitability Rule, Technical Analysis of STOCKS & COMMODITIES , Volume 20: September. Hinkle, D.E., W. Wiersma, and S.G Jurs [1998]. Applied Statistics For The Behavioral Sciences, Houghton-Mifflin. Katsanos, Markos [2003]. Detecting Breakouts, Technical Analysis of STOCKS & COMMODITIES , Volume 21: April. LeFvre, Edwin [1994]. Reminiscences Of A Stock Operator, John Wiley & Sons. Originally published in 1923. Long, Erik [2003]. Making Sense Of Fractals, Technical Analysis of STOCKS & COMMODITIES , Volume 21: May. Murphy, Joseph E. [1988]. Stock Market Probability, Irwin Publishing. Parkinson, Michael [1980]. The Extreme Value Method For Estimating The Variance Of The Rate Of Return, The Journal of Business 53:1, January.
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: Inputs: Samples(22),PERMA(40),CINTRA(.1),CINTER(.1); Variables: TP(0),TP1(0),MF(0),VolumePlusMinus(0),FVE(0), FVEsum(0), FveFactor(0),INTRA(0),INTER(0),VINTRA(0),VINTER(0), CUTOFF(0); TP=(High + Low + Close)/3; TP1=(H[1]+L[1]+C[1])/3; INTRA=Log(High)-LOG(Low); VINTRA=StandardDev(INTRA,SAMPLES,1); INTER=LOG(TP)-LOG(TP1); VINTER=StandardDev(INTER,SAMPLES,1); CUTOFF=CINTRA*VINTRA+CINTER*VINTER; MF=(Close - (High + Low)/2)+ TP-TP1; If MF>CutOff*close then FveFactor=1 Else if MF<-1*CutOff*Close then FveFactor=-1 Else FveFactor=0; If BarNumber > samples then begin VolumePlusMinus = Volume * FVEFactor; FVEsum = Summation(VolumePlusMinus,Samples); FVE=(FVEsum/(Average(Volume,Samples)*Samples))*100; Plot1(Average(FVE,1),FVE); Plot2(XAverage(FVE,PERMA),EMAFVE); Plot3(0,0"); Alert (FVE ); Condition1=FVE>-20 AND FVE<10 ; Condition2=FVE> XAVERAGE(FVE,PERMA); Condition3 =LinearRegANGLEFC(FVE,20)>30; If CONDITION1 AND CONDITION2 AND CONDITION3 then alert(FVE); End; CINTRA(.1),CINTER(.1),Samples(22); Variables: AlertFactor( 1 + AlertPct /100 ), AlertStr( NumToStr( AlertPct, 2 ) ), INTRA(0),INTER(0),VINTRA(0),VINTER(0), CUTOFF(0),TP(0),TP1(0),MF(0); TP=(High + Low + Close)/3; TP1=(H[1]+L[1]+C[1])/3; INTRA=LOG(High)-LOG(Low); VINTRA=StandardDev(INTRA,SAMPLES,1); INTER=LOG(TP)-LOG(TP1); VINTER=StandardDev(INTER,SAMPLES,1); CUTOFF=CINTRA*VINTRA+CINTER*VINTER; MF=(Close - (High + Low)/2)+ TP-TP1; If BarType >= 2 then {i.e., not tick/minute data} Begin Plot1( Volume, Vol ) ; Plot2( AverageFC( Volume, AvgLength ), VolAvg ) ; end Else {if tick/minute data; in the case of minute data, also set the For volume, use: field in the Format Symbol dialog to Trade Vol or Tick Count, as desired} Begin Plot1( Ticks, Vol ) ; Plot2( AverageFC( Ticks, AvgLength ), VolAvg ); End ; {Color criteria} If MF>CutOff*close then SetPlotColor( 1, UpColor ) Else if MF<-1*CutOff*Close then SetPlotColor( 1, DownColor ) Else SetPlotColor( 1, NeutralColor ); {Alert criteria} If Plot1 crosses over Plot2 * AlertFactor then Alert( Volume breaking through + AlertStr + % above its avg ) ;

The above code plots FVE and its 40-day exponential moving average. It will also alert you if FVE crosses over -20 at a sharp angle (over 30o) and it is over its 30day EMA.
2) Volatility color-coded volume bar formula: Inputs: AvgLength( 50 ),AlertPct( 70 ), UpColor( Green ), DownColor( Red ), NeutralColor(blue),

Green is used for up volume (MF>cutoff ), red for down volume (MF<-Cutoff), and blue for neutral (the stock is not moving at all or it is moving marginally). It will also alert you on heavy volume (>70% of the 50-day average). CINTRA and CINTER are the intra- and interday volatility coefficients. Increasing or decreasing them will result in more neutral (blue) bars.

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 charts, select the volume bars, go to Format/Style, and select Histogram.
3) FVE strategy System-testing options: Fixed dollars per trade: $10,000 Commissions: Entry $10, Exit: $10 Positions: Longs only Number of shares rounded to the nearest 10 shares Inputs: Samples(50),FVEENTERL(-20),FVEENTERU (10),MA(40),LRPERIOD(20),BANGLE(30), SANGLE(-30), LRC(30),UB(.1),LB(-.05),BarToExitOn(70); Variables: CINTRA(.1),CINTER(.1),TP(0),TP1(0),MF(0), CUTOFF(0),VolumePlusMinus(0), Fvesum(0),FveFactor(0),FVE(0),INTRA(0), INTER(0),VINTRA(0),VINTER(0); TP=(High + Low + Close)/3; TP1=(H[1]+L[1]+C[1])/3; INTRA=LOG(High)-LOG(Low); VINTRA=StandardDev(INTRA,SAMPLES); INTER=LOG(TP)-LOG(TP1); VINTER=StandardDev(INTER,SAMPLES); CUTOFF=CINTRA*VINTRA+CINTER*VINTER; MF=(Close - (High + Low)/2)+ TP-TP1; If MF>CutOff*close then FveFactor=1 Else if MF<-1*CutOff*Close then FveFactor=-1 Else FveFactor=0;

if BarNumber> 2*Samples then begin VolumePlusMinus = Volume * FveFactor; FVEsum = Summation(VolumePlusMinus,Samples); FVE=(FVEsum / (Average(Volume,Samples)*Samples))*100; Condition1=FVE>FVEENTERL AND FVE<FVEENTERU ; Condition2=LinearRegANGLEFC(FVE,LRPERIOD) >BANGLE; Condition3=FVE> XAVERAGE(FVE,MA); Condition4 =LinearRegSlopeFC(C,LRC)< UB*LINEARREGVALUE(C,LRC,LRC-1)/100 AND LinearRegSlopeFC(C,LRC ) >LB*LINEARREGVALUE(C,LRC,LRC-1)/100; Condition5 =LinearRegANGLE(FVE,LRPERIOD )<SANGLE; If MarketPosition = 0 AND Condition1 AND Condition 2 AND Condition 3 AND Condition 4 then Buy ( BUY ) THIS BAR ON CLOSE ; If condition5 then Sell (FVE EXIT) this bar AT CLOSE; If BarsSinceEntry = BarToExitOn then Sell ( TimeBarsLX ) this bar AT CLOSE; End;

The period for calculating FVE was adjusted for each time frame according to the values in the table in Figure 1. The stock price linear regression percentage bounds were also adjusted according to the square root of time relationship. The final values can be found in Figure 7. 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 1) Volatility-modified FVE formula: PERIOD:= Input(PERIOD FOR FVE,5,80,22); COEF:=Input(COEF FOR CUTOFF,0,2,.1); INTRA:=Log(H)Log(L);VINTRA:=Stdev(INTRA,PERIOD); INTER:=Log(Typical())-Log(Ref(Typical(),-1)); VINTER:=Stdev(INTER,PERIOD); CUTOFF:=COEF*(VINTER+VINTRA)*C; MF:=C-(H+L)/2+Typical()-Ref(Typical(),-1); FVE:=Sum(If(MF>CUTOFF, +V, If(MF <-CUTOFF, V,0)),PERIOD)/Mov(V,PERIOD,S)/PERIOD*100; FVE 2) Volatility color-coded volume bar formula: Since you cant program colors in MetaStock code, I have created three different indicators: one for up volume, one for down volume, and a third for neutral volume. Insert all three in the same inner window. Double-clicking on each will open its properties. Select Style/Histogram for all and the color green, red, and blue for the up volume, down volume, and neutral volume, respectively. The formula for the up volume (green) is: PERIOD:= Input(PERIOD FOR FVE,10,80,22); COEF:=Input(COEF FOR CUTOFF,0,2,.1); INTRA:=Log(H)Log(L);VINTRA:=Stdev(INTRA,PERIOD); INTER:=Log(Typical())-Log(Ref(Typical(),-1)); VINTER:=Stdev(INTER,PERIOD); CUTOFF:=COEF*(VINTER+VINTRA)*C; MF:=C-(H+L)/2+Typical()-Ref(Typical(),-1); VPLUS:=If(MF>CUTOFF ,V,0); VPLUS The formula for the down volume (red) is: PERIOD:= Input(PERIOD FOR FVE,10,80,22); COEF:=Input(COEF FOR CUTOFF,0,2,.1); INTRA:=Log(H)-Log(L); VINTRA:=Stdev(INTRA,PERIOD); INTER:=Log(Typical())-Log(Ref(Typical(),-1)); VINTER:=Stdev(INTER,PERIOD); CUTOFF:=COEF*(VINTER+VINTRA)*C; MF:=C-(H+L)/2+Typical()-Ref(Typical(),-1); VMINUS:=If(MF<-CUTOFF ,V,0); VMINUS And the formula for the neutral volume (blue) is: PERIOD:= Input(PERIOD FOR SD,10,80,22); COEF:=Input(COEF FOR CUTOFF,0,2,.1); INTRA:=Log(H)Log(L);VINTRA:=Stdev(INTRA,PERIOD); INTER:=Log(Typical())-Log(Ref(Typical(),-1));

VINTER:=Stdev(INTER,PERIOD); CUTOFF:=COEF*(VINTER+VINTRA)*C; MF:=C-(H+L)/2+Typical()-Ref(Typical(),-1); VNEUT:=If(MF<CUTOFF AND MF>-CUTOFF ,V,0); VNEUT 3) System test System-testing options: Initial capital: $10,000 Commissions: Entry $10, exit: $10 Entry price: Close, exit price: Close Positions: Longs only Enter Long: PERIOD:=24; COEF:=.1; INTRA:=Log(H)-Log(L); VINTRA:=Stdev(INTRA,PERIOD); INTER:=Log(Typical())-Log(Ref(Typical(),-1)); VINTER:=Stdev(INTER,PERIOD); CUTOFF:=COEF*(VINTER+VINTRA)*C; MF:=C-(H+L)/2+Typical()-Ref(Typical(),-1); FVE:=Sum(If(MF>CUTOFF, +V,If(MF<-CUTOFF,V,0)),PERIOD) /Mov(V,PERIOD,S)/PERIOD*100; FVE<10 AND FVE>-20 AND LinRegSlope(FVE,20)>.58 AND FVE>Mov(FVE,40,E) AND LinRegSlope(C,30)< Ref(C,-30) *.6/100 AND LinRegSlope(C,30)>Ref(C,-30)*.3/100 Close Long: PERIOD:=24; COEF:=0.1; INTR:=Log(H)-Log(L); VINTRA:=Stdev(INTR,PERIOD); INTER:=Log(Typical())-Log(Ref(Typical(),-1)); VINTER:=Stdev(INTER,PERIOD); CUTOFF:=COEF*(VINTER+VINTRA)*C; MF:=C-(H+L)/2+Typical()-Ref(Typical(),-1); FVE:=Sum(If(MF>CUTOFF, +V, If(MF <-CUTOFF, V,0)),PERIOD)/Mov(V,PERIOD,S)/PERIOD*100; LinRegSlope(FVE,20)<-0.58 The parameters above are for the daily test only. For the intraday tests, the FVE period and the linear regression percentages have to be adjusted according to the values in Figure 7. The Time exit stops could be adjusted by selecting Edit/ Stops/Inactivity and filling the period values by the corresponding values in Figure 7. In MetaStock 8.0, this can be done by adding: Simulation.CurrentPositionAge>=50 at the end of the close long conditions. The linear regression angle function is not available in MetaStock 7.20, but this is not a problem, as it can be substituted by the linear regression slope function, which is of course the tangent of the linear regression angle. M.K.

Copyright (c) Technical Analysis Inc.

Potrebbero piacerti anche