Dahl Oscillator
Dahl Variations
Dave's New System (DNS)
Days Since Crossover
Denvelope
Denvelope (RSI)
DEVSTOP
Displace Indicator Forward
Divergence Between Close and Indicator

Daily Close vs. High and Low Close
Detrended Price Oscillator
Disparity Index

Derivative Moving Average
Double Inside Day
Double Tops and Double Bottoms
Down 20% on Double Average Volume
DMTF Trading System
Dunnigan Trend
Dunn-Type 1
Dunn-Type 2
Dynamic Multiple Time Frame Indicator
Dynamic Zones

Displaying the Price of a Security in 32nds and 64ths
Divergence Between the Close and an Indicator
Dynamic Momentum Oscillator

 

Dahl Oscillator

I came up with the following to put Dahl into an oscillator format. It is the STOCHRSI formula, replacing RSI with a 55 day Dahl. Does this reflect your thinking on the indicator? It seems to lead changes in Dahl by a period or two, but doesn't seem as fast as the STOCHRSI indicator. Checking a few stocks in my database, there are very few times that it goes below zero, but it will 'peg out' at 100 for significant periods. Perhaps the 14 day smoothing is too short in relation to the 55 period primary indicator. A longer MA period seems to smooth it out significantly, which would seem to defeat the purpose of using an oscillator.

Mov((mov(c,55,simp) - ref(mov(c,55,simp),-15)- LLV(mov(c,55,simp) - ref(mov(c,55,simp),-15),14))/(HHV(mov(c,55,simp) - ref(mov(c,55,simp),-15),14)-(LLV(mov(c,55,simp) - ref(mov(c,55,simp),-15),14))),14,E)*100

(Go Top)

Dahl Variations

Dahl Volume Trend
Mov(C,55,VOL)-Ref(Mov(C,55,VOL),-15)

PVT Dahl Trend:
Mov((PVT()-Ref( PVT(),-15)),55,E)

Smoothed OBV Vol 88:
Mov((OBV()-Mov(OBV(),88,VOL)),55,E)

OBV Dahl Trend:
Mov((OBV()-Ref(OBV(),-15)),55,E)

Compare each to ordinary Dahl or some other trend indicator. Remember, I put a 21 EMA trigger on each.

(Go Top)

Dave's New System (DNS)

Is a binary consisting of 8 indicators.}

If(SAR(.02,.2)<C,1,0) +
If((Mov(C,5,E)>Mov(C,13,E)),1,0) +
If((Mov(C,13,E)>Mov(C,40,E)),1,0) +
If((Mov(C,8,E)-Mov(C,17,E))> (Mov(Mov(C,8,E)-Mov(C,17,E),9,E)),1,0)+ If(Mov(C,50,SIMPLE) - Ref(Mov(C,50,SIMPLE),-15) > 0,1,0)+
If((Mov(ROC(C,12,%),3,E)>=-6 OR ROC(C,12,%)>0),1,0)+
If(OBV()>Mov(OBV(),40,S),1,0)+
If(V>Mov(V,120,S),1,0)

(Go Top)

Days Since Crossover

{place formula in filter section of explorer, making sure that formulas
within quotes are valid indicators}

BarsSince(Cross(45, Fml( "Stochrsi (14)" )))>
BarsSince(Cross(Fml( "Stochrsi (7,3)" ),72)) AND
Ref(BarsSince(Cross(45,Fml( "StochRSI (14)" ))) <
BarsSince(Fml( "staters (7,3)")>72), -1)

(Go Top)

Denvelope

