Page 4                                                      

Denvelope

In the Oct issue of "Futures" there is an article written by Dennis McNicholl called "Better Bollinger Bands". In his
article he describes how in a trending market the center band of the B.B. will shift away from the "mean" value of
the price, and that the two outer bands will shift outward to such an extent that the envelope loses its utility as a
volatility gauge (these are his words... not mine).  As usual "Futures" only posted the TradeStation code,
so this is my conversion from it. He called the Indicator "Denvelope", and it runs the bands much closer.....
similar to "Standard Error Bands".
{Denvelope}
{Better Bollinger Bands}
Lb:=Input("Look-Back Period ?",3,100,20);
De:=Input("Band Deviation ?",.5,3,2);
Alp:=2/(Lb+1);
Mt:=Alp*CLOSE+(1-Alp)*PREV;
Ut:=Alp*Mt+(1-Alp)*PREV;
Dt:=((2-Alp)*Mt-Ut)/(1-Alp);
mt2:=Alp*Abs(C-Dt)+(1-Alp)*PREV;
ut2:=Alp*mt2+(1-alp)*PREV;
dt2:=((2-Alp)*mt2-ut2)/(1-Alp);
But:=Dt+de*dt2;
Blt:=Dt-de*dt2;
But;
Dt;
Blt;

Best wishes, Adam Hefner e-mail: VonHef@itlnet.net


Metasto
ck Formulas from Equis

The following collection of formulas appears at http://www.equis.com/customer/support/
and is a selection of those more useful for Australian conditions. New free Metastock
formulas are added regularly.

Adaptive Moving Average by Perry Kauffman

This is a Metastock for Windows version 6.5 formula.

Periods := Input("Time Periods",1,1000, 10);

Direction := CLOSE - Ref(Close,-periods);

Volatility := Sum(Abs(ROC(CLOSE,1,$)),periods);

ER := Abs(Direction/Volatility);

FastSC := 2/(2 + 1);

SlowSC := 2/(30 + 1);

SSC := ER * (FastSC - SlowSC) + SlowSC;

Constant := Pwr(SSC,2);

AMA := If(Cum(1) = periods +1, ref(Close,-1) + constant * (CLOSE - ref(Close,-1)),
Prev + constant * (CLOSE - PREV));

AMA

 

Average-Modified Method

From The New Commodity Trading Systems and Methods,
by Perry J. Kaufman Chapter 4 - Moving Averages, pg. 60.

This formula is for version 6.5 of MetaStock for Windows 95 & NT only and cannot be written in previous version.
This is a modified simple moving average.

The formula will prompt you for input for the number of time periods to use in the moving average.

Day:=Cum(1)+1;

Z:=Input("Periods",2,1000,5);

MV:=(1/Z);

If(Day<(Z+2),C,If(day=(Z+2),Mov(C,LastValue(Z),S),PREV+(MV*(C-PREV))))

 

Investor Preference Index

This indicator was discussed in the December 1997 Technical Analysis of Stocks & Commodities magazine, page 19. The article was written by Cyril V. Smith Jr.

"This indicator, a long - term stock market investment tool, compares the performance of the S&P 500 to the New York Stock Exchange index to measure sentiment. The theory is that investors have a preference for certain types of investments, blue chips versus mid-cap, during phases of a bull market."

To plot this in MetaStock for Windows, follow these instructions. When complete, if you save this as a chart, you will simply need to load the chart and it will recalculate using the newest data.

  • Open a chart of the S&P 500.
  • Open a chart of the New York Stock Exchange index.
  • Drag the S&P 500 price plot into the NYSE chart.
  • Drop the indicator listed below on the plot of the S&P 500. The plot will turn a different color when you are pointing at it.
  • The resultant plot is the Investor Preference Index.

Formula: Investor Preference Index:

(Sum(Mov(ROC(Log(C),24,%)-ROC(Log(P),24,%),15,S)-Mov(ROC(Log(C),24,%)-ROC(Log(P),24,%),38,S),54)+1)*100

