January 2000
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:
 
 
TRADESTATION / SUPERCHARTS
EASYLANGUAGE
METASTOCK
NEUROSHELL TRADER
AIQ TRADINGEXPERT
TECHNIFILTER PLUS
WAVEWI$E MARKET SPREADSHEET
SMARTRADER

or return to January 2000 Contents


TRADESTATION/SUPERCHARTS

In the November 1999 STOCKS & COMMODITIES, my article "Coding Candlesticks" presented a quantitative approach to interpreting candlesticks with code provided in MetaStock fomat. After the issue came out, many STOCKS & COMMODITIES readers asked about a version of the code in EasyLanguage for TradeStation and SuperCharts, so Vladivostok trader Valeriy Lazarenko developed the EasyLanguage code for the indicators discussed in the article. Here it is.

Coding CandleSticks (For TradeStation 4.0)
Author: Likhovidov Victor
Programmer: Lazarenko Valeriy (droping@mail.ru)

Functions:

The sizes of candle's body, lower shadow and upper shadow:

Body:
Body=AbsValue(OPEN-CLOSE);

Ushd:
Ushd=Iff(CLOSE=OPEN,HIGH-CLOSE,HIGH-OPEN);

Lshd:
Lshd=Iff(CLOSE=OPEN,OPEN-LOW,CLOSE-LOW);


For each component of the candle, two thresholds (bottom threshold and top threshold) are established through the use of Bollinger bands:
 


ThBot_b:
ThBot_B=BollingerBand(Body,55,-0.5);

ThTop_b:
ThTop_B=BollingerBand(Body,55,0.5);

ThBot_l:
ThBot_L=BollingerBand(Lshd,55,-0.5);

ThTop_l:
ThTop_L=BollingerBand(Lshd,55,0.5);

ThBot_u:
ThBot_U=BollingerBand(Ushd,55,-0.5);

ThTop_u:
ThTop_U=BollingerBand(Ushd,55,0.5);

CandleCode:
vars  :  CandleCode_B(0), CandleCode_L(0), CandleCode_U(0),Candles(0) ;

CandleCode_B=Iff(CLOSE=OPEN,1,0)* Iff(ushd=lshd,64,48) +
Iff(CLOSE=OPEN,0,1) *(Iff(CLOSEOPEN,1,0) * (Iff(Body<=ThBot_b,80,0)
+Iff(bodyThBot_b AND body<=ThTop_b,96,0)+Iff(BodyThTop_B,112,0)) +
Iff(CLOSE<OPEN,1,0) * ( Iff(Body<=ThBot_B ,32,0) + Iff(BodyThBot_B AND
body<=ThTop_b,16,0)));

CandleCode_L=Iff(lshd= 0,3,0)+Iff(lshd<ThBot_l AND
lshd0,2,0)+Iff(lshdThBot_l  AND lshd<=ThTop_l AND lshd0,1,0);

CandleCode_U=Iff(ushd0 AND ushd<=ThBot_U,4,0)+Iff(ushdThBot_u AND
ushd<=ThTop_u ,8,0)+Iff(ushdThTop_u,12,0);

CandleCode=CandleCode_B + CandleCode_L + CandleCode_U;

ICS:
inputs: Length1(NumericSimple),Length2(NumericSimple),
Length3(NumericSimple) ;
ICS=Average(Average(Average(CandleCode,Length1),
Length2),Length3);

Indicators:

Body:
Plot1(Body,"Plot1");

Ushd:
Plot1(Ushd,"Plot1");

Lshd:
Plot1(Lshd,"Plot1");

CandleCode:
Plot1(CandleCode,"Plot1");

ICS:
inputs: Length1(2),Length2(2),Length3(2) ;
Plot1(ICS(Length1,Length2,Length3),"Plot1");


This code may also be found at https://www.forexclub.ru.

-- Viktor N. Likhovidov and Valeriy Lazarenko

Vladivostok@forexclub.ru
Forex Club

GO BACK

EASYLANGUAGE

In Traders' Tips this month, we look at the article in this issue by Joe Sharp, "More Responsive Moving Averages." The article describes a modified moving average that greatly diminishes the lag that is typically associated with moving averages. With the formula described in the article, the moving average line is more responsive to changes in the price action.

An indicator to plot the modified moving average can be easily created for application on a chart. In the EasyLanguage below, the calculation for the modified moving average is created in an EasyLanguage function called ModifiedMA. This function basically takes care of all the necessary calculations for the modified moving average line. By putting the entire calculation into a function, the modified moving average calculation can be easily referenced by any analysis technique. Once the modified moving average (ModifiedMA) function has been created, an analysis technique to plot the function value is also very easy to create.