In the Oct issue of "Futures" there is an article written by Dennis McNicholl called "Better Bollinger Bands". In his
article he describes how in a trending market the center band of the B.B. will shift away from the "mean" value of
the price, and that the two outer bands will shift outward to such an extent that the envelope loses its utility as a
volatility gauge (these are his words... not mine).  As usual "Futures" only posted the TradeStation code,
so this is my conversion from it. He called the Indicator "Denvelope", and it runs the bands much closer.....
similar to "Standard Error Bands".
{Denvelope}
{Better Bollinger Bands}
Lb:=Input("Look-Back Period ?",3,100,20);
De:=Input("Band Deviation ?",.5,3,2);
Alp:=2/(Lb+1);
Mt:=Alp*CLOSE+(1-Alp)*PREV;
Ut:=Alp*Mt+(1-Alp)*PREV;
Dt:=((2-Alp)*Mt-Ut)/(1-Alp);
mt2:=Alp*Abs(C-Dt)+(1-Alp)*PREV;
ut2:=Alp*mt2+(1-alp)*PREV;
dt2:=((2-Alp)*mt2-ut2)/(1-Alp);
But:=Dt+de*dt2;
Blt:=Dt-de*dt2;
But;
Dt;
Blt;

(Go Top)

Denvelope (RSI)

pds:=Input("Periods",2,200,14);
sd:=Input("Standard Deviations",.01,10,2);
D1:= RSI(pds);
alpha:=2/(pds+1);
mt:=alpha*D1+(1-alpha)*(If(Cum(1)<pds,D1,PREV));
ut:=alpha*mt+(1-alpha)*(If(Cum(1)<pds,D1,PREV));
dt:=((2-alpha)*mt-ut)/(1-alpha);
mt2:=alpha*Abs(D1-dt)+(1-alpha)*PREV;
ut2:=alpha*mt2+(1-alpha)*PREV;
dt2:=((2-alpha)*mt2-ut2)/(1-alpha);
but:=dt+sd*dt2;
blt:=dt-sd*dt2;
blt;
dt;
but;

(Go Top)

DEVSTOP

Here's what I think a DEVSTOP is in MetaStock language, described in Kase's
"Trading with the Odds", and better described in Kaufman's "Trading Systems
and Methods". It uses a 2-day range, calculates an average range and SD of
the range, and then draws 4 lines below the high, at 1 range and 0,1,2, and
3 SD's. "2.2" and "3.6" are corrections for skew of the distribution.

AVTR:=Mov(HHV(H,2) - LLV(L,2),20, S);
SD:=Stdev(HHV(H,2) - LLV(L,2),20);
HHV(H-AVTR-3.6*SD, 20);
HHV(H-AVTR-2.2*SD,20);
HHV(H-AVTR-SD,20);
HHV(H-AVTR,20);

(Go Top)

Displace Indicator Forward

To displace an indicator forward, you use Ref(myInd,-p). The median and typical prices are built-in functions -- MP() is (H+L)/2 and typ() is (H+L+C)/3.

For MP, use

Period:= Input("What Period",1,250,10);
Disp:= Input("Forward Displacement",0,250,10);
EMA1:= Mov(MP(),Period,E);
EMA2:= Mov(EMA1,Period,E);
Difference:= EMA1 - EMA2;
ZeroLagEMA:= EMA1 + Difference;
Ref(ZeroLagEMA,-Disp)

(Go Top)

Divergence Between Close and Indicator

Divergence between the Close and an Indicator (Rev. 03/18/97 from Equis Support) The following formula will calculate the correlation of the Close and the MACD. It is written using a "long form" MACD so that the time periods used by the MACD may be changed. This indicator shows "divergence" between the close and the indicator: In the Windows versions of MetaStock the formula is:

Correl(((Sum(Cum(1)*(Mov(C,12,E)-Mov(C,26,E)),100))-(Sum(Cum(1),100)* Sum((Mov(C,12,E)-Mov(C,26,E)),100)/100))/((Sum(Power(Cum(1),2),100))- (Power(Sum(Cum(1),100),2)/100)),((Sum(Cum(1)*C,100))-(Sum(Cum(1),100)* Sum(C,100)/100))/((Sum(Power(Cum(1),2),100))-(Power(Sum(Cum(1),100),2)/100)),12,0)

