October 2004 Letters To The Editor

or return to October 2004 Contents

The editors of S&C invite readers to submit their opinions and information on subjects relating to technical analysis and this magazine. This column is our means of communication with our readers. Is there something you would like to know more (or less) about? Tell us about it. Without a source of new ideas and subjects coming from our readers, this magazine would not exist.

Address your correspondence to: Editor, STOCKS & COMMODITIES, 4757 California Ave. SW, Seattle, WA 98116-4499, or E-mail to editor@traders.com. All letters become the property of Technical Analysis, Inc. Letter-writers must include their full name and address for verification. Letters may be edited for length or clarity. The opinions expressed in this column do not necessarily represent those of the magazine. -Editor


TRADERS' TIPS

Editor,

I want to calculate a 13-day exponential moving average (EMA) of closing prices and apply a 21-day rate of change to it. I searched your website and found a reference to the Traders' Tips column from the October 1994 issue of S&C (Traders' Tips, Volume 12:10). Does this article give me the formula to do it?
 

Traders' Tips

v 12:10 (441-442)
This month's Traders' Tips all focus on the rate of change (ROC) indicator discussed in Bruce Faber's article. The rate of change is a function already available in both SuperCharts and TradeStation. From within the Quickeditors of either program, you can create a new indicator.

The performance of ROC can often be improved by smoothing. An example is given in CompuTrac Snap. Also, Behold! and MetaStock's System Tester can be used to measure the performance of the ROC indicator.
 

Thanks for your help.
N. Siegel, via email

The October 1994 Traders' Tips article will only supply you with the formula for the rate of change (ROC). It sounds like what you are trying to do is embed one indicator into another. Although the syntax for the formula you want will of course vary depending on what software you are using, the general formula is:
 

Today's (13-day EMA) ? (13-day EMA) 21 days ago
or
Today's (13-day EMA) / (13-day EMA) 21 days ago

By the way, all our Traders' Tips published after 1995 are posted at our website for free public viewing. (See https://www.traders.com/Documentation/FEEDbk_docs/backissues.html.) Previous Traders' Tips columns are available through our Online Store at https://store.traders.com.-Editor


LOOKING FOR RECOMMENDATIONS

Editor,

Which issue of S&C contains articles discussing forex software platforms and/or chart recommendations for beginning to intermediate traders? Are any of the software that gives buy and sell recommendations worth purchasing?

Jerry Elliott, via email

Our September 2004 issue focused on forex and currency trading, with an article by Kenneth Agostino and Brian Dolan on forex trading, an interview with Christopher Neely of the St. Louis Federal Reserve, and our monthly Traders' Resource section offering a listing of forex brokerages.

We do not give purchase recommendations for products, but you can look for our monthly product reviews, or visit our Traders' Resource database at www.Traders.com to search for the particular features you are looking for. In the September 2004 issue, we reviewed FXstreet.com, WallStreetCity.com, and ProSticks charting service.-Editor


PHASE CHANGE INDEX

Editor,

I bought several articles from your Online Store, one of which was "The Phase Change Index" by MH Pee (May 2004). I found all the ready-to-use formulas for indicators (in the Traders' Tips area of your website), but I could not find the formula for the phase change index. Please help me to find it. In the article, only an Excel spreadsheet example is given, but I need the formula for use in MetaStock or TS2000i or eSignal. Thank you.

Oleg But, via email

Unfortunately, since the Excel calculation is the only example that was provided, that's the only one we have available. We don't have the in-house capability to program in the formulas for all the software. I suggest you contact Equis (for MetaStock), TradeStation (for TradeStation 2000), and eSignal for the individual program code you require.-Editor


KAGI DETAILS

Editor,

Kagi in MetaStock seems to be used only as a visual indicator. Is there a formula for kagi that can be used in, say, ExpertAdvisor/Exploration to show when the trend changes from buy to sell and vice versa? It would need to allow a selection of parameters, such as reversal amount, and ideally would choose between percentage or points for calculation method. Hoping that you can assist.

William Bald, via email

We haven't published any formulas on creating kagi charts, but the parameter selections and calculation methods you mention are options available in MetaStock in the charting properties menu.-Editor


ON BOOSTING PROFITABILITY

Editor,

I have been a longtime subscriber to STOCKS & COMMODITIES and I would like some explanation regarding apparent inconsistencies in the article "Boosting Profitability" by Lawrence Chan and Louis Lin in your August 2004 issue.

Whereas the chart (Figure 3 on page 31) shows an impressive equity curve with a fairly steady growth, the data on the performance report (page 32, Figure 4) shows some very contradictory numbers: 1) the number of positions taken (40) seems much smaller than those indicated on the chart by all the arrows. 2) The very substantial 93.14% max DD% in equity is certainly not reflected by the fairly smooth rise in the equity curve shown in Figure 3.

