Request Information From Advertisers
|
Home | S&C Magazine | Working Money | Traders' Resource | Message-Boards | Store
June 2001
TRADERS' TIPS
Here is this month's selection of Traders' Tips, contributed by various
developers of technical analysis software to help readers more easily implement
some of the strategies presented in this issue.
You can copy these formulas and programs for easy use in your spreadsheet
or analysis software. Simply "select" the desired text by highlighting
as you would in any word processing program, then use your standard key
command for copy or choose "copy" from the browser menu. The copied text
can then be "pasted" into any open spreadsheet or other software by selecting
an insertion point and executing a paste command. By toggling back and
forth between an application window and the open Web page, data can be
transferred with ease.
This month's tips include formulas and programs for:
or return to June 2001 Contents
TradeStation EasyLanguage
Christian Fries's elastic volume-weighted moving average (eVwma), described
in the article "Elastic Moving Averages" elsewhere this issue, can be implemented
as an indicator in TradeStation's EasyLanguage as follows:
inputs:
Price( Close ),
VolumeDivisor( 1 ),
N( 100000 ) ;
variables:
eVWMA( 0 ),
ScaledVol( 0 ),
VolDiff( 0 ),
Violation( false ) ;
if CurrentBar = 1 then
eVWMA = Price
else
begin
ScaledVol = Volume / VolumeDivisor ;
VolDiff = N - ScaledVol ;
if VolDiff < 0 and Violation = false then
Violation = true ;
if Violation = true then
eVWMA = eVWMA[1]
else
eVWMA = ( VolDiff * eVWMA[1] + ScaledVol * Price ) / N ;
end ;
Plot1( eVWMA ) ;
The default value for the price input is set to the close value. This can
be edited at the time the indicator is applied to a chart. The user may
want to experiment with other values for price, such as MedianPrice. MedianPrice
is a built-in function in EasyLanguage that returns (High + Low) / 2.
If the volume figures on the chart are too large, this can result in
overflow errors at runtime. In such a case, the user should scale down
the volume by increasing the VolumeDivisor input (the default setting of
"1" results in no scaledown).
Finally, the default value for the total volume, N, is set to 100,000.
If this turns out to be less than the scaled volume at any bar on the chart,
the indicator is designed to plot a flat line from there onward. In such
a case, N needs to be increased.
This code will be available for download at TradeStation Technologies'
website. Look for the file "ElasticVwma.Els."
--Ramesh Dhingra, Product Manager, EasyLanguage
TradeStation Technologies, Inc. (formerly Omega Research, Inc.)
A wholly owned subsidiary of TradeStation Group, Inc.
http://www.TradeStation.com
GO BACK
MetaStock For Windows
In his article "Elastic Moving Average" in this issue, Christian Fries
introduces the eVWMA indicator. To recreate this indicator in MetaStock,
select the Indicator Builder from the Tools menu. Then click New and enter
the following formula:
eVWMA
n := Input("Enter the number of shares: ",1,1000000,1);
eVWMA := ((n-V)*PREV+(V*C))/n;
eVWMA
--Cheryl C. Abram, Equis International, Inc.
http://www.equis.com
GO BACK
MetaStock For Windows
The formulas discussed by Gordon Gustafson in his article in this issue,
"Which Volatility Measure?" can be recreated in MetaStock 6.52 or higher.
To recreate these indicators in MetaStock, select the Indicator Builder
from the Tools menu. Then click New and enter the following formulas:
Standard Deviation Bands
stdh := Mov(C,20,E)+2*(Stdev(C,20));
stdl := Mov(C,20,E)-2*(Stdev(C,20));
stdh;
stdl
Average True Range Bands
stdha := Mov(C,20,E)+2*(ATR(20));
stdla := Mov(C,20,E)-2*(ATR(20));
stdha;
stdla
--Cheryl C. Abram, Equis International, Inc.
http://www.equis.com
GO BACK
NeuroShell Trader
Christian Fries's elastic moving average (eVWMA), described in his article
in this issue, can be easily implemented in NeuroShell Trader by using
the NeuroShell Trader's ability to call external Dynamic Linked Libraries.
Dynamic Linked Libraries can be written in C, C++, Power Basic (also Visual
Basic using one of our add-on packages), and Delphi (Figure 1).