The interpretation of the indicator output is as follows: - .08 (80%) and lower is divergence between the Close and the MACD. - 1 is very strong divergence. + 1 is very strong correlation. The formula was constructed this way so that most other indicators may be used in place of the MACD. For example, here is the same indicator using the RSI(14):

Correl(((Sum(Cum(1)*(RSI(14)),100))-(Sum(Cum(1),100)* Sum((RSI(14)),100)/100))/((Sum(Power(Cum(1),2),100))-(Power(Sum(Cum(1),100),2)/100)), ((Sum(Cum(1)*C,100))-(Sum(Cum(1),100)*Sum(C,100)/100))/((Sum(Power(Cum(1),2),100))- (Power(Sum(Cum(1),100),2)/100)),12,0)

(Go Top)

Double Inside Day

{For today is an inside day}
H < Ref(H,-1) and
L > Ref(L,-1) and
{For yesterday was an inside day}
Ref(H,-1) < Ref(H,-2) and
Ref(L,-1) > Ref(L,-2)

(Go Top)

Double Tops and Double Bottoms

In the February 1998 issue of Technical Analysis of Stocks & Commodities magazine, Thomas Bulkowski discusses the use of Double Bottoms as a means of finding profitable trades.

In MetaStock for Windows, you can find both Double Tops and Double Bottoms with these formulas. There is a caveat however. In the article, Mr. Bulkowski utilizes the High-Low range in finding Double Bottoms. These formulas use only the close value, so a few of the lower priced issues will not produce signals in MetaStock. Overall, however, these formulas produce most of the major signals he discusses.

Double Tops

PK:=Zig(C,10,%)<Ref(Zig(C,10,%),-1) AND Ref(Zig(C,10,%),-1)>Ref(Zig(C,10,%),-2);

TR:=Zig(C,10,%)>Ref(Zig(C,10,%),-1) AND Ref(Zig(C,10,%),-1)<Ref(Zig(C,10,%),-2);

PK1:=PeakBars(1,C,10);

PK2:=PeakBars(2,C,10);

(ValueWhen(1,PK,Ref(C,-1))/ValueWhen(2,PK,Ref(C,-1))>.96 AND ValueWhen(1,PK,Ref(C,-1)) / ValueWhen(2,PK,Ref(C,-1))<1.04) AND PK2-PK1>=10 AND Cross(ValueWhen(1,TR,Ref(C,-1)),C)

Double Bottoms

PK:=Zig(C,10,%)<Ref(Zig(C,10,%),-1) AND Ref(Zig(C,10,%),-1)>Ref(Zig(C,10,%),-2);

TR:=Zig(C,10,%)>Ref(Zig(C,10,%),-1) AND Ref(Zig(C,10,%),-1)<Ref(Zig(C,10,%),-2);

TR1:=TroughBars(1,C,10);

TR2:=TroughBars(2,C,10);

(ValueWhen(1,TR,Ref(C,-1))/ValueWhen(2,TR,Ref(C,-1))>.96 AND ValueWhen(1,TR,Ref(C,-1)) / ValueWhen(2,TR,Ref(C,-1))<1.04) AND TR2-TR1>=10 AND Cross(C,ValueWhen(1,PK,Ref(C,-1)))

(Go Top)

Down 20% on Double Average Volume

Col A: CLOSE

Col B: ROC(C,5,%)

Filter ROC(C,5,%)<=-20 AND Mov(V,5,S)>=(2*Ref(Mov(V,60,S),-5))

Filter enabled Yes

Periodicity Daily

Records required 1300

(Go Top)

DMTF Trading System

I know I'm a little slow, but I've just gotten around to working on the Dynamic Multiple Time Frame indicators given by Robert Krausz in the 1999 Bonus Issue of TASC.

The code for the actual indicators can be found at the Equis website (www.equis.com) so I won't post them again here. I've been testing a system based on these indicators on Best Buy (a stock that seems to be quite amenable to system trading) and getting very good results. The system is currently for long trades only; I'll work on shorting later. Here's what I've got so far

