October 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:

METASTOCK
SUPERCHARTS
TECHNIFILTER PLUS
SMARTRADER
WAVE WI$E MARKET SPREADSHEET

or return to October Contents

METASTOCK

"On using volatility bands" by Ahmet Tezel and Suzan Koknar-Tezel introduces two different volatility band trading systems, one system using bands based on moving averages and the other based on regression bands. To plot the moving average asymmetric volatility price bands (MAAVPB) 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 (REGAVPB) in MetaStock for Windows, simply plot standard error bands using 21 periods, one for standard errors and one 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 that will allow you to change the periods when testing much more easily.

Formulas for MetaStock 6.5:



MAAVPB 
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 100s 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


REGAVPB 
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
CLOSE < LowerBand;
SellSignal1 OR SellSignal2


STOPS


Maximum Loss: LONG ONLY 10.00 Percent
Formulas for MetaStock for Windows 6.0 and earlier:


MAAVPB 
SIGNAL FORMULAS


Enter Long:


Sum(CLOSE > BBandTop(CLOSE,11,S,1.7),3) = 3 OR
(CLOSE > BBandTop(CLOSE,11,S,1.7) AND
Ref(LOW,-1) > Ref(BBandTop(CLOSE,11,S,1.7),-1)) OR
(LOW > BBandTop(CLOSE,11,S,1.7) AND
Ref(CLOSE,-1) > Ref(BBandTop(CLOSE,11,S,1.7),-1)) OR
(CLOSE > BBandTop(CLOSE,11,S,1.7) AND
CLOSE > 1.4 * LLV(LOW,12) AND Mov(VOLUME,3,S) > 2000
     {assuming volume in 100s otherwise use 200000} AND
Mov(HIGH,3,S) > BBandTop(CLOSE,11,S,1.7) AND
Mov(HIGH - LOW,3,S) > Ref(Mov(HIGH - LOW,11,S),-3))


Close Long:


Sum(CLOSE < BBandBot(CLOSE,11,S,2),3) = 3 OR
(CLOSE < (1-.18) * HHV(HIGH,12) AND
Sum(CLOSE < BBandBot(CLOSE,11,S,2),2) = 2) OR
(CLOSE < (1-.18) * HHV(HIGH,12) AND
HIGH < BBandBot(CLOSE,11,S,2))


STOPS: Maximum Loss: LONG ONLY 10.00 Percent
REGAVPB
SIGNAL FORMULAS


Enter Long:


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


Close Long:


Sum(CLOSE < STEBandBot(CLOSE,21,1.5),3) = 3 OR
(CLOSE < (1-.18) * HHV(HIGH,22) AND
CLOSE < STEBandBot(CLOSE,21,1.5))


STOPS


Maximum Loss: LONG ONLY 10.00 Percent
--Allan J. McNichol, Equis International
800 882-3040, 801 265-8886
Internet: https://www.equis.com
GO BACK

SUPERCHARTS

The following formulas are derived from the article "On using volatility bands" by Ahmet Tezel and Suzan Koknar-Tezel. Note that our user-defined variables are in lowercase; SuperCharts-defined functions and variables are in uppercase.


MAAVPB 
Variables:


upperval 1.7 
lowerval 2.0 
malen 11 
maxup 1.4 
losspos -0.1 
exitpct 0.82 
forced 960805


Buy Conditions:


(C[5]>AVERAGE(C,malen)[5]+upperval*STDDEV(C,malen)[5] AND
C[6]>AVERAGE(C,malen)[6]+upperval*STDDEV(C,malen)[6] AND
C[7]>AVERAGE(C,malen)[7]+upperval*STDDEV(C,malen)[6]) OR
(C[5]>AVERAGE(C,malen)[5]+upperval*STDDEV(C,malen)[5] AND
L[6]>(AVERAGE(C,malen)[6]+upperval*STDDEV(C,malen)[6]) OR
(L[5]>AVERAGE(C,malen)[5]+upperval*STDDEV(C,malen)[5] AND
C[6]>(AVERAGE(C,malen)[6]+upperval*STDDEV(C,malen)[6]) OR
(C[5]>AVERAGE(C,malen)[5]+upperval*STDDEV(C,malen)[5] AND
C[5]>LOWEST(C,malen)[5]*maxup) OR
(AVERAGE(V,3)[5]>200000 AND
AVERAGE(H,3)[5]>AVERAGE(C,malen)[5]+upperval*STDDEV(C, malen)[5] AND
AVERAGE(RANGE,3)[5]>AVERAGE(RANGE,11)[5])


Sell Conditions:


(C[5]<AVERAGE(C,malen)[5]-lowerval*STDDEV(C,malen)[5] AND
C[6]<AVERAGE(C,malen)[6]-lowerval*STDDEV(C,malen)[6] AND
C[7]<AVERAGE(C,malen)[7]-lowerval*STDDEV(C,malen)[7]) OR
(C[5]<AVERAGE(C,malen)[5]-lowerval*STDDEV(C,malen)[5] AND
C[6]<AVERAGE(C,malen)[6]-lowerval*STDDEV(C,malen)[6] AND
C[5]<HIGHEST(C,malen)[5]*exitpct) OR
(H[5]<AVERAGE(C,malen)[5]-lowerval*STDDEV(C,malen)[5] AND
C[5]<HIGHEST(C,malen)[5]*exitpct) OR
(H[5]<AVERAGE(C,malen)[5]-lowerval*STDDEV(C,malen)[5] AND
POSITIONPROFIT<losspos*ENTRYPRICE*100) OR
(DATE=forced) (The day all open positions are closed)
To bail out at a 40% loss, you may include an additional sell condition:


(C[5]<0.6*ENTRYPRICE)


REGAVPB 
Variables:


upperval 1.0
lowerval 1.5
vartime 38.5 (Set equal to the variance of the number of days, 1 to 21)
reglen 21
rdif 0.2
correlat 0
forced 960805


User-Defined Functions:


corrcoef:
IF STDDEV(C,reglen) <> 0 THEN corrcoef =
(LINEARREGSLOPE(C,reglen)*SQUAREROOT(vartime)) /
(STDDEV(C,reglen)*SQUAREROOT(reglen/(reglen-1))
ELSE corrcoef = 0
regbandup:
regbandup=LINEARREGVALUE(C,reglen,0)+
upperval*sigmae(reglen,vartime)
regbandup1:
regbandup1 = LINEARREGVALUE(C,reglen,1)+upperval*sigmae(reglen,vartime)
regbandup2:
regbandup2 = LINEARREGVALUE(C,reglen,2)+upperval*sigmae(reglen,vartime)
regbanddown:
regbanddown = LINEARREGVALUE(C,reglen,0)-lowerval*sigmae(reglen,vartime)
regbanddown1:
regbanddown1 = LINEARREGVALUE(C,reglen,1)-lowerval*sigmae(reglen,vartime)
regbanddown2:
regbanddown2 = LINEARREGVALUE(C,reglen,2)-lowerval*sigmae(reglen,vartime)
sigmae:
sigmae = SQUAREROOT(ABSVALUE(SQUARE(STDDEV(C,reglen))*
(reglen/(reglen-1))
- SQUARE(LINEARREGSLOPE(C,reglen))*vartime))


Buy Condition:


corrcoef(reglen,vartime)>(-correlat) AND
corrcoef(reglen,vartime)-corrcoef(len,vartime)[2]>rdif AND
C>regbandup(reglen,upperval,vartime) AND
C[1]>regbandup1(reglen,upperval,vartime) AND
C[2]>regbandup2(reglen,upperval,vartime)


Sell Conditions:


(C<regbanddown(reglen,lowerval,vartime) AND
C[1]<regbanddown1(reglen,lowerval,vartime) AND
C[2]<regbanddown2(reglen,lowerval,vartime)) OR
(H<regbanddown(reglen,lowerval,vartime) AND
C<HIGHEST(C,reglen)*(0.82)) OR
(H<regbanddown(reglen,lowerval,vartime) AND
POSITIONPROFIT<(-0.1)*ENTRYPRICE*100) OR
(DATE=forced) (The day all open positions are closed)
To bail out at a 40% loss, you may include an additional sell condition:


(C<0.6*ENTRYPRICE)
--Ahmet Tezel, Ph.D., and Suzan Koknar-Tezel, M.S.
GO BACK

SMARTRADER

Implementation of the volatility band system by Ahmet Tezel and Suzan Koknar-Tezel in SmarTrader has been limited to the first three buy and sell scenarios for brevity.

Rows 9 and 10 in Figure 1 develop the 11-day moving average (Mov_avg) and standard deviation (Std_dv) as the basis on which to develop the volatility bands. Rows 11 and 12 are user rows to calculate the upper and lower bands at Mov_avg plus 1.7*Std_dv and Mov_avg minus 2.0*Std_dv. Rows 13 - 15 define the first three buy scenarios. The use of [-1] and [-2] to indicate backward references of 1 and 2 days, respectively. Row 16 tracks the highest close in 11 days. Row 17 tests for a close of 18% less than the highest close in the previous 11 days. Rows 18 - 20 define the first three sell (exit) scenarios. Row 21 is the buy rule and states buy if Buy1 or Buy2 or Buy3 is true. Row 22 is the sell rule and also uses the "or" to exit if Sell1, Sell2, or Sell3 is true. Row 23 is the trade row where the entry/exit rules are examined by SmarTrader. The short side of trade is blocked by entering zeroes for the entry/exit rules. Rows 24 through 27 are the accounting rows for the actual trades and the results they produce.

FIGURE 1: FORMULAS. Here's the SpecSheet file for SmarTrader.

This system can be implemented using CompuTrac SNAP by eliminating the minus sign from within the square brackets.

The SpecSheet file is also available for download from Stratagem Software's Web site.

--Jim Ritter, Stratagem Software International
504 885-7353, E-mail: Stratagem1@aol.com
Internet: https://stratagem1.com
GO BACK

TECHNIFILTER PLUS

Ahmet Tezel and Suzan Koknar-Tezel explain two trading strategies that use volatility bands to define the trading signals in "On using volatility bands." The first strategy (MAAVPB) uses standard deviation bands around an average, while the second strategy (REGAVPB) depends on standard error bands around a regression line.

The first formula table gives a TechniFilter Plus 8.0 strategy for MAAVPB. Formulas 5 and 6 gives the top and bottom bands, respectively. Formula 7 returns the value 1 if any of the four buy signals are true, and a zero otherwise. Formula 8 returns the value 1 if any of the first three sell signals are true. The fourth signal is incorporated in the sell rule itself. Tezel and Koknar-Tezel suggest waiting five days before taking a position based on these signals. You can offset the Maavpb signals by adding a Y5 modifier to the terms in formulas 7 and 8.

The second table lists the REGAVPB strategy. Formula 5 gives the 21-day standard error calculation, which is based on the sum of the squares of the difference between the close prices and the least-squares fit line value. Formulas 6 and 7 give the top and bottom bands, respectively. Formula 8 gives the variation due to the regression based on the sum of the squares of the difference between the least-squares fit line value and the average close price. Formula 9 computes the coefficient of correlation, using formulas 8 and 5. Formula 10 returns the value 1 if the buy signal is true, and a zero otherwise. Formula 11 returns the value 1 if either of the first two sell signals are true. The third signal is incorporated in the signal in rule 2.



MAAVPB Strategy
FORMULAS
[1]     Date
[2]     High
        H
[3]     Low
        L
[4]     Close
        C
[5]     TopBand
        CA11 + 1.7 * C|11
[6]     BottomBand
        CA11 - 2 * C|11
[7]     BuySignal
        (C>[5])F3 = 3 ^ ( (C>[5]) & (LY1>[5]Y1) ) ^ 
        ( (L>[5]) & (CY1>[5]Y1) ) ^ ( (C>[5]) & (C/LY1N11>1.4) ) 
        ^ ( (VA3>200000) & (HA3>[5]) )
[8]     SellSignal
        (C<[6])F3=3 ^ ( (C/HY1M11<.82) & (C<[6])F2=2 )
        ^ ( (C/HY1M11<.82) & (H<[6]) )

RULES
        r1:     BUY
                buy long 1 on Next Open
                at signal: Buy   [7] = 1
        r2:     SELL
                sell long 1 on Next Open
                at signal: Sell  ([8]=1) ^ (( [4]<.9*EntryPrice) & ([2]<[6]) )
REGAVPB Strategy 
FORMULAS
[1]     Date
[2]     High
        H
[3]     Low
        L
[4]     Close
        C
[5]     StdErr
        ( ((CR21*T)*21  + (C*C)F21   + (CD21*T)*2870 -
        CF21*CR21*2 - CD21*CR21*420 + 
        2*CD21*(CF21*CU13-(CU13*C)F21))/19 )_.5
[6]     TopBand
        CR21 + [5]
[7]     BottomBand
        CR21 - 1.5 * [5]
[8]     VarDueReg
        (CR21*T)*21  + (CA21*T)*21   + (CD21*T)*2870 -
        CA21*CR21*42 - CD21*CR21*420 + CA21*CD21*420
[9]     CorrelationCoef
        ( [8]/([8]+[5]) )_.5
[10]    BuyLong
        ((C>[6])F3=3) & (CD21>=0) & (([9]-TY1)>.2) 
[11]    SellLong
        ( (C<[7])F3=3 ) ^ ( ((C/HY1M21)<.82) & (H<[7]) )
RULES
        r1: BUY
                buy long 1 on Next Open
                at signal: BuyLong   [10] = 1
        r2: SELL
                sell long 1 on Next Open
                at signal: SellLong  ([11]=1) ^ (([4]/EntryPrice <.9) &  
                ([2]<[7]))

WAVE WI$E MARKET SPREADSHEET

Here are the formulas for implementing the systems found in "On using volatility bands." The MAAVPB system is calculated in columns A through V. The REGAVPB system is calculated in columns Y through AH. The formula in column AE changed the author's 0.20 correlation constant to 0.15 so we could review more trading signals.


--Peter Di Girolamo, Jerome Technology
908 369-7503, E-mail: jtiware@aol.com
Internet: https://members.aol.com/jtiware

GO BACK


Return to October Contents