FIGURE 1: NEUROSHELL TRADER. Here's the Power Basic source
code for the elastic volume-weighted moving average to create the DDL for
the NeuroShell Trader.
We've recreated the elastic volume-weighted moving average (eVWMA)
for NeuroShell Trader and posted it for Standard Deviation Bands download
at the NeuroShell Trader free technical support website. We also provide
the code at the website so that if you want to make any modifications to
it you will be able to do so.
After downloading the custom indicator, you can easily insert it (Figure
2) or combine it with any of our more than 800 built-in indicators into
a chart, prediction, or trading strategy.

FIGURE 2: NEUROSHELL TRADER. A NeuroShell Trader chart displays
the elastic volume-weighted moving average.
Users of NeuroShell Trader can go to the STOCKS & COMMODITIES section
of the NeuroShell Trader free technical support website to download a copy
of these or past Traders' Tips for NeuroShell Trader.
For more information on NeuroShell Trader, visit www.NeuroShell.com.
--Marge Sherald, Ward Systems Group, Inc.
301 662-7950, sales@wardsystems.com
http://www.neuroshell.com
GO BACK
NeuroShell Trader
In "Which Volatility Measure?" in this issue, Gordon Gustafson compares
standard deviation and true range bands as measures of volatility. To create
each band in NeuroShell Trader (Figure 3), select "New Indicator ..." from
the Insert menu and create each of the following indicators using the Indicator
Wizard:
Standard Deviation Bands:
STDH: Add2(ExpAvg(Close,20), Mult(StndDev(Close,20),2))
STDL: Sub(ExpAvg(Close,20), Mult(StndDev(Close,20),2))
Average True Range Bands:
STDHA: Add2(ExpAvg(Close,20), Mult(AverageTrueRange(Close),20),2))
STDLA: Sub(ExpAvg(Close,20), Mult(AverageTrueRange(Close),20),2))
Note that the true range indicator is included in the NeuroShell Trader
Advanced Indicator Set add-on and is also available for free download from
the Ward Systems Group free technical support website.
To test the standard deviation and average true range indicators in
NeuroShell Trader as Gustafson does in the last half of his article, you
can create the three trading strategies shown below. Since NeuroShell Trader
is not limited to only one trading strategy per chart, you can create and
display all three trading strategies on a single chart. To create a trading
strategy, select "New Trading Strategy ..." from the Insert menu and enter
the entry and exit conditions in the appropriate locations of the Trading
Strategy Wizard:
Standard Deviation Band Trading Strategy:
Generate a buy long MARKET order if ALL of the following are true:
A<B(Close, STDL)
Generate a sell long MARKET CLOSE if ALL the following are true:
BarsSinceActivated(TradingStrategy,5)
Average True Range Trading Strategy:
Generate a buy long MARKET order if ALL of the following are true:
A<B(Close, STDLA )
Generate a sell long MARKET CLOSE if ALL the following are true:
BarsSinceActivated(TradingStrategy,5)
Exclusive Average True Range Trading Strategy:
Generate a buy long MARKET order if ALL of the following are true:
A<B(Close, STDLA)
A>B(Close, STDL)
Generate a sell long MARKET CLOSE if ALL the following are true:
BarsSinceActivated(TradingStrategy,5)
If you own NeuroShell Trader Professional, you can also choose whether
or not the system parameters should be optimized. To set up the trading
strategy to trade a fixed $510,000 of S&P contracts, simply press the
"Modify Trading Strategy Parameters ..." button, choose the "Buy a fixed
dollar amount of contracts" option, set the desired dollar amount to $510,000,
and then set the point value for futures contracts to 250. After backtesting
each trading strategy, use the "Detailed Analysis ..." button to view the
backtest and trade-by-trade statistics for the system.
Users of NeuroShell Trader can go to the STOCKS & COMMODITIES section
of the NeuroShell Trader free technical support website to download a sample
StndDev and Atr bands chart containing the average true range indicator.
For more information on NeuroShell Trader, visit www.NeuroShell.com.
--Marge Sherald, Ward Systems Group, Inc.
301 662-7950, sales@wardsystems.com
http://www.neuroshell.com
GO BACK
AIQ Tradingexpert
In "Which Volatility Measure?" in this issue, Gordon Gustafson compares
standard deviation to average true range as a measure of volatility. Here
is the AIQ TradingExpert Pro code for plotting both kinds of bands.
! Aiq Eds code for Average True Range and Standard Deviation Bands
! These can be plotted on price graph or used as entry/exit criteria for
trades.
Define AvgPd 20.
!StDev Bands
StdDev is Sqrt(Variance([close],AvgPd)).
Stdh is ExpAvg([close],AvgPd) + 2 * StdDev.
Stdl is ExpAvg([close],AvgPd) - 2 * StdDev.
TrueRange is
max([high]-[low],max([high]-val([close],1),val([close],1)-[low])).
AvgTrueRange is SimpleAvg(TrueRange,AvgPd).
!ATR Bands
Stdha is ExpAvg([close],AvgPd) + 2 * AvgTrueRange.
Stdla is ExpAvg([close],AvgPd) - 2 * AvgTrueRange.
--AIQ Technical Support
GO BACK
TradingSolutions
The article "Which Volatility Measure?" by Gordon Gustafson in this issue
presents a comparison of trading bands using the average true range function
and the standard deviation function. These band functions can be entered
into TradingSolutions as follows (Figure 4):
StDev Band High
Short Name: stdh
Inputs: Data, Period, Width
Add (MA (Data, Period), Mult (StDev (Data, Period), Width))
StDev Band Low
Short Name: stdl
Inputs: Data, Period, Width
Sub (MA (Data, Period), Mult (StDev (Data, Period), Width))
ATR Band High
Short Name: stdha
Inputs: Close, High, Low, Period, Width
Add (MA (Close, Period), Mult (ATR (Close, High, Low, Period), Width))
ATR Band Low
Short Name: stdla
Inputs: Close, High, Low, Period, Width
Sub (MA (Close, Period), Mult (ATR (Close, High, Low, Period), Width))
Alternatively, you could use the existing Bollinger Bands functions as
the standard deviation bands.
--Gary Geniesse, TradingSolutions Project Lead
NeuroDimension, Inc., 800 634-3327, 352 377-5144
info@tradingsolutions.com, www.tradingsolutions.com
GO BACK
TradingSolutions
The article in this issue "Elastic Moving Average" by Christian Fries presents
a volume-weighted moving average based on the percentage of the number
of floating shares being traded. The formula for this average in TradingSolutions
would appear as follows:
Moving Average (Elastic Volume Weighted)
Short Name: eVWMA
Inputs: Price, Volume, Floating Shares
If (Prev (1), Div (Add (Mult (Sub (Floating Shares, Volume), Prev
(1)), Mult (Volume, Price)), Floating Shares), Price)
All of these functions are available in a function file that can be downloaded
from our website in the Solution Library section. They can then be imported
into TradingSolutions using "Import Functions..." from the File menu. To
apply one of these imported functions to a stock or group of stocks, select
"Add New Field..." from the context menu for the stock or group, select
"Calculate a value...", then select the desired function from the "Traders
Tips Functions" group.
--Gary Geniesse, TradingSolutions Project Lead
NeuroDimension, Inc., 800 634-3327, 352 377-5144
info@tradingsolutions.com, www.tradingsolutions.com
GO BACK
Investor/RT
The Investor/RT chart in Figure 5 shows the elastic volume-weighted moving
average (eVWMA) drawn in white, overlaying both the candlesticks and volume
bars of a daily chart of Microsoft.