System test:

Enter Long

C=HHV(C,26)

Close Long

Fml("Investor Preference Index")<97.6 AND ROC(Fml("Investor Preference Index"),2,$)<=(-.04)

 

Slope of a Linear Regression Line rev. 01/06/97

The following custom formula will return the slope of a Linear Regression Line.
tp:=Input("Time Periods",1,200,21);

((tp*(Sum(Cum(1)*C,tp)))-(Sum(Cum(1),tp)*(Sum(C,tp))))/((tp*Sum(Pwr(Cum(1),2),tp))-Pwr(Sum(Cum(1),tp),2))

 

WillSpread by Larry Williams

The Larry Wiliams' indicator named WillSpread is quite easy to plot in MetaStock for Windows version 6.5.
Using version 6.5 of MetaStock for Windows, please follow these steps.

    • Plot the underlying commodity.
    • Drag the Spread Indicator from the indicator quick list to this commodity chart.
    • Select either Tbonds or Tbills as the security to use to spread. I recommend you plot this in a new inner window.
    • Drag the Price Oscillator from the indicator quick list and drop it on the SPREAD plot, not the price plot. The parameters Mr. Williams' uses are 7 and 11 time period exponential moving averages. You also want to use "points" as the method. This plot is the WillSpread indicator.
    • At this point, you may change the Spread Indicator plot's color to match the background of the chart, or perhaps move the WillSpread indicator to a separate inner window.

If you save this first effort as a template, perhaps named WillSpread, you are able to apply this template to any commodity you wish and the indicator will be automatically calculated against that commodity.

You may also use the "Next Security" function within MetaStock for Windows to view each of your commodities by setting the options for next security to "Keep line studies". If you apply this template to the first commodity in your futures folder, you may then use the right arrow to move down the folder contents. Each new commodity will have the WillSpread calculated as it is loaded.

 

Formulas from Stocks and Commodities
Magazine

  The following collection of formulas are taken from Stocks and Commodities magazine.  A subscription soon pays for itself. This is a selection of those more useful for Australian conditions. Others are available from http://www.equis.com/customer/support/

1996 August TASC Trader's Tips

Connors & Raschke's Historical Volatility System

Here is the Connors and Raschke's historical volatility system exploration in August 1996 TASC Trader's Tips translated for MetaStock.

COLUMN FORMULAS

Column A : Vol ratio

std(log(C/ref(C,-1)),5)/std(log(C/ref(C,-1)),99)

Column B : NR4 day

if(HIGH-LOW,<,ref(llv(H-L,3),-1),1,0)

Column C : Inside

if(HIGH,<,ref(HIGH,-1),if(LOW,>,ref(LOW,-1),1,0),0)

Column D : High

HIGH

Column E : Low

LOW

FILTER FORMULA

Formula:

when(colA,<,0.5) AND (when(colB,=,1) OR when(colC,=,1))

1997 October TASC Traders Tip

Volatility Bands as a Long Term Strategy

This article "Volatility Bands As A Long Term Strategy", by Ahmet Tezel, Ph.D., and Suzan Koknar-Tezel, M.S., which appears in this issue introduces two different volatility band trading systems. One system uses bands based on moving averages and the other is based on bands which use regression. To plot the Moving Average Asymmetric Volatility Price Bands in MetaStock for Windows, simply plot Bollinger Bands using 11 periods and 1.7 standard deviations. Then click your right-mouse button while the cursor is over the lower band and choose properties. Change the standard deviations to 2. This plot will now appear exactly as the bands discussed in the article.

To plot the Regression Asymmetric Volatility Price Bands in Metastock for Windows, simply plot Standard Error Bands using 21 periods, 1 for standard errors, and 1 for the smoothing periods. Then click your right-mouse button while the cursor is over the lower band and choose properties. Change the standard errors to 1.5.

