FG1:
((c+ref(c,-1)+ref(c,-2)+ref(c,-3)+ref(c,-5)+ref(c,-8)+ref(c,-13)+ref(c,-21)+ref(c,-34)+ref(c,-55)+ref(c,-89)+ref(c,-144))/c)*-1
{{{adding closing price only on fib days
1,2,3,5,8,13,21,34,55,89 and 144 and then dividing by today's
close}}}
FG2:
mov(((c+ref(c,-1)+ref(c,-2)+ref(c,-3)+ref(c,-5)+ref(c,-8)+ref(c,-13)+ref(c,-21)+ref(c,-34)+ref(c,-55)+ref(c,-89)+ref(c,-144))/c)*-1,34,e)
{{{ 34 period mov avg of above indicator}}}
Look for crosses of the two indicators for positive or
negatives.
Now, there are many whipsaws. I don't recommend this as a
*system* at all, just as an indicator. It really highlights some
big moves but measuring it with the system test is useless. You
must use this as ONE of the tools -- not THE tool.
(Go
Top) |
In MetaStock for Windows, you can establish Fibonacci
Retracement levels as outlined in the November 1997 TASC article
"Using Fibonacci Ratios and Momentum" by Thom Hartle by first
creating an Expert in the Expert Advisor. To do this, choose
Expert Advisor from the Tools menu and then choose New. Enter
the following Expert Highlights and Expert Symbols into your
Expert.
Fibonacci Ratios and Momentum
Highlights
Name: RSI > 50
Condition: RSI(14) > 50
Color: Dk Green
Name: RSI < 50
Condition: RSI(14) < 50
Color: Red
Symbols
Name: Isolated Low
Condition: LOW < Ref(LOW,-1) AND
LOW < Ref(LOW,1)
Graphic: Buy Arrow
Color: Black
Label: Isolated Low
Name: Isolated High
Condition: HIGH > Ref(HIGH,-1) AND
HIGH > Ref(HIGH,1)
Graphic: Sell Arrow
Color: Black
Label: Isolated High
Note: If the Symbol labels make the chart too busy you may
want to shorten the label (e.g. change Isolated High to IH).
Next, close the Expert Advisor, open any chart, and then
click the right-mouse button on the chart’s heading. Choose
Expert Advisor and then Attach from the Chart Shortcut Menu. You
can now choose Fibonacci Retracement from the Insert menu, and
then drag from one isolated extreme to another. In MetaStock 6.5
you should right-click on the Fibonacci Retracement lines and
choose properties. Check the Snap to Price checkbox so the
Retracement lines will automatically snap to the high and low
prices.
(Go
Top) |
Dynamic Balance Point Calculation
dt:=DayOfWeek();
DBC:=(HighestSince(5,DayOfWeek()=dt,H)+
LowestSince(5,DayOfWeek()=dt,L)+CLOSE)/3;
DBC
(Go
Top) |
DPS:=(ValueWhen(1,FmlVar("FT-DBP","DBC"),
FmlVar("FT-DBP","DBC"))+
ValueWhen(5,FmlVar("FT-DBP","DBC"),
FmlVar("FT-DBP","DBC"))+
ValueWhen(10,FmlVar("FT-DBP","DBC"),
FmlVar("FT-DBP","DBC"))+
ValueWhen(15,FmlVar("FT-DBP","DBC"),
FmlVar("FT-DBP","DBC"))+
ValueWhen(20,FmlVar("FT-DBP","DBC"),
FmlVar("FT-DBP","DBC")))/5;
DPS;
(Go
Top) |
{NOTE: under Color/Style options, change
plot to last "style" option}
{Fixed Balance Point Calculation}
FBC:=If(DayOfWeek()=1 AND Ref(DayOfWeek(),-1)
<5,
{then}(HighestSince(2,DayOfWeek()=1,H)+
LowestSince(1,DayOfWeek()=1,L)+
CLOSE)/3,
{else}If(DayOfWeek()=5,
{then}(HighestSince(1,DayOfWeek()=1,H)+
LowestSince(1,DayOfWeek()=1,L)+
CLOSE)/3,
{else}0));
{Fixed Balance Point Plot}
FBP:=ValueWhen(1,FBC>0,FBC);
FBP
(Go
Top) |
{NOTE: under Color/Style options, change
plot to last "style" option}
{revised 1 Jan 99}
Mc1:=BarsSince(DayOfWeek()=1);
Fc1:=BarsSince(DayOfWeek()=5);
Fc2:=Ref(BarsSince(DayOfWeek()=5),-1)-1;
{Fixed Balance Point Calculation}
FBC:=If(Mc1=0 AND Fc1>2,
{then}(Ref(HHV(H,LastValue(mc1)),-1)+
Ref(LLV(L,LastValue(Mc1)),-1)+
Ref(C,-1))/3,
{else}If(Fc1=0 AND Mc1>5,
{then}(HHV(H,LastValue(Fc2))+
LLV(L,LastValue(Fc2))+C)/3,
{else}If(Fc1=0,
{then}(HHV(H,LastValue(Mc1))+
LLV(L,LastValue(Mc1))+C)/3,
{else}0)));
{Fixed Balance Point Plot}
FBP:=ValueWhen(1,FBC>0,FBC);
FBP;
(Go
Top) |
FPS:=(ValueWhen(1,FmlVar("FT-FBP","FBC")>0,
FmlVar("FT-FBP","FBC")) +
ValueWhen(2,FmlVar("FT-FBP","FBC")>0,
FmlVar("FT-FBP","FBC")) +
ValueWhen(3,FmlVar("FT-FBP","FBC")>0,
FmlVar("FT-FBP","FBC")) +
ValueWhen(4,FmlVar("FT-FBP","FBC")>0,
FmlVar("FT-FBP","FBC")) +
ValueWhen(5,FmlVar("FT-FBP","FBC")>0,
FmlVar("FT-FBP","FBC")))/5;
FPS
(Go
Top) |
{NOTE: under Color/Style options, change
plot to last "style" option}
{Weekly Price Range Calculation}
Mc1:=BarsSince(DayOfWeek()=1);
Fc1:=BarsSince(DayOfWeek()=5);
Fc2:=Ref(BarsSince(DayOfWeek()=5),-1)-1;
WRC:=If(Mc1=0 AND Fc1>2,
{then}Ref(HHV(H,LastValue(mc1)),-1)-
Ref(LLV(L,LastValue(Mc1)),-1),
{else}If(Fc1=0 AND Mc1>5,
{then}HHV(H,LastValue(Fc2))-
LLV(L,LastValue(Fc2)),
{else}If(Fc1=0,
{then}HHV(H,LastValue(Mc1))-
LLV(L,LastValue(Mc1)),
{else}0)));
WRP:=ValueWhen(1,WRC>0,WRC);
{Resistance Range}
RR1:= FmlVar("FT-FBP","FBP")+(WRP*.5);
RR2:= FmlVar("FT-FBP","FBP")+(WRP*.618);
{Support Range}
SR1:= FmlVar("FT-FBP","FBP")-(WRP*.5);
SR2:= FmlVar("FT-FBP","FBP")-(WRP*.618);
{Plot Ranges}
RR1;
RR2;
SR1;
SR2;
(Go
Top) |
{from Richard Estes}
Fml ( "Final Plot" ) =
If (BarsSince ( Fml ( "Downtrend" )) < BarsSince ( Fml (
"Uptrend" )),
{ then } Ref ( HHV (H,4), -1 ), { else } Ref (LLV (L,4) ,-1 ))
where........
Fml ( "Downtrend" ) =
Peak(1, If (L<Ref(LLV(L,4),-1) , Ref(HHV(H,4),-1), 0), 1) <>
Ref(Peak(1, If (L<Ref(LLV(L,4),-1) , Ref(HHV(H,4), -1), 0), 1)
and......
Fml ( "Uptrend" ) =
Peak(1, If (H>Ref(HHV(H,4),-1), Ref(LLV(L,4), -1), 0), 1) <>
Ref(Peak(1, If (H>Ref(HHV(H,4),-1), Ref(LLV(L,4), -1), 0), 1)
(Go
Top) |
A remark by Chuck LeBeau about trading with the trend has
stayed with me. He speaks of the actual strength of a trend as
opposed to merely its direction. Entry strategies (pullbacks in
his view) should be tailored to both direction and strength, he
says. This makes perfect sense to me.
Here are some initial thoughts. Perhaps you can help me to
arrive at some kind of "hierarchy" of trendiness, or call it a
classification, or a taxonomy,
consisting of both direction and strength. For convenience, I'll
describe only long trades.
I. General direction, long term:
EMA(21) > EMA(55)
II. Trend picks up steam:
EMA(13) > EMA(21) > EMA(55)
III. Strong:
EMA(8) >EMA(13) > EMA(21) > EMA(55)
IV. Somewhere between II. and III. the ADX(13/14) usually starts
rising. From what I've seen, a rising ADX at any level generally
means business:
ADX(13) > Ref(ADX(13),-1)
V. Very strong trend: (this is where Linda Bradford's "Holy
Grail" and such kick in)
ADX(13) > Ref(ADX(13) and
ADX(13) > 30
Almost forgot . . . very little direction (but don't fall asleep
at the wheel):
ADX(13) < say, 12-15 and has been bumbling along down there for
a while (hard to quantify for me to date)
(Go
Top) |
Many moons ago, I posted a little linear regression system
that featured the Forecast Oscillator. The response was
surprising (lots of it) and today, I still communicate with many
of the original respondents. I've continued to use the same
"framework" for my testing. In an earlier post today (a private
email that made it to the list...I'm a little dingy
tonight...had to get up a 5 am to trade cocoa), I alluded to
using the CMO. I've used many indicators in these tests (i.e.,
Forecast Oscillator, a modified Time Series Forecast, MACD
Histogram, Bollinger Band Histogram, CMO, & others).
Before I explain the method to my madness, please read the
following sentences carefully. Backtesting systems is very
dangerous. The act of backtesting is not the dangerous
part...believing that the results can be duplicated in the
future is very dangerous. Let's face it, we are "best fitting"
circumstances to static prices etched in stone. So please, I'd
prefer not to hear the lectures about the folly I pursue. I've
been system testing since 1975 and I've made a bazillion
mistakes (and a little chump change) over the years. I'm still
looking for the holy grail. So, here's the outline:
1. The basic formula:
Enter Long:
Cross(opt1,ForecastOsc(CLOSE,opt3))
Close Long:
Cross(ForecastOsc(CLOSE,opt3),opt2)
Enter Short:
Cross(ForecastOsc(CLOSE,opt3),opt2)
Close Short:
Cross(opt1,ForecastOsc(CLOSE,opt3))
You can substitute any standard formula for the ForecastOsc or
you can put in a custom formula (just remember that custom
formulae need to look like:
fml("Karnack's SuperSecret") It's in your manual.
2. opt3:
In this search "opt3" represents the number of days inserted
into the forecast oscillator. I usually use three (3) to ten
(10) for the forecast oscillator, but if I'm using a custom
formula, sometimes I don't even need opt3, because I using a
fixed set of parameters within the custom formula.
3. opt1:
Opt1 is the numeric value below a zero basis line that will
trigger a long position and close out the short. Yes Virginia,
in my secular little world, I prefer stop and reverse trading.
The parameters for this option depends on the commodity (and
yes, it does work on stocks) you're trading. One must eyeball
the forecast oscillator to see how far it swings above and below
zero. For the forecast oscillator, I usually use 0 to -3.
4. opt2:
Opt2 is the numeric value above a zero basis line that will
trigger a short sale. Zero to 3 seems to work for this formula.
5. Steps:
I step opt3 using whole numbers to represent days. With Opt1 and
Opt2, I use: .1 steps.
6. Other indicators:
When substituting the CMO (or any indicator) for the Forecast
Oscillator, one must be aware of the terrain the indicator
travels over. It would be ridiculous to us zero to 3 (as the
optimizing numbers) if the mid point is 50 and the indicator
traverses between +10 (on the downside) and +90 (on the upside).
The overall theory behind this test is that many indicator
oscillate from positive to negative and back again (duh). The
trick is not to trigger action when the indicator turns in a new
direction (if you're interested, I've been down that road and
I'm still wearing a neck brace from the whiplash). The theory is
that once an indicator extends to a certain level, the market is
either overbought or oversold.
In downtrending markets (can you spell deflation?), the short
sale trigger (opt2) is going to be closer to the zero basis line
than opt1. Please see the attachment. What will happen when the
grains, cocoa, crude, and damn near everything else starts to go
up? Good question Steve! The system will not perform as well if
you continue to use the same parameters. In a perfectly sideways
market, one would assume that the trigger points would be equal
distance from zero. As in many markets, this system works better
when things trend indefinitely.
I hope this post will help others who have inquired about the
linear regression system. Attached is the original system, using
the Forecast Oscillator, for March Crude Oil. In this example,
opt3 is set to 8 (number of days in the forecast oscillator);
opt2 is .1 (sell signal); opt1 is -2.3 (buy signal).
To quote R.N. Elliot: "Even though we many not understand the
cause underlying a particular phenomenon, we can, by
observation, predict the phenomenon's recurrence."
To qoute Karnack (my alter ego): "I got knocked down seven times
and got up eight".
Finally, from a trader on the realtraders forum: "Futures
trading involves financial risk, lots of it".
(Go
Top) |
Enter long:
Cross(ForecastOsc(C,21),Mov(C,3,E)) AND
Cross(ForecastOsc(C,21),0)
Exit long:
Cross(Mov(C,3,E),ForecastOsc(C,21)) AND
Cross(6,Mov(C,3,E))
(Go
Top) |
Enter long:
Cross(ForecastOsc(C,21),Mov(ForecastOsc(C,21),3,E)) AND
Cross(ForecastOsc(C,21),0)
Exit long:
Cross(Mov(ForecastOsc(C,21),3,E),ForecastOsc(C,21)) AND
Cross(6,ForecastOsc(C,21))
{You can use alert() function on either if you don't require
both conditions
to fire on the same day.}
(Go
Top) |
This indicator requires 3 sub calculations and then the
totalling of all 3 to get the final indicator:
This is the basic calculation:
Take the closing prices of your instrument 34 days ago - 26 days
ago (inclusive), multiply each daily value by 0.01 and write
each value down.
Then take the closing prices of your instrument 25 days ago - 18
days ago (inclusive), multiply each daily value by 0.02 and
write each value down.
Then take the closing prices of your instrument 25 days ago - 18
days ago (inclusive), multiply each daily value by 0.02 and
write each value down.
Then take the closing price of your instrument 17 days ago and
multiply by 0.03 ad write the value down.
Then take the closing price of your instrument 16 days ago - 8
days ago (inclusive), multiply by 0.031 and write each value
down.
Then take the closing price of your instrument 7 days ago - 6
days ago (inclusive), multiply by 0.006 and write each value
down.
Then take the closing price of your instrument 5 days ago - 1
day ago (inclusive), multiply by 0.07 and write each value down.
Then take the closing price of your instrument today, multiply
by 0.079 and write this value down.
Finally, add up all the values that you wrote down and plot the
value on the chart, repeat this for every new trading day.
Simple Interpretation:
Front Weighted 36 Day Moving Average is similar to all other
moving averages. The interpretation is just as with all others,
the trend is up when prices are above the moving average and the
trend is down when prices are below the moving averages. This
particular variation attempts to weight the data at the front
more than that at the back, with a sliding scale for each
trading days value.
Metastock code for Front Weighted 36 Day Moving Average:
Fml( "1FrontWeighted36BarMA1" ) +
Fml( "2FrontWeighted36BarMA2" ) +
Fml( "3FrontWeighted36BarMA3" )
Where Fml( "1FrontWeighted36BarMA1" ) =
0.01 * Ref(P,-34) +
0.01 * Ref(P,-33) +
0.01 * Ref(P,-32) +
0.01 * Ref(P,-31) +
0.01 * Ref(P,-30) +
0.01 * Ref(P,-29) +
0.01 * Ref(P,-28) +
0.01 * Ref(P,-27) +
0.01 * Ref(P,-26) +
0.02 * Ref(P,-25) +
0.02 * Ref(P,-24) +
0.02 * Ref(P,-23) +
0.02 * Ref(P,-22) +
0.02 * Ref(P,-21) +
0.02 * Ref(P,-20) +
0.02 * Ref(P,-19) +
0.02 * Ref(P,-18)
Where Fml( "2FrontWeighted36BarMA2" ) =
0.03 * Ref(P,-17) +
0.031 * Ref(P,-16) +
0.031 * Ref(P,-15) +
0.031 * Ref(P,-14) +
0.031 * Ref(P,-13) +
0.031 * Ref(P,-12) +
0.031 * Ref(P,-11) +
0.031 * Ref(P,-10) +
0.031 * Ref(P,-9) +
0.031 * Ref(P,-8) +
0.006 * Ref(P,-7) +
0.006 * Ref(P,-6) +
0.07 * Ref(P,-5) +
0.07 * Ref(P,-4) +
0.07 * Ref(P,-3) +
0.07 * Ref(P,-2)
Where Fml( "3FrontWeighted36BarMA3" ) =
0.07 * Ref(P,-1) +
0.079 * P
(Go
Top) |
{The following is copied from the Formula Field of my *RSI
canonical_12_day_for_P_I indicator. Change m if you choose
another # of periods n for rsi.}
{I wrote my own "canonical" RSI(12) which coincides with
MetaStock's RSI(12) if m=2*n-1 where m is used below in Mov(
,m,E); n - a number of periods in rsi(n). Mind that since I
didn't use those particular tricks from the standard rsi(n) to
shorten the initial transitional period, this function and
standard rsi(n) differ for about month or so from the day 1. It
was not that important for me, so I used this shortcut.}
100 - 100/
(1.+ If(Mov(If(P-Ref(P,-1)<0,-(P-Ref(P,-1)),0),23,E)=0,1000000,
Mov(If(P-Ref(P,-1)>0, P-Ref(P,-1), 0),23,E)
/Mov(If(P-Ref(P,-1)<0,-(P-Ref(P,-1)),0),23,E)
))
(Go
Top) |
To create the Freeburg Precious Metal Switch Fund system in
MetaStock for Windows, you must first create the K ratio as a
composite security. To do this, launch The Downloader from
MetaStock, and choose New and then Composite from The
Downloader's File menu. Make sure the directory specified is the
directory where your weekly GMI and Handy and Harman data are
located. Name the composite the K ratio, then choose the
Barron's Gold Mining Index as the Primary symbol and Handy and
Harman prices as the secondary symbol. Next, choose Divide as
the Operator and the click the OK button to add the composite.
Open the K ratio chart in MetaStock, Plot the Bollinger Bands
Indicator and enter 46 for the number of periods and 2.3 for the
standard deviations. Plot Bollinger Bands again and enter 4 for
the periods and 1.6 for the Standard Deviations.
The data necessary for this chart/indicator, is extremely
difficult to obtain. The only source we are aware of on diskette
is the author of the article. The data is in a Lotus
spreadsheet. It must be output to ASCII and then converted to
MetaStock data files. He will make a small charge for this data.
To keep the GMI data updated, it is only available from Barrons
magazine and must be manually input. The Handy & Harman data
must also be manually updated. This may be obtained from the
Wall Street Journal as well.
(Go
Top) |
In Walter Downs’ article "From Terms To Technical Tools" he
introduces the Point of Balance Oscillator, two conditions to
colour bars and two system tests. All of these can be created
quite easily in MetaStock 6.5. To create the Point of Balance
Oscillator, choose Indicator Builder from the Tools menu, click
on the New button, and enter the following formula:
Point of Balance Oscillator |
n := Input("Time
Periods",1,100,12)/2;
POBC1 := (HHV(CLOSE, n) + LLV(CLOSE,n))/2;
POBC2 := (HHV(POBC1, n) + LLV(POBC1,n))/2;
POBC3 := (HHV(POBC2, n) + LLV(POBC2,n))/2;
POBC4 := (HHV(POBC3, n) + LLV(POBC3,n))/2;
POBC5 := (HHV(POBC4, n) + LLV(POBC4,n))/2;
POBC6 := (HHV(POBC5, n) + LLV(POBC5,n))/2;
POBC7 := (HHV(POBC6, n) + LLV(POBC6,n))/2;
POBC8 := (HHV(POBC7, n) + LLV(POBC7,n))/2;
POBC9 := (HHV(POBC8, n) + LLV(POBC8,n))/2;
POBC10 := (HHV(POBC9, n) + LLV(POBC9,n))/2;
AV := (POBC1 + POBC2 + POBC3 + POBC4 + POBC5
+ POBC6 + POBC7 + POBC8 + POBC9 + POBC10) /
10;
POBCOsc := 100 * ((CLOSE - AV) / (HHV(CLOSE,
10)-LLV(CLOSE, 10)));
POBCOsc |
|
To highlight bars based on the Bull Fear and Bear Fear
conditions discussed in the article, choose Expert Advisor from
the Tools menu, click on the New button and enter the following
expert:
Bull Fear and Bear Fear Expert -
Highlights |
Name: Bull Fear |
Condition:
n := 12 {Time periods};
BullFear := (HHV(HIGH,n) - LLV(HIGH,n))/2 +
LLV(HIGH,n);
CLOSE > BullFear |
Color: Blue |
|
Name: Bear Fear |
Condition:
n := 12 {Time periods};
BearFear := (HHV(LOW,n) - LLV(LOW,n))/2 +
LLV(LOW,n);
CLOSE < BearFear |
Color: Red |
|
To test the two systems discussed in the article, choose
System Tester from the Tools menu and enter both of the
following systems:
Bull and Bear Fear System Test -
Signal Formulas |
Enter Long:
n := 12 {Time periods};
BullFear := (HHV(HIGH,n) - LLV(HIGH,n))/2 +
LLV(HIGH,n);
Cross(CLOSE,BullFear) |
Enter Short:
n := 12 {Time periods};
BearFear := (HHV(LOW,n) - LLV(LOW,n))/2 +
LLV(LOW,n);
Cross(BearFear,CLOSE) |
|
Four-Bar Fear System Test -
Signal Formulas |
Enter Long:
n := 12 {Time periods};
BullFear := (HHV(HIGH,n) - LLV(HIGH,n))/2 +
LLV(HIGH,n);
BearFear := (HHV(LOW,n) - LLV(LOW,n))/2 +
LLV(LOW,n);
Cross(CLOSE,BullFear) AND Ref(Sum(CLOSE <
BullFear AND CLOSE > BearFear,4),-1) = 4 |
Close Long:
LOW < Ref(LLV(LOW,3),-1) |
Enter Short:
n := 12 {Time periods};
BullFear := (HHV(HIGH,n) - LLV(HIGH,n))/2 +
LLV(HIGH,n);
BearFear := (HHV(LOW,n) - LLV(LOW,n))/2 +
LLV(LOW,n);
Cross(BearFear,CLOSE) AND Ref(Sum(CLOSE <
BullFear AND CLOSE > BearFear,4),-1) = 4 |
Close Short:
HIGH > Ref(HHV(HIGH,3),-1) |
|
After entering the systems click on the Options button in the
System Tester dialog, go to the Testing tab and change the Trade
Price to Open and set the Trade delay to one.
Following is the formula for the moving averages discussed in
the article, but not contained in the Traders Tip published in
TASC. Please note, this formula will plot all three moving
averages, but will not plot them in three different colours.
Moving Averages Formula for
MetaStock |
TP:=Input("Time
Periods",1,100,12);
BLF:=((HHV(H,TP)+LLV(H,TP))/2);
BRF:=((HHV(L,TP)+LLV(L,TP))/2);
POB:=((BLF-BRF)/2)+BRF;
BLF;
BRF;
POB |
|
(Go
Top) |
|