FIGURE 5: Investor/RT. This Investor/RT chart shows the
elastic volume-weighted moving average (eVWMA) drawn in white, overlaying
both the candlesticks and volume bars of a daily chart of Microsoft.
To add this line to a chart in Investor/RT, click on the "Add Technical
Indicator" button in the main toolbar and choose "Elastic Volume Weighted
MA" from the list. The eVwma line in the chart above is created using the
preferences shown in Figure 6.

FIGURE 6: Investor/RT. The eVWMA line in the chart in Figure
6 is created using the preferences shown here.
The second volume period option, "Use average volume," gives the
user the ability to base his volume period on a multiple of the average
volume of the symbol in the chart, thereby making the indicator both symbol-independent
and time frame-independent. If either the time frame or the underlying
symbol in this chart were changed, the eVWMA settings would still apply,
basing the new volume period on the new ticker symbol-timeframe combination.
This aspect is especially useful in scans, where the eVWMA token is "Evw."
--Chad Payne, Linn Software, Inc.
800 546-6842, sales@linnsoft.com
http://www.linnsoft.com
GO BACK
Investor/RT
In "Which Volatility Measure?" in this issue, Gordon Gustafson compares
standard deviation and true range bands as measures of volatility. He considers
the question: Is average true range, which is an approximation, superior
to standard deviation as a measure of volatility?
The Investor/RT chart in Figure 7 shows the average true range bands
drawn in blue, along with the standard deviation bands drawn in red. The
black line in the middle represents the 20-period moving average.

