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 #

LinRegSlope & Standard Deviation of Daily ROC's
David,
I will give it a try, at least how I see it. You should really go to a library to find a book on Basic Statistics. I have found that at least a basic grasp of statistics is essential to technical analysis so you can accurately judge if one indicator or system is really "better" than another, and by how much. It also speeds the development of an indicator since you will have a grasp of what is really being measured and can zero in on a specific path for improvement for an indicator, rather than blindly plugging numbers into an equation and wasting your time.

Imagine standing at the beach and watching the waves roll in. You find a nice flat board 13 feet (periods) long, and throw it lengthwise into the surf so the ends of the board extend from one wave crest to the next. The ends of the board will slightly sink into the wave crests while the middle of the board will rise slightly above the trough between the crests. The board is trying to find a true sort of average of the level of the ocean as it sees it from its 13 foot (period) world.

If the height and shape of both waves are the same, the surface of the board will be level. Obviously, if one wave crest is higher or broader than the other, that end of the board will be higher than the other. The board will be sloped from horizontal.

If we had attached a felt-tip pen to one end of the board and let it mark the motion of the end of the board onto some paper (yeah, waterproof), we would see the result of the movement of the end of the board as waves moved
under it. Although linear regression uses a straight line to form our board, MetaStock graphs the line that would result from the end of that board as it moves over the crests and troughs of the close of prices. If we had thrown a shorter board into the surf, it would pitch up and down and show a larger range of slope changes than the longer board. The pen attached to the shorter board will also more closely graph the shape of the waves. The analogy of the difference between a small boat and a supertanker in a storm could also be used.

If the foregoing has completely confused you, just do the following:
1. Open a chart of prices and double-click directly on the prices to change the price style to line.

2. Go to Insert, and line studies, and draw a 13 period linear regression line onto the prices anywhere on the graph.

3. Go to Indicator Quicklist and select Linear Regression Indicator. Put a 13 period indicator onto the prices.

4. Click directly on the 13 period line study bar that you drew in #2, and holding down the left mouse button, slide it left and right over the prices.

5. Cool, eh? Notice that the right end of the linear regression line study bar perfectly traces out the line that was graphed by the 13 period Linear Regression Indicator from the Quicklist.

6. Get back to the beach and offer a cold one to that gorgeous blonde that helped you find the boards.

-Corey Saxe



Corey,
Thanks for the reply. I like your wave analogy. I haven't used lin reg in Metastock, but have used it extensively elsewhere, and was surprised that the MetaStock implementation appeared to have no predictive capability i.e.
one can't explicitly look at a value say 5 bars into the future - thus thought maybe I had its particular implementation around my neck.

I suspect I should given a rather longer explanation of what I was getting at. I was looking for an answer which was as simple as last bar on chart based on n periods back, or the number of bars back was the same as the number forward (less likely) or the number of bars back was set implicitly. Thus, humble apologies.

This prompts question, have you tried using the robust statistic? I've not rigorously tried it for use in smoothing price as an input to an indicator, but have found that it gives superior results for volatility /EOD exposure calculations.

Many thanks

DJ.


David,
You can move the apparent data that LinearReg uses by 5 bars by using:
Forward: Ref(LinearReg(C,periods),5)
Backward: Ref(LinearReg(C,periods),-5)

If you need something for the end of the chart, try:
{My apologies to whoever the author was. I don't remember for sure where I got this.}

{Same as LinReg line study}
Pe:=Input("Periods",3,1000,10);
Z:=LastValue(LinearReg(C,Pe));
Y:=LastValue(Cum(1))-Cum(1);
U:=Z-(LastValue(LinRegSlope(C,Pe))*Y);
R:=0-(LastValue(Cum(1))-Pe);
A:=U+Ref(C,R)-Ref(C,R);
A;

Other than this, I don't think that there is any predictive value to the indicator.
Looking at previous support/resistance levels and price extremes is the extent that I use to "predict" anything. I'm one of those guys that the market delights in proving wrong if I go too far out on a limb to see around the corner. I prefer to ride in the "trailer" and let the market show which hill to take. Kind of like the guy that rides on the back of a county road repair truck and drops safety cones on the road. When "things" look good, I drop a cone. When we get to the crest of the hill, I drop another cone and exit the trade. I have much greater success riding the big hills rather than trying to extract profits out of every little bump. Keeps trading commission costs way down too.

-Corey Saxe



What I do with Linear Regression is:
  1. Take the log(C) - because a linear rising log(C) is an exponential rising chart of the stocks I am looking for. Log(C) and the projections are superior to C.
  2. LinRegSlope(log(C)) will give us the projection, preferably annualized.
  3. Calculate the projected standard-deviations. -1s, -2s, or even -5s.
  4. Screen NASDAQ stocks for the best annual projection.
  5. Apply some entry-techniques (trailing buy stop for example).
  6. Tight money management
  7. Tight stops.

Formula for (1) and (2), to be modified with input() etc.:


LinRegSlope & Standard Deviation of Daily ROC's

watch:= 63; {lookback period}
ttt:=252; {projection periods}
mmm:=LinRegSlope( Log(C), watch ); {LinRegSlope}
sss:=Stdev(ROC(Log(C),1,$),watch); {StandardDeviation of daily ROCs}
ra:=(Exp(mmm*ttt-2*sss*Sqrt(ttt))-1)*100; {Projection -2SD;"risk averse"}
pe:=(Exp(mmm*ttt- sss*Sqrt(ttt))-1)*100; {Projection -1SD;"pessimistic"}
ne:=(Exp(mmm*ttt )-1)*100; {neutral}
op:=(Exp(mmm*ttt+ sss*Sqrt(ttt))-1)*100; {Projection +1SD;"optimistic"}
ra; {to display}

 

Bodo
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!