To recreate the systems in MetaStock for Windows, choose System Tester from the Tools menu. Next choose New and enter the following trading rules and stop conditions. After entering this information, choose Options and change the trade delay to 1, then change the Trade Price to Open. If you have MetaStock 6.5 enter the first set of formulas. MetaStock 6.5 allows variables which will allow you to change the periods when testing much more easily.

Formulas for MetaStock 6.5

MovAvg Asymmetric Volatility Price Bands

SIGNAL FORMULAS

Enter Long:
Periods := 11;
UpperBand := BBandTop(CLOSE,Periods,S,1.7);

BuySignal1 := Sum(CLOSE > UpperBand,3) = 3;

BuySignal2 := CLOSE > UpperBand AND Ref(LOW,-1) > Ref(upperband,-1);

BuySignal3 := LOW > UpperBand AND Ref(CLOSE,-1) > Ref(upperband,-1);

BuySignal4 := CLOSE > UpperBand AND CLOSE > 1.4 * LLV(LOW,Periods + 1) AND Mov(VOLUME,3,S) > 2000 {assuming volume in 100's otherwise use 200000} AND Mov(HIGH,3,S) > UpperBand AND Mov(HIGH - LOW,3,S) > Mov(HIGH - LOW,Periods,S);

BuySignal1 OR BuySignal2 OR BuySignal3 OR BuySignal4

Close Long:
Periods := 11;
LowerBand := BBandBot(CLOSE,Periods,S,2);

SellSignal1 := Sum(CLOSE < LowerBand,3) = 3;

SellSignal2 := CLOSE < (1-.18) * HHV(HIGH,Periods + 1) AND Sum(CLOSE < LowerBand,2) = 2;

SellSignal3 := CLOSE < (1-.18) * HHV(HIGH,Periods + 1) AND HIGH < LowerBand;

SellSignal1 OR SellSignal2 OR SellSignal3

STOPS
Maximum Loss: LONG ONLY

10.00 Percent

 

Regression Asymmetric Volatile Price Band

SIGNAL FORMULAS

Enter Long:
Periods := 21;
UpperBand := STEBandTop(CLOSE,Periods,1) ;

Sum(CLOSE > UpperBand,3) = 3 AND LinRegSlope(CLOSE,21) > 0 AND ROC(Correl(CLOSE,Cum(1) ,21,0),2,$) >= .2

Close Long:
Periods := 21;
LowerBand := STEBandBot(CLOSE,Periods,1.5) ;

SellSignal1 := Sum(CLOSE < LowerBand,3) = 3;

SellSignal2 := CLOSE < (1-.18) * HHV(HIGH,Periods + 1) AND HIGH < LowerBand;

SellSignal1 OR SellSignal2

STOPS

Maximum Loss: LONG ONLY

10.00 Percent

 

1997 November TASC Traders Tip

Fibonacci Ratios and Momentum

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.

 

1997 December TASC Trader's Tip

Volatility % Indicator

You can easily create the Volatility% Indicator from William Brower’s article in MetaStock for Windows. First choose Indicator Builder from the Tools menu in MetaStock. Next choose New and enter one of the following formulas:

Formula for MetaStock 6.5

Volatility%

Lookback := Input("Time Periods",1,1000,50);

HighVolatility := Input("High Volatility %",.01,100,3);

100 * Sum(100 * ATR(1)/CLOSE > HighVolatility, Lookback)/Lookback

Formula for earlier versions of MetaStock for Windows

Volatility%

100 * Sum(100 * ATR(1)/CLOSE > 3, 50)/50

Now drag the Volatility% from the Indicator QuickList and drop it on the desired chart.

 

1998 February TASC

Double Tops and Double Bottoms

In the February 1998 issue of Technical Analysis of Stocks & Commodities magazine, Thomas Bulkowski discusses the use of Double Bottoms as a means of finding profitable trades.

In MetaStock for Windows, you can find both Double Tops and Double Bottoms with these formulas. There is a caveat however. In the article, Mr. Bulkowski utilizes the High-Low range in finding Double Bottoms. These formulas use only the close value, so a few of the lower priced issues will not produce signals in MetaStock. Overall, however, these formulas produce most of the major signals he discusses.

Double Tops

PK:=Zig(C,10,%)<Ref(Zig(C,10,%),-1) AND Ref(Zig(C,10,%),-1)>Ref(Zig(C,10,%),-2);

TR:=Zig(C,10,%)>Ref(Zig(C,10,%),-1) AND Ref(Zig(C,10,%),-1)<Ref(Zig(C,10,%),-2);

PK1:=PeakBars(1,C,10);

PK2:=PeakBars(2,C,10);

(ValueWhen(1,PK,Ref(C,-1))/ValueWhen(2,PK,Ref(C,-1))>.96 AND ValueWhen(1,PK,Ref(C,-1)) / ValueWhen(2,PK,Ref(C,-1))<1.04) AND PK2-PK1>=10 AND Cross(ValueWhen(1,TR,Ref(C,-1)),C)

Double Bottoms

PK:=Zig(C,10,%)<Ref(Zig(C,10,%),-1) AND Ref(Zig(C,10,%),-1)>Ref(Zig(C,10,%),-2);

TR:=Zig(C,10,%)>Ref(Zig(C,10,%),-1) AND Ref(Zig(C,10,%),-1)<Ref(Zig(C,10,%),-2);

TR1:=TroughBars(1,C,10);

TR2:=TroughBars(2,C,10);

(ValueWhen(1,TR,Ref(C,-1))/ValueWhen(2,TR,Ref(C,-1))>.96 AND ValueWhen(1,TR,Ref(C,-1)) / ValueWhen(2,TR,Ref(C,-1))<1.04) AND TR2-TR1>=10 AND Cross(C,ValueWhen(1,PK,Ref(C,-1)))

 

1998 May TASC Trader's Tip

Automatic Support and Resistance

Copied from Technical Analysis of Stocks and Commodities Magazine. This is in regards to an article on page 51 of the May 1998 issue.
In my article "Automatic support and resistance" in this issue, I present a computerized approach to finding support and resistance levels on a chart. To recreate the indicators and system described in my article using MetaStock for Windows, enter the following formulas:

Indicators:
S1: IF(Ref(LOW,-4)=LLV(LOW,9),Ref(LOW,-4),PREVIOUS)
S2: IF(Fml("S1")=Ref(Fml("S1"),-1),PREVIOUS,Ref(Fml("S1"),-1))
S3: IF(Fml("S1")=Ref(Fml("S1"),-1),PREVIOUS,Ref(Fml("S2"),-1))
S4: IF(Fml("S1")=Ref(Fml("S1"),-1),PREVIOUS,Ref(Fml("S3"),-1))
S5: IF(Fml("S1")=Ref(Fml("S1"),-1),PREVIOUS,Ref(Fml("S4"),-1))
S6: IF(Fml("S1")=Ref(Fml("S1"),-1),PREVIOUS,Ref(Fml("S5"),-1))

WSO: 100*(1­(Int(Fml("S1")/CLOSE)+Int(Fml("S2")/CLOSE)+Int(Fml("S3")/CLOSE)+Int(Fml("S4")/CLOSE) +Int(Fml("S5")/CLOSE)+Int(Fml("S6")/CLOSE))/6)

R1: IF(Ref(HIGH,-4)=HHV(HIGH,9),Ref(HIGH,-4),PREVIOUS)
R2: IF(Fml("R1")=Ref(Fml("R1"),-1),PREVIOUS,Ref(Fml("R1"),-1))
R3: IF(Fml("R1")=Ref(Fml("R1"),-1),PREVIOUS,Ref(Fml("R2"),-1))
R4: IF(Fml("R1")=Ref(Fml("R1"),-1),PREVIOUS,Ref(Fml("R3"),-1))
R5: IF(Fml("R1")=Ref(Fml("R1"),-1),PREVIOUS,Ref(Fml("R4"),-1))
R6: IF(Fml("R1")=Ref(Fml("R1"),-1),PREVIOUS,Ref(Fml("R5"),-1))

WRO: 100*(1­(Int(Fml("R1")/CLOSE)+Int(Fml("R2")/CLOSE) +Int(Fml("R3")/CLOSE)+Int(Fml("R4")/CLOSE) +Int(Fml("R5")/CLOSE)+Int(Fml("R6")/CLOSE))/6)

The indicators S1 through S6 and R1 through R6 should be plotted as points and not as a continuous line.

Trading System Formulas and Parameters: Enter long positions on either building support or sustained uptrend and exit position using stops. No short positions.

Enter Long: Fml("WSO") > Mov( Fml("WSO") , 4 , S ) OR Mov( Fml("WRO") , 30 , S ) > 95

Stop Out:

Breakeven stop: Floor level at 2%

Trailing stop: Profit risk of 10 Percent, ignoring 10 periods

Maximum loss stop: Maximum loss of 7%

Other Conditions:

Initial equity = 1000, Long positions only, Trade price = close, Trade delay = 0, Entry commission = 0%, Exit commission = 0%, , Interest rate = 5%, Margin req. 100%

Mel Widner, Ph.D., 703 791-5910 E-mail techstrategies@msn.com

 

1998 June TASC Traders' Tip

Mutated Variables, Volatility and a New Market Paradigm

Mutated Variables, Volatility and a New Market Paradigm by Walter T. Downs, Ph.D.

In MetaStock for Windows 6.0 or higher, use the Expert Advisor to create highlights, which will show when contraction and expansion phases are present. First, choose Expert Advisor from the tools menu in MetaStock. Create a new Expert with the following highlights:

Expert name: New Market Paradigm

HIGHLIGHTS

Name: Contraction

Condition: BBandTop(CLOSE,28,SIMPLE,2)< Ref(BBandTop(CLOSE,28,SIMPLE,2),-1) AND

BBandBot(CLOSE,28,SIMPLE,2)>Ref(BBandBot(CLOSE,28,SIMPLE,2),-1)

Color: Blue

Name: Expansion

Condition: BBandTop(CLOSE,28,SIMPLE,2)> Ref(BBandTop(CLOSE,28,SIMPLE,2),-1) AND

BBandBot(CLOSE,28,SIMPLE,2)<Ref(BBandBot(CLOSE,28,SIMPLE,2),-1)

Color: Red

Click OK to save the changes to the Expert. Open a chart and then click your right-mouse button while pointing at the chart heading. Choose Expert Advisor and then choose Attach from the chart shortcut menu. Choose the New Market Paradigm Expert and then click the OK button. The price bars in the chart will be highlighted blue during a contraction phase and red in an expansion phase.

1998 July Trader's Tip

Channel Analysis

Channel Analysis, beginning on page 18 of the July 1998 Technical Analysis of Stocks & Commodities Magazine It's quite easy to create the Trend Channels discussed in Thom Hartle's Channel Analysis article in MetaStock for Windows. After opening a chart, you may want to zoom in a little to make it easier to draw the Trend Channels more precisely. You can do this by clicking on the "+" button located on the Chart Toolbar at the bottom of the chart. Next you may want to identify the bars for the support or resistant points by drawing circles on the bars as Mr. Hartle did in the article, or you can use symbols from the symbol pallete. Both can be chosen from the Drawing Toolbar which is on left side of the chart. After identifying the points to draw the trendline, click on the Trendline button, also located on the Drawing Toolbar, and draw the trendline between the closing prices of the two bars. If you are using MetaStock 6.5, you may want to right-click on the trendline, choose properties, and then check the Snap to Price checkbox. This will make the trendline line up exactly with the closing prices. To create the second trendline of the Trend Channel, right-click on the first trendline and choose Create Parallel Line. Drag this parallel line so it aligns with the highest high between the two support points or the lowest low between two resistance points. If desired, you can go to the properties of each of these trendlines and choose to extend the lines to the right.