Letters To The Editor

August 2009 Letters To The Editor

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

GOLDEN RATIO

Editor,
In his article in the April 2009 S&C on the Fibonacci sequence and its “golden ratio” (“Fibonacci Tools”), Alexander Sabodin points out that the golden ratio is actually an irrational number so must be approximated. Your readers may be interested to know that its exact value can be written as (1+√5)/2. This allows one to find the ratio to any accuracy using a suitable algorithm for square root.
—Rick Martinelli

I would consider as correct both this expression and the one in Alexander Sabodin’s article. The value of (1+√5)/2 is 1.61803398875…, which, as Sabodin stated in his article, is an irrational number that is approximated as 1.618.

Note: Rick Martinelli has contributed several articles to Stocks & Commodities over the years, including “Pattern Recognition In Time Series” (January 1998), “Harnessing The (Mis)Behavior Of Markets” (June 2006), “Trading Within The Cup” (September 2001), and “Cup-with-Handle And The Computerized Approach” (October 1998). Locate electronic copies of these and other articles by using the search engine at our Online Store at our website, Traders.com.
—Editor

REFERENCE BOOK ON MOVING AVERAGES?

Editor,
I want to know whether there is a book that is solely dedicated to moving averages or that covers this area intensely. I am interested in triple averages trading (10,50,200) and wanted a reference that discusses this topic in more detail. I am educated in candlestick patterns, but I wanted to study moving averages as a individual subject matter.
—Yagnesh
London, UK

There is the classic 1934 book by Robert Rhea, The Story Of The Averages (Rhea, Greiner & Co.), and a few to mention from our books listing in the Traders’ Resource database at our website: Moving Averages Simplified (Traders’ Library), John Murphy On Chart Analysis (Marketplace Books/StockCharts.com, Inc.), and The Magic Of Moving Averages (Traders Press Inc.), as well as Technical Analysis In Commodities (John Wiley & Sons). Of course, there are books with chapters on moving averages, such as The Encyclopedia Of Trading Strategies (McGraw-Hill).
—Editor

FOREX TRADING AND READERS’ CHOICE AWARDS

Editor,
I have been a subscriber off and on for years and have used your magazine to help me trade stocks and options and done pretty well. I particularly enjoy and use the Readers’ Choice Awards feature in your annual Bonus Issue.

I am moving into trading forex and would like to suggest you add a new category to the Readers’ Choice Awards — forex trading systems. That would be a helpful category, and since there are many automated forex systems, you could separate the systems into two categories: automated and manual.

Thanks for an excellent publication.
—Jorj Baker

Thank you for writing. We will consider your request for the Readers’ Choice category.
—Editor

FIXED PERCENTAGE STOP METASTOCK CODE

Editor,
Thank you for Sylvain Vervoort’s May 2009 S&C, “Using Initial And Trailing Stops,” which was a worthwhile trading application. However, the MetaStock code would not execute for me. Please advise — were there any code errors? Can he provide The AdvancedStop.StopLong and AdvancedStop.StopShort code?
—Al
Hudson, OH

Sylvain Vervoort replies:
The formula should work fine. It is shown here. Please remember that you need to input an existing date out of your dataset. Otherwise, nothing will be displayed.

{SVE_Stop_Trail%_Date: Fixed percentage trailing stop from date}
InpMonth:=Input(�Month�,1,12,1);
InpDay:=Input(�Day�,1,31,1);
InpYear:=Input(�Year�,1800,2050,2009);
LongShort:=Input(�1=Long or 2=Short? �,1,2,1);
InitStop:=Input(�Initial Stop Price�,0.1,10000,10);
Perc:=Input(�Trailing Stop Percentage�,1,30,12);
Loss:=C*Perc/100;
Entry:= InpYear=Year() AND InpMonth=Month() AND
InpDay=DayOfMonth();
StopLong:=ExtFml(�AdvancedStop.StopLong�, Entry,InitStop,0,C-Loss,0,0,0,0);
StopShort:=ExtFml(�AdvancedStop.StopShort�,Entry,
Initstop,0,C+Loss,0,0,0,0);
Trail:=If(LongShort=1,Stoplong,Stopshort);
Trail