Enter Long:
day:=DayOfWeek();
Fml("dynamic balance")>Fml("dynamik balance point steps")
AND Fml("fixed balance point")>Ref(Fml("fixed balance Point"),-5)
OR Fml("tendency")>0 AND day=5
Close Long
Cross(Fml("dynamik balance point steps"),Fml("dynamic balance"))
AND Fml("fixed balance point")<Ref(Fml("fixed balance Point"),-5)

The problem is that the close is not defined, meaning that the two events which initiate the close do not have to happen. The DBPS can cross the DB without the 2nd condition occuring. Then, when later, the 2nd condition does occur, sell is not triggered because the cross over has not happened simultaneously with the 2nd condition. Theoretically, if we follow the system strictly, this can lead to a complete loss. I understand that I can set arbitrary stops, but I prefer to let the system do the work. Simply reversing the entry signal and other tries, such as support breakthoughs, drastically reduce the result.

(Go Top)

Dunnigan Trend

{Ask to use 1 day or 2 day Swing type}
St:=Input("Short Term Swing Type, 1 or 2 ?",
1,2,2);
{Call Swing Type Formula}
Sd:=If(Round(St)=1,
{then} FmlVar("Dunn-Type1","TD1"),
{else} FmlVar("Dunn-Type2","TD1"));
{Number Of Periods Since Swing Started Up}
Hc:=BarsSince(SD=-1);
{Number Of Periods Since Swing Started Down}
Lc:=BarsSince(SD=1);
{Find Highest Value Of Up Swing}
Hv:=If(Hc>Lc AND H>Ref(H,-1),
{then}HighestSince(1,Hc=1,H),
{else}0);
{Find Lowest Value Of Down Swing}
Lv:=If(Hc<Lc AND L<Ref(L,-1),
{then}LowestSince(1,Lc=1,L),
{else}0);
{Find The Low Of The Highest High}
Hlv:=ValueWhen(1,H=Hv,L);
{Find The High Of The Lowest Low}
Lhv:=ValueWhen(1,L=Lv,H);
{Calculate And Plot Trend Direction,
Note: 1= Uptrend,
-1= Downtrend}
TD2:=If(Sd=1 AND H>Lhv,
{then}1,
{else}If(Sd=-1 AND L<Hlv,
{then}-1,
{else}0));
TD3:=ValueWhen(1,TD2<>0,TD2);
TD3

{These formulas simply plot a 1 if market is up or -1 if down. I really didn't code this to be used as an indicator, but to be used as a subroutine, or possibly in an "Expert Adviser".
Best wishes, Adam Hefner.}

(Go Top)

Dunn-Type 1

{Market swing is defined as:
Up = higher highs and higher lows,
Down = lower highs and lower lows.}

TD1:=If(BarsSince(H>Ref(H,-1) AND L>Ref(L,-1)) <
BarsSince(L<Ref(L,-1) AND H<Ref(H,-1)),
{then}1,
{else}-1);
TD1

(Go Top)

Dunn-Type 2

{Market swing is defined as:
Up = 2 higher highs and 2 higher lows,
Down = 2 lower highs and 2 lower lows.}
TD1:=If(BarsSince((H>Ref(H,-1) AND L>Ref(L,-1))
AND (Ref(H,-1)>Ref(H,-2)
AND Ref(L,-1)>Ref(L,-2))) <
BarsSince((L<Ref(L,-1) AND H<Ref(H,-1))
AND (Ref(L,-1)<Ref(L,-2)
AND Ref(H,-1)<Ref(H,-2))),
{then}1,
{else}-1);
TD1

(Go Top)

Dynamic Multiple Time Frame Indicator

Explanation of the Dynamic Multiple Time Frame Indicator by the author, Adam Hefner:

"The Fixed Balance Point is calculated every Friday by
taking the weekly (high+low+close)/3. It really doesn't
need to be plotted, but is mostly used to base the other
indicators from.

The Fixed Balance Point Step, is a 5 week average of
the Fixed Balance Point.

The Dynamic Balance Point is the daily update of the
Fixed Balance Point.

