MetaStock™ Zone Forum & FAQ Artykuły Linki Elliott Waves EasyLanguage™ Zone

A B C D E F G H I J K L M N O P R S T U V W Y Z #

Chande's Forecast Oscillator I by Tushar S. Chande
RE: Forecast Oscillator

* To: <metastock@xxxxxxxxxxxxx>
* Subject: RE: Forecast Oscillator
* From: "Peter Gialames" <investor@xxxxxxxxxxxxx>
* Date: Thu, 10 Jan 2002 11:45:27 -0500
* Cc: <kernish@xxxxxxxxxxxx>
* Importance: Normal
* In-Reply-To: <000901c199ec$41f82e80$6401a8c0@xxxxxxxxx>
* Reply-To: metastock@xxxxxxxxxxxxx
* Sender: owner-metastock@xxxxxxxxxxxxx

Not sure if this is what you are looking for but ...

Peter Gialames

Here is the text from S&C V. 10:5 (220-224): Forecasting Tomorrow's Trading Day by Tushar S. Chande, Ph.D.

Using linear regression as a crystal ball for forecasting the market? After all, if you were to be able to determine tomorrow's high, low and close for trend changes and placement of stop points, it would simplify your life immeasurably. Can it work? Tushar Chande explains how it can be done.

Wouldn't you trade better It you could "see" the future? A simple linear regression can provide an objective forecast for the next day's high, low and close. These ingredients are essential for a trading game plan, which can help you trade more mechanically and less emotionally. Best of all, a regression forecast oscillator, %F, gives early warning of impending trend changes. The linear regression method is well known for finding a "best-fit" straight line for a given set of data. The output of the regression are the slope (m) and constant (c) of the equation

(1)Y = mX + c

Here, m and c are derived from a known set of values of the independent variable X and dependent variable Y. The relative strength of the linear relationship between X and Y is measured by the coefficient of determination r 2 , which is the ratio of the variation explained by the regression line to the total variation in Y. Here is a table to help interpret the values of r 2 , which range from 0 to 1:

The coining of the term "regression" can be attributed to Sir Francis Galton, who observed in the late 1800s that tall fathers appeared to have as a rule short sons, while short fathers appeared to have as a rule tall sons. Galton suggested that the heights of the sons "regressed" or reverted to the average. Technician Arthur Merrill also had a good explanation in a recent issue of STOCKS & COMMODITIES, and Patrick Lafferty recently wrote on an application of multiple regression to gold trading. Virtually all introductory books on statistics have a detailed discussion of the linear regression method.

Successful professional traders emphasize the importance of having a trading plan. A trading game plan, much like that of a football team, clearly defines specific actions under different conditions. The linear regression method is very useful in developing a forecast for the next trading day's high, low and close based on the last five trading sessions. The method is general and broad-based enough so that it can be used with stocks, indices or commodities. The forecast is the basis of my trading plan: I can define what I should do if the market rises above the forecast high, falls below the forecast low or stays within the forecast range. This way, I can avoid being emotional and trade as mechanically as possible by having a plan to rely on.

FORECASTING WITH LINEAR REGRESSION

I like to use at least 10 days of data and develop a forecast for the high, low and close. The five-day regression is a good choice for short-term trading. You can use any length of regression you like. Here are the calculations with the daily close in a spreadsheet format:

1 Perform a linear regression with the first five days of data to obtain the slope m and constant c such that

X Value Daily Close

1 Day 1

2 Day 2

....

5 Day 5

2 Forecast the next day's close with the slope m and constant c from step 1:

(2) Forecast close (Day 6) = 6m + c

3 Record m, c and r 2 on the same line as Day 5. Record the forecast from step 2 one day ahead, with Day 6. Note when we are using five days' data, the first forecast is for Day 6.

4 Step the calculation ahead one day such that

5 Record m, c and r 2 as in step 3.

6 Calculate the regression forecast oscillator, %F, as

(3)

%F = ((Y-Yforecast)/Y)*100