FIGURE 7: Investor/RT. This Investor/RT chart shows the
average true range bands drawn in blue, along with the standard deviation
bands drawn in red. The black line in the middle represents the 20-period
moving average.
The standard deviation bands are applied by adding the moving average
channel indicator to the chart with the preferences specified in Figure
8.

FIGURE 8: Investor/RT. The standard deviation bands are
created on the Investor/RT chart in Figure 7 by adding the moving average
channel indicator to the chart with the preferences specified here.
The average true range bands require creating two Investor/RT custom
indicators and then adding each to the chart. From the menu, choose "Setup:
Custom Indicators." Specify the following syntax for the first custom indicator:
MA + 2 * TR
Then click the Save button. It will then ask you for your moving
average and true range preferences. Both should be set up with a 20-period
simple smoothing. Give the custom indicator the name "TR_HI_BAND." Next,
repeat this process, this time using the syntax:
MA - 2 * TR
Save this custom indicator with the name "TR_LO_BAND." Now, go back to
your chart, click the "Add Technical Indicator" button in the chart toolbar,
and choose the custom indicator "TR_HI_BAND." Choose a color and click
"Apply," then choose "TR_LO_BAND" and click OK. Your two TR bands may be
in a separate window pane. Simply drag them into the same pane as your
price bars. Double-click in the vertical scan and ensure that "Use Multiple
Scales" is unchecked.
--Chad Payne, Linn Software, Inc.
800 546-6842, sales@linnsoft.com
http://www.linnsoft.com
GO BACK
Wealth-Lab.com
You can use the Wealth-Lab.com website and the companion Wealth-Lab Desktop
product to explore volatility bands based on standard deviation and average
true range in more detail. Wealth-Lab offers a powerful scripting language,
WealthScript, that gives you very fine control over trading system rules
as well as cosmetic chart manipulation.
The following script draws both the standard deviation and average true
range bands on the same chart (Figure 9). It also creates a new chart pane
where we display the total number of times prices closed outside of both
types of bands.