To fix the entry point, the initial stop, and the trailing stop, and to track the price movement, I use the “Advanced trailing stop” external function, a free MetaStock extension from Trader Nexus created by Richard Dale (https://www.tradernexus.com/advancedstop/advancedstop.html).

Make sure it is called “AdvancedStop.dll” and put the “AdvancedStop.dll” file in the “External Function Dlls” folder below the “\MetaStock” directory.

HEIKIN-ASHI COUNTER

Editor,
I have enjoyed Sylvain Vervoort’s articles in S&C over the years.

In his December 2008 S&C article (“Trading With The Heikin-Ashi Candlestick Oscillator”), he tests a version of the heikin-ashi counter (formula follows). However, I tried it on US stocks and was not as successful as he was on European stocks. Since I suspect I made a mistake with the formulas, could he clarify the buy and sell formulas?

period:=5;
haclose:=(O+H+L+C)/4;
haopen:=(PREV+(Ref(haclose,-1))/2);
hahigh:=Max(Max(H,haOpen),haclose);
halow:=Min(Min(L,haopen),haclose);
counter:=If(hahigh>Ref(hahigh,-1) AND halow>Ref(halow,-1),1,If(hahigh<Ref(hahigh,-1) AND halow<Ref(halow,-1),-1,0));
indic:=Sum(counter,period)/period*100;
  Buy:=indic >-20;
  Sell:=indic <-20;

—Ron
Los Angeles, CA

Sylvain Vervoort replies:
The original formula for the heikin-ashi counter was from someone who wrote in to this magazine [see the letter titled “Heikin-Ashi-Based Oscillator” in the February 2009 Letters to S&C column] who wrote as a reaction to the use of heikin-ashi recalculated prices. I simply made a system test for his formula.

However, I did devise another formula based on the same idea that gave me much better results. You can find that MetaStock code and explanation in the May 2009 Letters to S&C column under the letter titled “Heikin Ashi-Based Oscillator,” where I answered another reader’s question.

HEIKIN-ASHI CANDLESTICK OSCILLATOR

Editor,
Thank you for the article in the December 2009 S&C by Sylvain Vervoort, “Trading With The Heikin-Ashi Candlestick Oscillator.” It was very interesting to read. Could he provide MetaStock code for the oscillator and system or explorer?

In addition, could he give me a helping hand on how to build a system? I am not very involved in coding.
—Martin

Sylvain Vervoort replies:
This is the latest Haco oscillator with a small modification compared to the original one:

{HACO_Mod Oscillator}
avg:=Input(�Up average: �,1,100,34);
avgdn:=Input(�Down Average: �,1,100,34);
haOpen:=(Ref((O+H+L+C)/4,-1) + PREV)/2;
haC:=((O+H+L+C)/4+haOpen+Max(H,haOpen)+Min(L,haOpen))/4;
TMA1:= Tema(haC,avg);
TMA2:= Tema(TMA1,avg);
Diff:= TMA1 - TMA2;
ZlHa:= TMA1 + Diff;
TMA1:= Tema((H+L)/2,avg);
TMA2:= Tema(TMA1,avg);
Diff:= TMA1 - TMA2;
ZlCl:= TMA1 + Diff;
ZlDif:=ZlCl-ZlHa;
keep1:=Alert(haC>=haOpen,2) OR If(C>=haC,1,
If(H>Ref(H,-1) OR L>Ref(L,-1),1,0));
keep2:=ZlDif>=0;
keeping:=(keep1 OR keep2);
keepall:=keeping OR (Ref(keeping,-1) AND (C>=O) OR C>=Ref(C,-1));
keep3:=(Abs(C-O)<(H-L)*.35 AND  H>=Ref(L,-1));
utr:=Keepall OR (Ref(keepall,-1) AND keep3);
TMA1:= Tema(haC,avgdn);
TMA2:= Tema(TMA1,avgdn);
Diff:= TMA1 - TMA2;
ZlHa:= TMA1 + Diff;
TMA1:= Tema((H+L)/2,avgdn);
TMA2:= Tema(TMA1,avgdn);
Diff:= TMA1 - TMA2;
ZlCl:= TMA1 + Diff;
ZlDif:=ZlCl-ZlHa;
keep1:=3
DAlert(haC<haOpen,2);
keep2:=ZlDif<0;
keep3:=Abs(C-O)<(H-L)*.35 AND L<=Ref(H,-1);
keeping:=keep1 OR keep2;
keepall:=keeping OR (Ref(keeping,-1) AND (C<O) OR C<Ref(C,-1));
dtr:=If(Keepall OR (Ref(keepall,-1) AND keep3)=1,1,0);
upw:=dtr=0 AND Ref(dtr,-1) AND utr;
dnw:=utr=0 AND Ref(utr,-1) AND dtr;
result:=If(upw,1,If(dnw,0,PREV));
result

As for system building: Are you trying to perform a system test, an exploration, or an expert function? I would not advise using this as an expert to automatically buy or sell; it would not be profitable enough. You can use it to enter short-term trades, but you need to avoid some buying or selling to make it profitable.

To find entries and exits on stocks, you can use the following exploration:

In Column A (name it BUY):

avg:=34;
avgdn:=34;
haOpen:=(Ref((O+H+L+C)/4,-1) + PREV)/2;
haC:=((O+H+L+C)/4+haOpen+Max(H,haOpen)+Min(L,haOpen))/4;
TMA1:= Tema(haC,avg);
TMA2:= Tema(TMA1,avg);
Diff:= TMA1 - TMA2;
ZlHa:= TMA1 + Diff;
TMA1:= Tema((H+L)/2,avg);
TMA2:= Tema(TMA1,avg);
Diff:= TMA1 - TMA2;
ZlCl:= TMA1 + Diff;
ZlDif:=ZlCl-ZlHa;
keep1:=Alert(haC>=haOpen,2) OR If(C>=haC,1
,
If(H>Ref(H,-1) OR L>Ref(L,-1),1,0));
keep2:=ZlDif>=0;
keeping:=(keep1 OR keep2);
keepall:=keeping OR (Ref(keeping,-1) AND (C>=O) OR C>=Ref(C,-1));
keep3:=(Abs(C-O)<(H-L)*.35 AND  H>=Ref(L,-1));
utr:=Keepall OR (Ref(keepall,-1) AND keep3);
TMA1:= Tema(haC,avgdn);
TMA2:= Tema(TMA1,avgdn);
Diff:= TMA1 - TMA2;
ZlHa:= TMA1 + Diff;
TMA1:= Tema((H+L)/2,avgdn);
TMA2:= Tema(TMA1,avgdn);
Diff:= TMA1 - TMA2;
ZlCl:= TMA1 + Diff;
ZlDif:=ZlCl-ZlHa;
keep1:=Alert(haC<haOpen,2);
keep2:=ZlDif<0;
keep3:=Abs(C-O)<(H-L)*.35 AND L<=Ref(H,-1);
keeping:=keep1 OR keep2;
keepall:=keeping OR (Ref(keeping,-1) AND (C<O) OR C<Ref(C,-1));
dtr:=If(Keepall OR (Ref(keepall,-1) AND keep3)=1,1,0);
upw:=dtr=0 AND Ref(dtr,-1) AND utr;
dnw:=utr=0 AND Ref(utr,-1) AND dtr;
result:=If(upw,1,If(dnw,0,PREV));
result AND Ref(result,-1)=0

In Column B (name it SELL):

avg:=34;
avgdn:=34;
haOpen:=(Ref((O+H+L+C)/4,-1) + PREV)/2;
haC:=((O+H+L+C)/4+haOpen+Max(H,haOpen)+Min(L,haOpen))/4;
TMA1:= Tema(haC,avg);
TMA2:= Tema(TMA1,avg);
Diff:= TMA1 - TMA2;
ZlHa:= TMA1 + Diff;
TMA1:= Tema((H+L)/2,avg);
TMA2:= Tema(TMA1,avg);
Diff:= TMA1 - TMA2;
ZlCl:= TMA1 + Diff;
ZlDif:=ZlCl-ZlHa;
keep1:=Alert(haC>=haOpen,2) OR If(C>=haC,1,
If(H>Ref(H,-1) OR L>Ref(L,-1),1,0));
keep2:=ZlDif>=0;
keeping:=(keep1 OR keep2);
keepall:=keeping OR (Ref(keeping,-1) AND (C>=O) OR C>=Ref(C,-1));
keep3:=(Abs(C-O)<(H-L)*.35 AND  H>=Ref(L,-1));
utr:=Keepall OR (Ref(keepall,-1) AND keep3);
TMA1:= Tema(haC,avgdn);
TMA2:= Tema(TMA1,avgdn);

Diff:= TMA1 - TMA2;
ZlHa:= TMA1 + Diff;
TMA1:= Tema((H+L)/2,avgdn);
TMA2:= Tema(TMA1,avgdn);
Diff:= TMA1 - TMA2;
ZlCl:= TMA1 + Diff;
ZlDif:=ZlCl-ZlHa;
keep1:=Alert(haC<haOpen,2);
keep2:=ZlDif<0;
keep3:=Abs(C-O)<(H-L)*.35 AND L<=Ref(H,-1);
keeping:=keep1 OR keep2;
keepall:=keeping OR (Ref(keeping,-1) AND (C<O) OR C<Ref(C,-1));
dtr:=If(Keepall OR (Ref(keepall,-1) AND keep3)=1,1,0);
upw:=dtr=0 AND Ref(dtr,-1) AND utr;
dnw:=utr=0 AND Ref(utr,-1) AND dtr;
result:=If(upw,1,If(dnw,0,PREV));
result=0 AND Ref(result,-1)=1

In the �Filter� column:

colA OR colB

This will give you buy and sell signals on stocks based on Haco (heikin-ashi candlestick oscillator).

Return to Contents