I also tried to replicate the results shown in the article, but did not even come close with my annualized return, although I used the Standard & Poor's 500 instead of the emini.

Is there something else going on here? Your comments would be highly appreciated. Thanks.

Andre Archambault
Research director and
Fair Value strategist
Standard & Poor's
Quantitative Services
via email

Lawrence Chan of TickQuest replies:

1) The total number of positions is 80 - that is, 40 long and 40 short.

2) In the chart in Figure 3, if you look at the period between July 1, 1998, and April 1, 1999, you can see the 93.14% max DD%.

3) Using the S&P 500 contract will show different results than using the eminis because the emini is $50 per point and the S&P 500 is $250 per point. Further, the margin requirements for the two differ significantly. Given that the margin requirements are a percentage of the position taken, the performance results between the two will differ.


ERRATA: JUNE 2004 TRADESTATION CODE FOR VFI

Editor,
[Markos Katsanos writes:] My article on the volume flow indicator in the June 2004 S&C, "Using Money Flow To Stay With The Trend," was the basis for your Traders' Tips column in that issue. That Traders' Tips column included EasyLanguage code for the Vfi technique submitted by staff at TradeStation.  However, a reader and fellow author of S&C, Spyros Raftopoulos, has brought to my attention that there are a number of errors in that June 2004 EasyLanguage code that was provided by TradeStation.

I couldn't check all the errors personally, but I noticed that the default period appears to have been changed arbitrarily from 130 to 5 days. This should be corrected, since it will make the indicator useless, even for daytraders. The rest of the corrections are typos or are for backward compatibility with older versions.

Spyros Raftopoulos suggests the following corrections:

1. Vfi Ipo
a. The published code contains a typo. The correct code should be:

VFI = Cum( Iff( MyTypicalPrice > MyTypicalPrice[1],
MyVolume, Iff( MyTypicalPrice < myTypicalPrice[1],
-MyVolume, 0) ) ) ;

instead of

VFI = Cum( Iff( MyTypicalPrice > MyTypicalPrice,
MyVolume, Iff( MyTypicalPrice < myTypicalPrice[1],
-MyVolume, 0) ) ) ;

since MyTypicalPrice > MyTypicalPrice is always false.

b. Users of older TradeStation versions who confront problems with the following line:

MyVolume = iff( BarType < 2, Ticks, Volume );

should be advised to change it to:

MyVolume = Volume;

The above line doesn't distinguish between intraday bars and longer time frames, but it should work with all versions.

2. Vfi function
a. In the Mfl code provided by Markos Katsanos in his June 2004 article, the Period parameter defaults to 130 and not to 5, as the TradeStation code suggests. I think it would be better if we respected the author's choice. For the same reason, the default smoothing periods should be set to 3 and not to 7.

b. The log function produces errors when it is fed with zero or negative values. Some TradeStation users have already complained about such errors, so I suggest using:

if TP > 0 and TP[1] > 0 then

            Inter = Log(TP) - Log(TP[1])
else Inter = 0;
instead of the original
Inter = Log( MyTypicalPrice ) - Log( MyTypicalPrice[ 1 ] ) ;

c. The use of a multiple-output function for the Vfi seems to produce compatibility problems with earlier versions. Katsanos will not object to a function able to return both Vfi and the smoothed Vfi, although his formula returns the smoothed indicator only. But obtaining both values can also be achieved by a single-output function like the following:

Function: VFI

Inputs:

            Period(numericsimple),
            Coef(numericsimple),
            VCoef(numericsimple),
            SmoothingPeriods(numericsimple);

Vars:
            TP(0), Inter(0), VInter(0), CutOff(0), VAve(0), VMax(0), VC(0), MF(0),
            DirectionalVolume( 0 ), myVFI(0);
TP = TypicalPrice;

if TP > 0 and TP[1] > 0 then
            Inter = Log(TP) - Log(TP[1])
else Inter = 0;
VInter = StdDev( Inter, 30 );
CutOff = Coef * VInter * Close;
VAve = Average(V,Period)[ 1 ];
VMax = VAve * VCoef;
VC = IFF( V < VMax , V, VMax );
MF = TP - TP[1];
DirectionalVolume = IFF( MF > CutOff, +VC, IFF( MF < -CutOff, -VC, 0 ));

if VAve <> 0 then
            myVFI = Summation( DirectionalVolume, Period ) / Vave
else myVFI = 0;

If SmoothingPeriods > 0 then VFI = XAverage(myVFI, SmoothingPeriods)

            else VFI = myVFI;

So, if SmoothingPeriods is a positive number, then the smoothed Vfi is returned, while zero or negative numbers result in Vfi without smoothing.

In this way, any compatibility issues due to the multiple-output function are avoided.
Markos Katsanos and
Spyros Raftopoulos, via email

Mark Mills of TradeStation replies:
We will respond point by point.