Below is the EasyLanguage that is used to create both the function and indicator for the modified moving average. The EasyLanguage would be entered in the EasyLanguage PowerEditor as displayed here:


Name: ModifiedMA
Type: Function

Inputs: Price(Numeric), Length(Numeric);
Variables: Factor(0), Slope(0), SMA(0), MMA(0);

Slope = 0;

For value1 = 1 To Length Begin
        Factor = 1 + (2 * (value1 - 1));
        Slope = Slope + (Price[value1 - 1] * ((Length - Factor)/2));
End;

SMA = Average(Price, Length);
MMA = SMA + (6 * Slope) / ((Length + 1) * Length);

ModifiedMA = MMA;

Name: Modified Mov Avg
Type: Indicator

Inputs: Price(Close), Length(2);

Plot1(ModifiedMA(Price, Length), "MMA");
The scaling for the indicator above should be set to "same as symbol."

This EasyLanguage is also available at Omega Research's Website. The name of the file is "MMA.ELS."

-- Gaston Sanchez

Omega Research
https://www.omegaresearch.com
 

GO BACK

METASTOCK

To recreate in MetaStock 6.52 or higher the modified moving average as explained by Joe Sharp in "More Responsive Moving Averages" elsewhere in this issue, select "Indicator Builder" from the Tools menu, click "New" and enter the following code, according to the desired period:

Name: Modified Moving Average
For a two-period average:

N:=2;
TN:=Mov(C,N,S);
s1:=((n-1)/2)*C+((n-3)/2)*Ref(C,-1);

y2:=TN+(6*S1)/((n+1)*n);

y2

For a three-period average:

N:=3;
TN:=Mov(C,N,S);
s1:=((n-1)/2)*C+((n-3)/2)*Ref(C,-1)+((n-5)/2)*Ref(C,-2);

y2:=TN+(6*S1)/((n+1)*n);

y2

For a four-period average:

N:=4;
TN:=Mov(C,N,S);
s1:=((n-1)/2)*C+((n-3)/2)*Ref(C,-1)+((n-5)/2)*Ref(C,-2)+((n-7)/2)*Ref(C,-3);

y2:=TN+(6*S1)/((n+1)*n);

y2

For a 10-period average:

N:=10;
TN:=Mov(C,N,S);
s1:=((n-1)/2)*C+((n-3)/2)*Ref(C,-1)+((n-5)/2)*Ref(C,-2)+((n-7)/2)*Ref(C,-3)
    +((n-9)/2)*Ref(C,-4)+((n-11)/2)*Ref(C,-5)+((n-13)/2)*Ref(C,-6)
    +((n-15)/2)*Ref(C,-7)+((n-17)/2)*Ref(C,-8)+((n-19)/2)*Ref(C,-9);

y2:=TN+(6*S1)/((n+1)*n);

y2
-- Cheryl Elton

Equis International
https://www.equis.com

GO BACK

NEUROSHELL TRADER

To implement the modified moving average discussed in Joe Sharp's article "More Responsive Moving Averages" using NeuroShell Trader, follow the steps given here for each of the lengths of moving averages.

To implement a two-day modified moving average, insert the following indicator using the Indicator Wizard (we reduced the equation to the lowest terms to simplify implementation):
 


Add2(SimpleAvg(Close,2), Divide(Momentum(Close,1),2))


 To implement a three-day modified moving average, insert the following indicator using the Indicator Wizard (we reduced the equation to the lowest terms to simplify implementation):
 


Add2(SimpleAvg(Close,3), Divide(Momentum(Close,2),2))


For modified moving averages longer than three days, the equations become quite complex even when simplified, and it becomes desirable to use the capability of a programming language to build a general purpose modified moving average indicator. NeuroShell Trader supports calling dynamic link libraries (DLLs) as custom indicators. So to simplify things, we have programmed a custom indicator that will allow you to implement any length of modified moving average easily.

Users of NeuroShell Trader can go to the STOCKS & COMMODITIES section of the NeuroShell Trader technical support Website to download a modified moving average indicator. It is general and will allow the number of points to be specified as a parameter.

NeuroShell Trader does have other preprogrammed indicators that eliminate lag. One is the Kaufman adaptive moving average. NeuroShell Trader users can also use adaptive net indicators to build custom adaptive moving averages.

See Figures 1 and 2 for how modified moving averages can be implemented in NeuroShell Trader.