where Y is the close for Day 6 and Y(Forecast) is the forecast for Day 6 from step 2 (from Day 5).

7 Record the oscillator on the same line as Day 6.

8 Step the calculations ahead one day at a time until the most recent day.

Technically, we can use the linear regression to develop a point forecast (single value) for the next day (as in step 2) or a range (interval) of values with a certain confidence level. The interval widens, greater the variation in the data and greater the desired confidence level.

I use the forecast oscillator, %F, to determine if my forecast is above or below the actual market data. Since

%F = ((Y-Yforecast)/Y)*100

where Y can be any market variable for stocks, indices or commodities, %F measures the percent deviation of the actual value from its forecast. In a trading market, %F changes its sign before a significant trend change. In trending markets, %F tends to change sign early in the trend. I interpret %F in the context of the r 2 Of the regression. A low value of r 2 plus a change in sign of %F is a good signal of a change in trend. Market extremes and periodicity can also be observed on the %F charts.

DEVELOPING A TRADING PLAN

You can use the forecasts to develop a specific trading plan to suit your trading style. I use the forecasts in several ways.

Forecasts as stops. I use the high and the low as action points. If the market exceeds the forecast high, it wants to go up. To trade with the trend, I put a buy stop a few ticks above the high. If the market falls below the forecast low, it wants to go down. Hence, I set a sell stop a few ticks below the forecast low. If you want to trade against the trend, sell short near the forecast high and buy near the forecast low.

Forecasts as intraday range scale. The forecasts provide a scale for evaluating the trading day. The market can stay within the expected range or go outside. On a down day, the intraday high is well below the forecast high and may be below the forecast close. On an up day, the market stays well above the forecast low and often above the forecast close.

General rules for trading with forecasts. Here are some general rules:

  • Use the forecasts only if r 2 is greater than 0.1. Higher the value of r 2 , the greater the confidence in the forecasts.
  • A trend change is imminent when r 2 falls below 0.1. Prepare to close longs.
  • A trend is in place if r 2 is greater than 0.6. As a trend follower, you could wait for this value to be exceeded before opening positions. This would keep you out of short-term fluctuations.
  • An early warning of a trend change is provided by a zero-crossing of %F, the forecast oscillator. Prepare to tighten stops and look for changes in slope and coefficient of determination for confirmation.
  • A change in trend is confirmed by a change in slope of the regression. Open positions in direction of trend change. To trade against the trend, look for peaks in slope and strength of the linear trend.
  • The trend will usually change in the direction of %F.
  • Always be prepared for a market move against the forecast. Use stops!

A SAMPLE TRADING PLAN

I have developed a forecast for the high, low and close for January 20, 1992, from the previous five trading days, seen in Figure 1. The market was making new highs the previous week. Was a downward movement imminent? Let's look at the data from Friday, January 17, 1992:

The market was trending moderately (0.4<= r 2 <0.6), but the forecast oscillator %F was negative for high, low and close, warning of a possible change in trend. The relatively small slope of the regression for the high meant the market was meeting resistance. The slope of the regression for the close had turned down from the high values during the recent strong uptrend. The forecast, however, called for a strong close near the highs of the day, but that seemed doubtful, given the low slopes in a moderating trend. The plan was to watch for a change in trend. If the market opened weak, a bearish strategy was called for. For example, I would consider buying the Standard & Poor's 100 Index OEX January 390 puts, or selling short the S&P 500 March futures contract.

The high daily volume of OEX index options traded makes the S&P 100 index an interesting application of me regression forecast approach.

The market opened at the Friday close and weakness was evident at the open, as the S&P 500 futures opened lower. It was clear in early trading that the trend would be down, as the market traded well below the forecast high and close. Clearly, the forecast range provided a good scale, since it reinforced the concept that the market was weaker than the trend of the prior five days. A bearish stance would have been profitable.

THE NATURE OF REGRESSION FORECASTS

The high daily volume of OEX index options traded makes the S&P 100 index an interesting application of the regression forecast approach. I have examined a time period from early October 1991 to mid-January 1992. The OEX close and its forecast are in Figure 2; the r 2 values in Figure 3; %F in Figure 4, and Figure 5 has %F around the mid-November plunge.