1a. The missing square brackets are a typo, which has been corrected in the attached version of the TradeStation code. [Editor's note: Readers will find the corrected code posted in the Traders' Tips area at the Stocks & Commodities website, Traders.com, at https://www.traders.com/Documentation/FEEDbk_docs/Archive/062004/TradersTips/TradersTips.html.]

1b. A more appropriate modification of the volume selection code for TradeStation 2000i would be:

 MyVolume = iff( DataCompression < 2, UpTicks + DownTicks, Volume );

2a. The default values of the parameters 130 and 3 were changed to 5 and 7 for testing purposes. The original defaults have been restored in the attached version of the code. All parameter values, of course, can be edited by the user at the time an analysis technique is applied to a chart.

2b. Adding a validity check prior to calling the log function is a good idea. My revised version of the code includes this enhancement.

2c. As usual, all code we submit for publication in STOCKS & COMMODITIES is developed on the currently shipping TradeStation platform (TradeStation 8, in this instance). Registered users needing help converting the code to run on TradeStation 2000i should contact us via the 2000i EasyLanguage Questions forum.
 The 2000i version of TradeStation can be downloaded from <https://www.tradestationsupport.com/discussions/Forum.aspx?Forum_ID=226>

As a final note, this revised version of the code will replace the code originally posted at the TradeStation websites. Thus, readers can get this code at either our website or the STOCKS & COMMODITIES website.
Function:  VFISmooth

inputs:
 Coef( NumericSimple ),
 VCoef( NumericSimple ),
  Period( NumericSimple ),
 SmoothedPeriod( NumericSimple ),
 MyVolume( NumericRef ),
 CutOff( NumericRef ),
 VC( NumericRef ),
  MF( NumericRef ),
    VFI( NumericRef ) ;

variables:
 MyTypicalPrice( 0 ),
  Inter( 0 ),
    VInter( 0 ),
 VAve( 0 ),
 MyVolAvg( 0 ),
 VMax( 0 ),
 DirectionalVolume( 0 ) ;

MyTypicalPrice = TypicalPrice ;
MyVolAvg = Average( MyVolume, Period ) ;
MF = MyTypicalPrice - MyTypicalPrice[1] ;

if MyTypicalPrice > 0 and MyTypicalPrice[1] > 0 then
 begin
 if MyTypicalPrice > 0 and MyTypicalPrice[1] > 0 then
  Inter = Log( MyTypicalPrice ) -
    Log( MyTypicalPrice[1] )
 else
  Inter = 0 ;
 VInter = StdDev( Inter, 30 ) ;
 CutOff = Coef * VInter * Close ;
 VAve = MyVolAvg[1] ;
 VMax = VAve * VCoef ;
 VC = Iff( MyVolume < VMax , MyVolume, VMax ) ;
 DirectionalVolume = Iff( MF > CutOff, VC, Iff( MF <
  -CutOff, -VC, 0 ) ) ;
 VFI = Summation( DirectionalVolume, Period ) /
  VAve ;
 VFISmooth = XAverage( VFI, SmoothedPeriod ) ;
 end
else
 VFISmooth = 0 ;

Indicator:  VFI

inputs:
 Coef( 0.2 ),
 VCoef( 2.5 ),
  Period( 130 ),
 SmoothedPeriod( 3 ) ;

variables:
 oCutOff( 0 ),
 oVC( 0 ),
 oMF( 0 ),
 oVFI( 0 ),
  MyVFI( 0 ),
 MyVolume( 0 ) ;

MyVolume = Iff( BarType < 2, Ticks, Volume ) ;
MyVFI = VFISmooth( Coef, VCoef, Period, SmoothedPeriod,
 MyVolume, oCutOff, oVC, oMF, oVFI ) ;

if MyVFI > 0 then
 SetPlotColor( 2, Green )
else
 SetPlotColor( 2, Red ) ;

Plot1( oVFI, "VFI" ) ;
Plot2( MyVFI, "SmoothVFI" ) ;
Plot3( 0, "0" ) ;

Indicator:  VFI Volume

inputs:
 Coef( 0.2 ),
 VCoef( 2.5 ),

Indicator:  VFI

inputs:
 Coef( 0.2 ),
 VCoef( 2.5 ),
  Period( 130 ),
 SmoothedPeriod( 3 ) ;

variables:
 oCutOff( 0 ),
 oVC( 0 ),
 oMF( 0 ),
 oVFI( 0 ),
  MyVFI( 0 ),
 MyVolume( 0 ) ;

MyVolume = Iff( BarType < 2, Ticks, Volume ) ;
MyVFI = VFISmooth( Coef, VCoef, Period, SmoothedPeriod,
 MyVolume, oCutOff, oVC, oMF, oVFI ) ;

if MyVFI > 0 then
 SetPlotColor( 2, Green )
else
 SetPlotColor( 2, Red ) ;

Plot1( oVFI, "VFI" ) ;
Plot2( MyVFI, "SmoothVFI" ) ;
Plot3( 0, "0" ) ;

Indicator:  VFI Volume

inputs:
 Coef( 0.2 ),
 VCoef( 2.5 ),
  Period( 130 ),
 SmoothedPeriod( 3 ) ;

variables:
 oCutOff( 0 ),
 oVC( 0 ),
 oMF( 0 ),
 oVFI( 0 ),
  MyVFI( 0 ),
 MyVolume( 0 ) ;

MyVolume = Iff( BarType < 2, Ticks, Volume ) ;
MyVFI = VFISmooth( Coef, VCoef, Period, SmoothedPeriod,
 MyVolume, oCutOff, oVC, oMF, oVFI ) ;

if oMF > oCutOff then
 SetPlotColor( 1, Green )
else if oMF < oCutOff then
 SetPlotColor( 1, Red )
else
 SetPlotColor( 1, DarkGray ) ;

Plot1( oVC, "VFIVol" ) ;
Plot2( MyVolume, "FullVol" ) ;
 

Indicator:  VFI IPO

variables:
 MyTypicalPrice( 0 ),
 MyVolume( 0 ),
  VFIIPO( 0 ) ;

MyTypicalPrice = TypicalPrice ;
MyVolume = Iff( BarType < 2, Ticks, Volume ) ;
VFIIPO = Cum( Iff( MyTypicalPrice > MyTypicalPrice[ 1 ],
 MyVolume, Iff( MyTypicalPrice < MyTypicalPrice[1],
 -MyVolume, 0 ) ) ) ;


Back to October 2004 Contents