FIGURE 1: NEUROSHELL TRADER. To implement the modified moving average in NeuroShell Trader, insert the modified moving average from the Indicator Wizard.

FIGURE 2: NEUROSHELL TRADER. Here's a chart demonstrating the modified moving average as implemented in NeuroShell Trader.

-- Marge Sherald

Ward Systems Group
301 662-7950, E-mail wardsystems@msn.com
https://www.neuroshell.com

GO BACK

AIQ TRADINGEXPERT

The following code for the Expert Design Studio (EDS) module of AIQ TradingExpert software implements the modified moving average described in Joe Sharp's article in this issue, "More Responsive Moving Averages."
 

!Modified Moving Average
!
!MA2
Define N2 2.
MA2 is SimpleAvg([close],N2).
S2 is (((N2 - 1)/2) * [close]) + (((N2 - 3)/2) * Val([close],1)).
ModMA2 is MA2 + ((6*S2)/((N2 + 1) * N2)).
!
!MA3
Define N3 3.
MA3 is SimpleAvg([close],N3).
S3 is (((N3 - 1)/2) * [close]) + (((N3 - 3)/2) * Val([close],1)) +  (((N3 -
5)/2) * Val([close],2)).
ModMA3 is MA3 + ((6*S3)/((N3 + 1) * N3)).
!
!MA4
Define N4 4.
MA4 is SimpleAvg([close],N4).
S4 is (((N4 - 1)/2) * [close]) + (((N4 - 3)/2) * Val([close],1)) +  (((N4 -
5)/2) * Val([close],2)) +    (((N4 - 7)/2) * Val([close],3)).
ModMA4 is MA4 + ((6*S4)/((N4 + 1) * N4)).
!
!Include symbols for report
pass if 1=1.
This code for AIQ's Expert Design Studio can also be downloaded as an .EDS file from STOCKS & COMMODITIES' Website at www.traders.com.
-- Dale Paul

AIQ Systems
aiqonline@aol.com

GO BACK

TECHNIFILTER PLUS

Here are TechniFilter Plus formulas for implementing the technique discussed by Joe Sharp in "More Responsive Moving Averages."

The Y2_10 formula uses N=10 for a 10-day sum. The Y2_8 formula uses N=8 for an eight-day sum. These two formulas serve as examples; other time frames can be similarly formulated. The "Y2_10" formula given here is the 10-day version and "Y2_8" is the eight-day version.


NAME: Y2_10
FORMULA: CA10 +(9*C + 7*CY1 + 5*CY2 + 3*CY3 + CY4 ? CY5
        - 3*CY6 - 5*CY7 - 7*CY8 - 9*CY9) / (11*10)

NAME: Y2_8
FORMULA: CA8 +(7*C + 5*CY1 + 3*CY2 + CY3 ? CY4
        - 3*CY5 - 5*CY5 - 7*CY7) / (9*8)
These formulas and program updates can be downloaded from RTR's Website. Release 8.3 of TechniFilter Plus is now available.
 
-- Clay Burch

RTR Software
919 510-0608, E-mail: rtrsoft@aol.com
https://www.rtrsoftware.com

GO BACK

WAVEWI$E MARKET SPREADSHEET

The following WaveWi$e formulas show how to quickly compute the modified four-period moving average as discussed  by Joe Sharp in "More Responsive Moving Averages."
 

A: DATE @TC2000(C:\TC2000\DATA,SP-500,STANDARD & POORS 500,DB)
B: HIGH
C: LOW 
D: CLOSE
E: OPEN
F: VOL
G: Per  4
H: Avg4 @MAVG(CLOSE,PER)
I: Snum ((PER-1)/2)*CLOSE+((PER-3)/2)*CLOSE[-1]+((PER-5)/2)*CLOSE[-2]+
        ((PER-7)/2)*CLOSE[-3]
J: ma4  AVG4+(6*SNUM)/((PER+1)*PER)
K: error        CLOSE-MA4
L:
  ==========End Formulas
-- Peter Di Girolamo

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

GO BACK

SMARTTRADER

The modified moving average introduced by Joe Sharp in "More Responsive Moving Averages" can be implemented in SmarTrader using just three rows (Figure 3). First, a user formula is created to compute S, the weighted sum. Next, apply the Sum function to sum two days of closing (Close) prices. Finally, a user formula computes the modified moving average.

FIGURE 3: SMARTRADER. Here's how to implement the modified moving average in SmarTrader.
-- Jim Ritter

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

GO BACK

All rights reserved. © Copyright 1999, Technical Analysis, Inc.

Return to January 2000 Contents