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

I need some comments re; TD Sequential Code



PureBytes Links

Trading Reference Links

Hi Listers,

Several weeks ago I noticed that several people had asked for the ela code
for Tom DeMarks Sequential setup. I did not see anyone answer these
request. This past week a fellow trader asked me to code a count sequence
that he has used successfully for the last ten years. His initial setup
uses Tom DeMarks Sequential count sequence, and then he uses some
additional filters. 

Before I continued onto writing the code for the filters I thought that
there might be several traders on this list that have much more knowledge
about this sequence than I (I don't use any of Toms material), and would be
able to tell me that the following code does in fact reflect Toms
Sequential sequence. If you could review the enclosed code in this e-mail
it would be appreciated. Also if there is a more elegant way to write the
code I would appreciate hearing how.

Since I rarely get the time to read the postings on this list, if you could
respond privately to me at gosente@xxxxxxxxx it would be much appreciated.
The code has been pasted into this e-mail, as I personally never load/use
any ela code if I don't know the author (for security reasons).

Thank you all in advance for any help/review offered.

John Hayden

P.S. For those that are curious on why I subscribe to this list and don;t
read the e-mails, it is because I save all of the e-mails to a hard disk,
index the e-mails, and whenever I have a technical challenge in TS4 or TS5
or whatever I can quickly reference any relevant e-mails. Much better than
calling Omega.

xxxxxxxxxxxxxxxxxxxxxxx ELA CODE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

{Tom DeMark Sequential setup} 
	{- the goal is to plot a line on; up/dwn consecutive closes}
				{valid long/short, the valid 13 count up or down, and whenever the
count of 13 is reached}
					
Vars: c1(0), f1(0), vB(0), f3(0), v1(0), z(0), u(0);
Vars: FlagHi(0), z2(0), Action(0);
{Vars for short setup}
Vars: y(0), FlagLo(0), f1a(0), vS(0), y2(0);
{vars for Combined functions}
Vars: StUp9(0), Valid(0), CtDn13(0);

{xxxxxxxxxxxxxxxxxxxxxxx  Short or Long setup
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
{Long Setup} {buy setup is completed when we have 9 concecutive closes less
than the close 4 days
earlier}
If close < close[4] then z=z+1 else z=0; {resets count value when sequence
is negated}
If z>=1 AND High>FlagHi then FlagHi=High; { Sets High value} {WHY DOES IT
FAIL TO RESET TO ) IF
[4] is =?}

{Short Setup} {Sell setup is completed when we have 9 concecutive closes
higher than the close 4
days earlier}
If close > close[4] then y=y-1 else y=0;
If y<=-1 AND Low<FlagLo then FlagLo=Low; {Sets Low Value}

If z>=1 and y=0 then StUp9=z; {sums positive and negatice count into one var}
If y<=-1 and z=0 then StUp9=y;

{xxxxxxxxxxxxxxxxxxxxxxxxxx Valid Long Setup (intersection)
xxxxxxxxxxxxxxxxxxxxxxx}

            {The price Range must of day 8 or 9, overlap the price range of
any setup day (1-9)
three of more days earlier}
	           {i.e., countdown for a buy takes place once the high of day 8
or 9 or any subsequent
day 
			   (i.e., day 10, 11, 12 etc) is greater than or equal to the low 3, 4,
5, 6, 7 days earlier}
			   	
IF StUp9 >= 9 And (High >= Low[3] OR High >= Low[4] OR High >= Low[5] OR
High >= Low[6] OR High >=
Low[7])
					Then vB=1 ; {Did range overlap previous range AND setup >= 9}
If vB=1 AND y>=-2 then vB=1 else vB=0;
{Resets flags because of invalid setup, i.e., current high exceeded higher
high of setup after a
valid intersection}
 
If vB=1 AND high>FlagHi then z=0;
If vB=1 AND high>FlagHi then z2=0;
If vB=1 AND high>FlagHi then FlagHi=0;
If vB=1 AND high>FlagHi then Valid=0;
If vB=1 AND high>FlagHi then vB=0;  {must be last}

{xxxxxxxxxxxxxxxxxxxxxxxxxx Valid Short Setup (intersection)
xxxxxxxxxxxxxxxxxxxxxxx}

IF y <= -9 And (Low <= High[3] OR Low <= High[4] OR Low <= High[5] OR Low
<= High[6] OR Low <=
High[7])
					Then vS=-1 ; {Did range overlap previous range AND setup >= 9}
If vS=-1 AND z<=2 then vS=-1 else vS=0;
{Resets flags because of invalid setup, i.e., current low exceeded lowest
low of setup after a
valid intersection}
 
If vS=-1 AND Low<FlagLo then y=0;
If vS=-1 AND Low<FlagLo then y2=0;
If vS=-1 AND Low<FlagLo then FlagLo=100000;
If vS=-1 AND Low<FlagLo then Valid=0;
If vS=-1 AND Low<FlagLo then vS=0;  {must be last}


If vB=1 then Valid=1;
If vS=-1 then Valid=-1;

{xxxxxxxxxxxxxxxxxxxxxxx  Countdown Buy
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}

                   {Is relationship of the close to the low 2 days
previously (it must be less
than low 2 days ago)}
						{We must then get a close < low[2] thirteen times}
							{Setup is cancled when }
							   {1. A setup in the opposite direction occurs, OR }
							   {2. A second buy setup occurs.}
							   	
If Close < Low[2] AND Valid=1 then z2=z2+1;
If Close < Low[2] AND Valid=1 then y2=0;
IF z2>=13 then Action=5; {look to buy}
If z2=14 then z=0;
If z2=14 then vB=0;
If z2=14 then FlagHi=0;
If z2=14 then Valid=0;
If z2=14 then z2=0;

							   	
{xxxxxxxxxxxxxxxxxxxxxxx  Countdown Sell
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}							   	

If Close > High[2] AND Valid=-1 then y2=y2-1;
If Close > High[2] AND Valid=-1 then z2=0;
IF y2<=-13 then Action=-5 ; {look to sell}
If y2=-14 then y=0;
If y2=-14 then vS=0;
If y2=-14 then FlagLo=100000;
If y2=-14 then Valid=0;
If y2=-14 then y2=0;

If z2<>13 And y2<>-13 then Action=0;
{If z2>0 then CtDn13=z2 else CtDn13=y2;}
CtDn13=z2+y2;

{xxxxxxxxxxxxxxxxxxxxx Entry  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
									
    { requires a price flip (close greater than close 4 days earlier) after
countdown is done.
Second possibility is to buy the 1st time a subsequent close  greater than
high 2 days earlier.}
										

{xxxxxxxxxxxxxxxxx  PLOT  xxxxxxxxxxxxxxxxxxxxxxxxxx}
											
Plot1 (StUp9,"count");
Plot2 (Action,"valid");
Plot3 (CtDn13,"13 cnt");