[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Demark Sequential - Cannot be done in MetaStock



PureBytes Links

Trading Reference Links

Hi Yuwono & All,

Tom DeMarks buying/selling Sequence has interested me too, and I've tried to program it in MS, but that's a no-go - once again because of the inability (unwillingness?) of MS to use Time as a variable.

First of all, Mr/Ms's Yuwono's signals represent only the preparatory phases of a Tom-DeMark-Sequence (TDMS). My 'wisdom' re. TDMS is from "Schwager on Futures, Technical Analysis", Chapter "Profit Targets" (or so - I quote/translate from the German edition). In the following I'll try to subsume Schwager's conditions for a completed TDMS (on
the buying side; for selling just take the converse):
1. Preparatory Phase: Nine or more Closes are lower than the Closes of 4 days earlier.
2. Setup-Completion Phase: The High of each day on or after the 8th. day of phase 1 must be higher than the Low of the last three days. (In order to prevent betting on equities that are just plummeting.)
3. Count-Down Phase: If phase 2 checks OK, start counting at 0. Increment for each day whose Close is lower than than the Close of 2 days earlier. Note that these days do not have to be consecutive! On the count of 13, phase 3 is complete and the signal is generated.
3A. Count-down is stopped on any of the following 3 conditions:
I    A preparatory phase for a SELLING signal starts,
II    The Close is higher than the highest High of the preparatory phase,
        (I changed the order on conditions I & II (tackling the easiest task 1st).)
III    A new preparatory phase starts before the countdown is complete. In that case everything starts anew from ground zero.

Inspired by all the traffic on the Forum I tried to program this in MS - with the following results:
{Tom DeMarks Buying Sequence}
{Phase 1}
DnSeq:=(C < Ref(C,-4) AND
Ref(C,-1) < Ref(C,-5) AND
Ref(C,-2) < Ref(C,-6) AND
Ref(C,-3) < Ref(C,-7) AND
Ref(C,-4) < Ref(C,-8) AND
Ref(C,-5) < Ref(C,-9) AND
Ref(C,-6) < Ref(C,-10) AND
Ref(C,-7) < Ref(C,-11) AND
Ref(C,-8) < Ref(C,-12) );

UpSeq:=(C > Ref(C,-4) AND
Ref(C,-1) > Ref(C,-5) AND
Ref(C,-2) > Ref(C,-6) AND
Ref(C,-3) > Ref(C,-7) AND
Ref(C,-4) > Ref(C,-8) AND
Ref(C,-5) > Ref(C,-9) AND
Ref(C,-6) > Ref(C,-10) AND
Ref(C,-7) > Ref(C,-11) AND
Ref(C,-8) > Ref(C,-12) );

{Phase 2}
NixFreeFall:=H>Ref(L,-1) AND H>Ref(L,-2) AND H>Ref(L,-3) AND
Ref(H,-1)>Ref(L,-2) AND Ref(H,-1)>Ref(L,-3) AND ref(H,-1)>Ref(L,-4);

{Combine Phases 1 & 2}
Rdy4CntDn:=(DnSeq = TRUE) AND (NixFreeFall = TRUE);

{We need to know when this happened}
BarsDnSeq:=BarsSince(DnSeq = TRUE);
BarsUpSeq:=BarsSince(UpSeq = TRUE);
BarsRdy4CntDn:=BarsSince(Rdy4CntDn = TRUE);

{Condition I for halting the countdown}
StopCntDn1:=BarsUpSeq<BarsDnSeq;

{Condition II (no exuberant upswings b4 countdown is complete)}
StopCntDn2:=C>HHV(Ref(H,-BarsDnSeq),8);
================================================
And here I ran into terminal trouble because neither HHV() nor Ref() allow the use of a variable for the number of days (Bars), and I haven't the vaguest idea how one could program around this in the present case.
Stop-Condition III shouldn't be unsurmountable but problems return with a vengeance if you try to increment the counter on disjunctive days.
So here is where I threw up my hands in dismay and dropped the project. If anyone else has an idea on how to tackle the problem I'd be interested and most grateful; otherwise we seem to have run up against the stone wall of MS's variables-problems once again.

Btw. If you stop halfway through, and just output Rdy4CntDn, the signals have at least been extended to include phase 2. For the rest I guess I'll just turn back to my trusty Excel which has never yet capitulated for problems of this kind.

Kind Regards & Happy Trading,
Jan Willem Roberts


Yuwono wrote:

> Many of you asking me to sent the expert file. So, I send again the content of
> the formula and the expert file.
>
> Formula:
>
> TDSeqBuySignal
>
> (C < Ref(C,-4) AND
> Ref(C,-1) < Ref(C,-5) AND
> Ref(C,-2) < Ref(C,-6) AND
> Ref(C,-3) < Ref(C,-7) AND
> Ref(C,-4) < Ref(C,-8) AND
> Ref(C,-5) < Ref(C,-9) AND
> Ref(C,-6) < Ref(C,-10) AND
> Ref(C,-7) < Ref(C,-11) AND
> Ref(C,-8) < Ref(C,-12) )
>
> TDSeqSellSignal
>
> (C > Ref(C,-4) AND
> Ref(C,-1) > Ref(C,-5) AND
> Ref(C,-2) > Ref(C,-6) AND
> Ref(C,-3) > Ref(C,-7) AND
> Ref(C,-4) > Ref(C,-8) AND
> Ref(C,-5) > Ref(C,-9) AND
> Ref(C,-6) > Ref(C,-10) AND
> Ref(C,-7) > Ref(C,-11) AND
> Ref(C,-8) > Ref(C,-12) )
>
> For Expert System
> Name : ThomasDeMarkSequential
> Notes :
> TD Sequential Chapter 7, Figures 7.28 - 7.31.
> "Sequential" is a Trademark held by Thomas R. DeMark.
> "Price Countdown" is a Trademark held by Thomas R. DeMark.
> "Price Intersector" is a Trademark held by Thomas R. DeMark.
> Idea taken from "The New Science of Technical Analysis" by Thomas R. DeMark,
> published by John Wiley & Sons, New York, 1994.
>
> Commentary:
> Thomas DeMark Indicator
> of
> <Name>(<SYMBOL>)
> Writeif( Fml( "TDSeqBuySignal" ) ,
> "Sequential Setup is at 9 down. The minimum conditions for a valid 'Nine Count' Setup Down have been satisfied.
> Expect the market to stabilize or to produce a short term reversal to the upside. However, unless the market is in a free fall or the larger trend is up, this reversal should be temporary and the decline should resume later.
> For More Information on the 'DeMark Indicators' contact:
> Duane Davis
> P.O. Box 736
> Fairview, NC 28730
> (704) 628-4222 Voice
> (704) 628-3100 Fax
> Important: This commentary is designed solely as a training tool for the understanding of technical analysis of the financial markets. It is not designed to provide any investment or other professional advice.")\
> Writeif( Fml( "TDSeqSellSignal" ) ,
> "Sequential Setup is at 9 up. The minimum conditions for a valid 'Nine Count' Setup Up have been satisfied. Expect the market to stabilize or to produce a short term reversal to the down side. However, unless the market is in a blow off phase or the larger trend is down, this pullback should be temporary and the advance should resume later.
> For More Information on the 'DeMark Indicators' contact:
> Duane Davis
> P.O. Box 736
> Fairview, NC 28730
> (704) 628-4222 Voice
> (704) 628-3100 Fax
> Important: This commentary is designed solely as a training tool for the understanding of technical analysis of the financial markets. It is not designed to provide any investment or other professional advice."
> )
>
> Highlights: (choose the color for yourself)
> TDSeqBuySignal : Fml("TDSeqBuySignal")
> TDSeqSellSignal : Fml("TDSeqSellSignal")