The Dynamic Balance Point Step is the daily update
of the Fixed Balance Point Step.

Robert Krausz teaches that by watching the balance point
calculations of the longer (weekly) time, you have the market
direction (trend) for the shorter (daily) time. He also revealed
that the when the Dynamic Balance Point is above the Dynamic
Balance Point Step, then the trend is up, and opposite is true
for down trend. I have found that these act in much the same way
as a 5/25 moving average cross-over system.

I like the Fibonacci Support & Resistance best of all, seems (IMHO)
that these support/resistance areas are very easy to visualize using
this formula."

(Go Top)

Dynamic Zones

{Zamansky&Stendahl's Dynamic Zones for MS6.5 (From the TASC July1997 article). First, for the Lookback Periods plot a 9-day RSI along with StDev adjusted rolling 70-day SMAs; e.g., as can be seen in the article's S&P500-example}

PR:=Input("Enter Periods for RSI",1,100,9);
PB:=Input("Enter Periods for BUY",1,100,70);
PS:=Input("Enter Periods for SELL",1,100,70);
UpZone:=Mov(RSI(PR),PS,S)+(1.3185 *Stdev(RSI(PR),PS));
LwZone:=Mov(RSI(PR),PB,S)-(1.3185 *Stdev(RSI(PR),PB));
UpZone;
LwZone;

Most indicators use a fixed zone for buy and sell signals. Here's a concept based on zones that are responsive to past levels of the indicator.

One approach to active investing employs the use of oscillators to exploit tradable market trends. This investing style follows a very simple form of logic: Enter the market only when an oscillator has moved far above or below traditional trading levels. However, these oscillator-driven systems lack the ability to evolve with the market because they use fixed buy and sell zones. Traders typically use one set of buy and sell zones for a bull market and substantially different zones for a bear market. And therein lies the problem.

Once traders begin introducing their market opinions into trading equations, by changing the zones, they negate the system's mechanical nature. The objective is to have a system automatically define its own buy and sell zones and thereby profitably trade in any market -- bull or bear. Dynamic zones offer a solution to the problem of fixed buy and sell zones for any oscillator-driven system.

The algorithm for the dynamic zones is a series of steps. First, decide the value of the lookback period t. Next, decide the value of the probability Pbuy for buy zone and value of the probability Psell for the sell zone.

The area above and below the dynamic zones constitute the upper and lower 10% boundaries. The zones appear to evolve with the market because they use a rolling 70-day period of indicator values in their construction.

(Go Top)

Daily Close vs. High and Low Close

if((C-L)/(H-L),>,.66 ,1, if((C-L)/(H-L),<,.38,-1,0))

(Go Top)

Detrended Price Oscillator

The Detrended Price Oscillator (DPO) is an indicator that attempts to eliminate the trend in prices. Detrended prices allow you to more easily identify cycles and overbought/oversold levels. Here is the MetaStock custom formula for the DPO:

Close-Ref( Mov(Close, X, Simple ), T)

***where X is the number of Time Periods for the Oscillator and T = X / 2 + 1.

For example, a 20 period DPO would be:

X = 20
T = (20/2 + 1) = 11
Close-Ref( Mov(Close, 20, Simple),11)

(Go Top)

Disparity Index

Steve Nison refers to the his Disparity Index "as a percentage display of the latest close to a chosen moving average". This can be defined in MetaStock using the formula:

( ( C - Mov( C ,X ,? ) ) / Mov( C ,X ,? ) ) * 100

** where X is the number of time periods and ? is the calculation type of the moving average.

For example:

( ( C - Mov( C ,13,E ) ) / Mov( C ,13 ,E ) ) * 100

** where X = 13 time periods and ? = Exponential moving average.

For interpretation on the Disparity Index refer to Steve Nison's book Beyond Candlesticks which is available from the Equis Direct catalogue.

(Go Top)

Displaying the Price of a Security in 32nds and 64ths

All versions of MetaStock prior to our Windows software would need this formula.