Several observations can be made from the OEX analysis. First, the forecast lags the OEX in an uptrend or in a downtrend. Second, the close and the forecast cross over several days before a trend change. This crossover can be seen as a zero crossing in the %F chart. Significant trend changes are preceded by trendless periods with values of r 2 near zero. Strong trends are accompanied by high values of r 2 and regression slope. These observations support the general rules of interpretation noted above. As Figure 5 shows, %F provided a timely warning of an impending trend change just before the OEX fell 15.68 points.

I have included data for wheat (cash) from 1989 to indicate the use of this approach with commodities. The market showed significant trends during this period with good periodicity, as shown in Figures 6, 7 and 8. The %F zero crossings were timely indicators of trend change. Features observed with OEX charts are also seen here; note in particular how %F can be used to identify extremes in the market from Figures 4 and 8.

Simple linear regression yields forecasts of the high, low and close for stocks, indices or commodities. these forecasts can be used to develop a trading plan. You can trade with the trend, against the trend, intraday or interday. The forecast oscillator, %F, provides early warning of trend changes taken together with the regression slope and coefficient of determination. This approach works best in trending markets or trading range markets; it is only moderately useful in volatile markets with choppy price action. These objective forecasts will let you trade less emotionally and more mechanically. Profits will look up when you can look ahead.

Tushar Chande holds a doctorate in engineering from the University of Illinois and a master's degree in business administration from the University of Pittsburgh.

REFERENCES
Lafferty, Patrick [ 1991 ]. "A regression-based oscillator," Technical Analysis of STOCKS & COMMODITIES, Volume 9: September.

Merrill, Arthur [1991]. "Fitting a trendline by least squares," Technical Analysis of STOCKS & COMMODITIES, Volume 9: December.

Pfaffenberger, Roger, and James Patterson [1987]. Statistical Methods for Business and Economics, Irwin.


Re: Forecast Oscillator

* To: metastock@xxxxxxxxxxxxx
* Subject: Re: Forecast Oscillator
* From: "j seed" <jseed_10@xxxxxxxxxxx>
* Date: Thu, 10 Jan 2002 18:01:38 +0000
* Reply-To: metastock@xxxxxxxxxxxxx
* Sender: owner-metastock@xxxxxxxxxxxxx

Steve,

I believe this is it.

J.


Chande's Forecast Oscillator I

{from jseed}
Pds:=Input("Time Periods",1,1000,5);
Fld:=Input("Price Field 1=C 2=O 3=H 4=L",1,4,1);
PFld:=If(Fld=1,C,If(Fld=2,O,If(Fld=3,H,L)));
Sig:=Input("Signal MA Periods",1,200,3);
ForO:=((Pfld-(Ref(LinearReg(Pfld,Pds),-1)+
Ref(LinRegSlope(Pfld,Pds),-1)))*100)/Pfld;
ForO;
Mov(ForO,Sig,E);
{end}

 

Source / From: TOP
http://purebytes.com/archives/metastock/

Equis and MetaStock® and MetaStock Professional® are registered trademarks of Equis International. Achelis Binary Wave®, The DownLoader®,
Expert Advisor®, OptionScope®, Quotecenter® and Smart Charts® are trademarks of Equis International, a Thomson Reuters company.

TradeStation® Pro, TradeStation® 2000i, OptionStation®, SuperCharts®, PowerEditor® and EasyLanguage®
are registered trademarks of TradeStation Technologies, Inc. Other names and marks referred to are the property of their respective owners.

All information provided on this website is for educational purposes only. Trading involves risk, including possible loss of principal and other losses.

Ten i inne materiały na tej stronie zostały zamieszczone zostały jedynie w celach edukacyjnych, nie ponoszę żadnej odpowiedzialno¶ci za ich stosowanie.

Gra na giełdzie i rynkach walutowych (FOREX) niesie ze sob± ryzyko poważnych strat finansowych!