FIGURE 9: WEALTH-LAB. This chart shows both the standard
deviation and average true range bands on the same chart. It also creates
a new chart pane showing the total number of times prices closed outside
both types of bands.
{ Construct Std Dev Bands }
StdDevBand := MultiplySeriesValue( StdDev( #Close, 20 ), 2.0 );
StdH := AddSeries( WMA( #Close, 20 ), StdDevBand );
StdL := SubtractSeries( WMA( #Close, 20 ), StdDevBand );
{ Plot Std Dev Bands }
PlotSeries( StdH, 0, #Red, 2 );
PlotSeries( StdL, 0, #Red, 2 );
{ Construct ATR Bands }
AtrBand := MultiplySeriesValue( ATR( 20 ), 2.0 );
AtrH := AddSeries( WMA( #Close, 20 ), AtrBand );
AtrL := SubtractSeries( WMA( #Close, 20 ), AtrBand );
{ Plot ATR Bands }
PlotSeries( AtrH, 0, #Blue, 2 );
PlotSeries( AtrL, 0, #Blue, 2 );
{ Count the number of times prices close outside of each band type }
OutStdDev := 0;
OutAtr := 0;
for Bar := 20 to BarCount - 1 do
begin
if ( PriceClose( Bar ) > GetSeriesValue( Bar, StdH ) ) or
( PriceClose( Bar ) < GetSeriesValue( Bar, StdL ) ) then
Inc( OutStdDev );
if ( PriceClose( Bar ) > GetSeriesValue( Bar, AtrH ) ) or
( PriceClose( Bar ) < GetSeriesValue( Bar, AtrL ) ) then
Inc( OutATR );
end;
{ Create a new Pane to hold our counts }
NewPane := CreatePane( 30, true, false );
{ Output our counts }
DrawText( 'Prices Closed Outside of Std Dev Bands ' +
IntToStr( OutStdDev ) + ' times (' + FormatFloat(
'#,##0.00%', OutStdDev * 100 / BarCount ) + ')',
NewPane, 4, 4, #Red, 10 );
DrawText( 'Prices Closed Outside of ATR Bands ' +
IntToStr( OutAtr ) + ' times (' + FormatFloat(
'#,##0.00%', OutATR * 100 / BarCount ) + ')',
NewPane, 4, 20, #Blue, 10 );
Content-Type: image/bmp;
name="AtrStdDev.bmp"
Content-Disposition: attachment;
filename="AtrStdDev.bmp"
--Dion Kurczek, Wealth-Lab.com
773 883-9047, dionkk@ix.netcom.com
http://www.wealth-lab.com
GO BACK
Wealth-Lab.com
Christian Fries's method of calculating an elastic volume-weighted moving
average requires that you know the number of shares in the float for the
security that you're charting. This information isn't available from many
of the vendors of historical data, but you can get the current float of
any US stock from the Yahoo!Finance website (http://finance.yahoo.com/).
Just enter the stock symbol and click the 'Profile' link. Scroll down to
the 'Share Related Items' to find the stock's current float.
Once you know the float, you can use it to compute Fries's eVWMA indicator.
In the following script, we use the current float for the stock POWI. Replace
this with the float of the stock that you're charting before running the
script.
Flt := 16000000.0; {For Symbol POWI, replace with the Float
for the Stock that you are charting}
evwma := CreateSeries();
prev := PriceClose( 0 );
for Bar := 1 to BarCount - 1 do
begin
x := ( ( Flt - Volume( Bar ) ) *
prev + Volume( Bar ) * PriceClose( Bar ) ) / Flt;
SetSeriesValue( Bar, evwmav, x );
prev := x;
end;
PlotSeries( SMA( evwmav, 20 ), 0, #Green, 2 );
PlotSeries( SMA( #Close, 20 ), 0, #Blue, 2 );
--Dion Kurczek, Wealth-Lab.com
773 883-9047, dionkk@ix.netcom.com
http://www.wealth-lab.com
GO BACK
TechniFilter Plus
Here is the TechniFilter Plus formula for the eVWMA formula discussed by
Christian Fries in his article in this issue, "Elastic Moving Averages."
Formula for the Elastic Volume Weighted Moving Average
NAME: eVWMA
SWITCHES: recursive
PARAMETERS: 565000
INITIAL VALUE: C
FORMULA: ( (&1-V) * T + (V*C) ) / &1
Visit RTR's website to download this formula as well as program
updates.
--Clay Burch, Rtr Software
919 510-0608, rtrsoft@aol.com
http://www.rtrsoftware.com
GO BACK
TechniFilter Plus
Here are TechniFilter Plus formulas for both average true range (ATR) bands
and standard deviation bands discussed by Gordon Gustafson in his article
in this issue, "Which Volatility Measure?" Both formulas were written using
TechniFilter Plus chart directives to plot all three lines.
Formula for ATR Bands
NAME: ATRBands
SWITCHES: multiline
PARAMETERS: 20,2
FORMULA: [1]: ((H%CY1)-(L#CY1))X&1 {ATR}
[2]: CX&1 {c}{Nmiddle} {rgb#255}
[3]: [2]+([1]*&2) {c}{Nupper} {rgb#255}
[4]: [2]-([1]*&2) {c}{Nlower} {rgb#255}
Formula for Standard Deviation Bands
NAME: SDBands
SWITCHES: multiline
PARAMETERS: 20,2
FORMULA: [1]: C|&1 {SD}
[2]: CX&1 {c}{Nmiddle} {rgb#32768}
[3]: [2]+([1]*&2) {c}{Nupper} {rgb#32768}
[4]: [2]-([1]*&2) {c}{Nlower} {rgb#32768}
Visit Rtr's website to download this formula as well as program
updates.
--Clay Burch, Rtr Software
919 510-0608, rtrsoft@aol.com
http://www.rtrsoftware.com
GO BACK
WaveWi$e Market Spreadsheet
The following WaveWi$e formulas demonstrate Gordon Gustafson's comparison
of standard deviation and average true range as described in "Which Volatility
Measure?" in this issue.
Although two standard deviations from the mean (or average) encompasses
95.45% of a normally distributed population, Gustafson's use of an exponential
average as the base yields interesting results.
A: DATE @TC2000(C:\TC2000V3\Data,SP-500,Standard & Poors 500,DB)
B: HIGH
C: LOW
D: CLOSE
E: OPEN
F: VOL
G: Eavg @EAVG1(CLOSE,20)
H: STDH EAVG + 2*@STD(CLOSE,20)
I: STDL EAVG - 2*@STD(CLOSE,20)
J: Trange @TR(HIGH,LOW,CLOSE,1)
K: STDHA EAVG + 2*@MAVG(TRANGE,20)
L: STDLA EAVG - 2*@MAVG(TRANGE,20)
M: '==========End Formulas
--Peter Di Girolamo, Jerome Technology
908 369-7503, jtiware@aol.com
http://members.aol.com/jtiware
GO BACK
WaveWi$e Market Spreadsheet
The following WaveWi$e formulas demonstrate the elastic volume-weighted
moving average (eVWMA) as described by Christian Fries in "Elastic Moving
Averages." Note the formula Float (column H) requires the issue's "shares
floating" as described in the article.
A: DATE @TC2000(C:\TC2000V3\Data,AOL,Aol Time Warner,DB)
B: HIGH
C: LOW
D: CLOSE
E: OPEN
F: VOL
G:
H: Float 'Enter Shares Floating here (Authors value=565000)
I: eVWMA @INIT(1,CLOSE); ((FLOAT-VOL)*EVWMA[-1] + VOL*CLOSE)/FLOAT
J: Mavg @MAVG(CLOSE,20)
K: '==========End Formulas
--Peter Di Girolamo, Jerome Technology
908 369-7503, jtiware@aol.com
http://members.aol.com/jtiware
GO BACK
All rights reserved. © Copyright 2001, Technical
Analysis, Inc.
Return to June 2001 Contents
|