You can display your security's prices in 32nds and 64ths, by using the following custom formulas. Once plotted these values will be displayed in the indicator window.

For 32nds:

INT( C ) + ( ( FRAC( C ) / .03125 ) / 100 )

For 64ths:

INT( C ) + ( ( FRAC( C ) / .015625 ) / 100 )

**Where C is for the security's closing price and can be replaced with O, H, or L for the open, high, or low price instead.

(Go Top)

Divergence Between the Close and an Indicator

The following formula will calculate the correlation of the Close and the MACD. It is written using a "long form" MACD so that the time periods used by the MACD may be changed. This indicator shows "divergence" between the close and the indicator:

In the Windows versions of MetaStock the formula is:

Correl(((Sum(Cum(1)*(Mov(C,12,E)-Mov(C,26,E)),100))-(Sum(Cum(1),100)*
Sum((Mov(C,12,E)-Mov(C,26,E)),100)/100))/((Sum(Power(Cum(1),2),100))-
(Power(Sum(Cum(1),100),2)/100)),((Sum(Cum(1)*C,100))-(Sum(Cum(1),100)*
Sum(C,100)/100))/((Sum(Power(Cum(1),2),100))-(Power(Sum(Cum(1),100),2)/100)),12,0)

The interpretation of the indicator output is as follows:

- .08 (80%) and lower is divergence between the Close and the MACD.
- 1 is very strong divergence.
+ 1 is very strong correlation.

The formula was constructed this way so that most other indicators may be used in place of the MACD.

For example here is the same indicator using the RSI(14)

Correl(((Sum(Cum(1)*(RSI(14)),100))-(Sum(Cum(1),100)*
Sum((RSI(14)),100)/100))/((Sum(Power(Cum(1),2),100))-(Power(Sum(Cum(1),100),2)/100)),
((Sum(Cum(1)*C,100))-(Sum(Cum(1),100)*Sum(C,100)/100))/((Sum(Power(Cum(1),2),100))-
(Power(Sum(Cum(1),100),2)/100)),12,0)

(Go Top)

Dynamic Momentum Oscillator

In July 1996 Futures magazine, E. Marshall Wall introduces the Dynamic Momentum Oscillator (Dynamo). Please refer to this article for interpretation.

He describes the Dynamo Oscillator to be:

Dynamo = Mc - ( MAo - O )

where
Mc = the midpoint of the oscillator
MAo = a moving average of the oscillator
O = the oscillator

This concept can be applied to most any oscillator to improve its results.

For example:

Applying the Dynamo Oscillator to a 5-period %K slowed 3 periods Stochastic Oscillator would give:

50-(Mov(Stoch(5,3),21,S)-Stoch(5,3))

where:
Mc = Stochastic Oscillator's midpoint = 50
MAo = Moving average of the Stochastic = Mov(Stoch(5,3),21,S
O = Stochastic Oscillator = Stoch(5,3)

This example applies it to an RSI oscillator:

50-(Mov(RSI(14),21,S)-RSI(14))

where:
Mc = RSI's midpoint = 50
MAo = Moving average of the RSI = Mov(RSI(14),21,S
O= RSI Oscillator = RSI(14)

(Go Top)

Derivative Moving Average

The information for this test was published in the June 1996 issue of "Technical Analysis of Stocks and Commodities". The test appears in the article "The Derivative Moving Average" by Adam White, page 18. Mr. White describes this test as using a variation of the "tried-and-true simple moving average for entry signals and the "trend analysis index" for exit signals. Note, first you need to create a new indicator called TAI, using the TAI formula below - then create the new system test.

Signal Formulas
Enter Long:
When(Ref(Mov(C,28,S),-1),=,LLV(Mov(C,28,S),4))
Close Long:
When(Fml("TAI"),<,0.4) AND When(Ref(Fml("TAI"),-1),>=,0.4)
 
TAI Formula
((HHV(Mov(C,28,S),5)-LLV(Mov(C,28,S),5))/C)*100

(Go Top)