8-27-2006
Welcome and hope you find these files of use to you
This zip files includes the following:
LinRegress +
2SD's.afl
8/27/2006
Fred Thomas-Two
Linear Regress's. Good idea. I'll use that. Lookbacks of 100days, and 20 days.
Adjust as needed.
Here's the afl for the 2 SD's I posted above:
LR.afl & LR.png
8/27/2006
Fred Tonetti-Here's
most of the main chart Section for Linear Regression that I use which has some
added bells and whistles ... This can be included in the standard _Price.AFL if
one desires to allow the plot to appear directly on the main price chart.
As you can see the plot itself works off of the range markers. It also shows a
single vertical histogram where the last bar in the range is. Beyond that is an
extrapolation of the L/R line and channel. It allows shows text for the Standard
Deviation multiplier that is in play.
I don't have comments in the AFL so I'll explain a little of what the parameters
do ...
The first parameter is simply whether or not to show the indicator.
LinReg = ParamList("Linear Regression ?", "No|Yes");
This allows color selection of the linear regression line and corresponding
channel.
LRColor = ParamColor("L/R Color", colorwhite);
This allow style selection.
LRStyle = ParamStyle("L/R Style", styleLine | styleDashed, maskAll);
This is the standard deviation multiplier used to position the L/R Channel lines
above and below the L/R.
SDMult = Param("Std Dev Multiplier", 2.00, 0.01, 5.00, 0.01);
This allows the top and bottom lines to be AUTOMATICALLY placed as opposed to
using the fixed multiplier above.
SDAuto = ParamList("S/D Auto", "No|Yes");
Used in conjunction with SDAuto and specifies how many points over the period of
the L/R to fix outside the high / low channel boundaries
SDPoints= Param("Auto Points", 1, 1, 10, 1);
Used in conjunction with SDAuto and SDPoints to specify whether points need to
be found both above the + SD line and below the - SD line or only one or the
other.
SDWhich = ParamList("Which Points", "Both|Either");
This specifies how many bars into the future the L/R should be extrapolated.
SDProj = Param("Projection", 0, 0, 100, 1);
The L/R Channel Lines in the above chart were fixed and drawn automatically by
making SDAuto=Yes, SDPoints=1 and SDWhich=1 ... As a result you can see that one
H touches to the upper L/R Channel line.
LR2-6.png
8/26/2006
Fred Tonetti-I'll
give you one way you can use or at least play with this ...
As you can see from the chart below at some time in May one would have decided
the short term trend had changed from down to up and as a result one would be
looking for places to buy bottoms as opposed to shorting tops. However, on 5/9
although there appears to be a new channel developing there is no width to it so
no real way to discern where bottoms and top are being made.
LR1
If you reconstruct the
channel with the end point being where the next high is on 5/23 now we see that
there is a real channel. Two bars later price is close to the bottom of the
channel i.e. a possible decent buy point. 4-5 bars later price is at the top of
the channel i.e. a possible decent sell point relative to the buy point with
prices then ~3% above ... LR2
Reconstructing the
channel again using the high on 6/2 as our end point we see again 2-5 bars later
we have another possible decent buy point and that half a dozen or so bars later
another possible decent sell point with prices again ~3% above.LR3
Reconstructing the
channel again using the high on 6/17 as our end point we see 4 bars later that
we have another possible decent buy point LR4
However, when we push the
chart ahead a couple of bars ... look what we see ... price action that begins
to look like it is a trend reversal LR5
As can be seen from
followup price action this was not the case ... but this would have been
difficult to discern in the prior chart. LR6
So ... can indicators
like this help us buy the dips in uptrends and/or short tops in downtrends ? ...
I think so, but there are pitfalls ...
In the case above and what one would have done after seeing the next bar or two
after LR4 ... if we had sold we would have had a loss but it would have been a
relatively small one. If we had held we would have been rewarded by price
returning to the upper channel. Was there a way to know it would have ?
It is I think instructive for those of you who are visual traders who use
indicators like this to incorporate the discipline to move the chart to the left
one bar at a time and note what you'd do on the right edge. Without this
discipline it is way too easy to state retrospectively that oh yes I would have
done this or that. Even better if you remove the dates and price scale from the
chart so you really don't have a frame of reference in that regard either. For
those of you who are system traders there are ways to incorporate this decision
making process into your systems.
FT-Util.afl
9/6/2006
Ken Close-Bruce
Robinson created a ft-util.afl several years ago, and I think he updated it. It
has subroutines in it called PutFNU, and takes variables from AB code and
creates the proper syntax/format for a FNU file.
I will list the older ft-util.afl here. Someone else can jump in and say whether
there is an improved version. Actually, whether or not there is an improved
version, this version writes FNU files just fine.