Thomas DeMark Sequential System

Bewinner

Well-Known Member
Hope this will help.

HTML:
// TD Sequential Setup 
Plot( C, "Price", colorBlack, styleCandle ); 
y = ParamField("Price field"); 

Buy = Sum( y < Ref( y, -4 ), 9 ) == 9 AND Ref( y, -9) > Ref( y, -13 ); 
Sell = Sum( y > Ref( y, -4 ), 9 ) == 9 AND Ref( y, -9) < Ref( y, -13 ); 

PlotShapes( Buy * shapeUpArrow + Sell * shapeDownArrow, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, L, H ) );


//LISTING 2
// Ermanometry 
Plot( C, "Price", colorBlack, styleCandle ); 
dt = DateTime(); 
Start = dt == SelectedValue( dt ); 

EF = Param("Seed Seg EF", 48, 1, 900 ); 
DE = Param("Seed Seg DE", 40, 1, 900 ); 

Ratio = EF/DE; 
InverseRatio = 1/Ratio; 

x = BarsSince( start ); 
CD = DE * Inverseratio; 
BC = CD * Inverseratio; 
AB = BC * Inverseratio; 
FG = EF* Ratio; 
GH = FG * Ratio; 
HI = GH * Ratio; 
IJ = HI * Ratio; 

FH = sqrt( FG ^ 2 + GH ^ 2 ); 

Erman = 
x == int(FH) OR /* Erman */ 
x == int(GH) OR /* Erman */ 
x == int(HI) OR /* Erman */ 
x == int(IJ) OR /* Erman */ 
x == int(DE+EF+CD) OR /* Erman */ 
x == int(GH+HI+IJ) OR /* Erman */ 
x == int(CD+DE+EF+FG+GH+HI) OR /* Erman */ 
x == int(EF+FG+GH) OR /* Erman */ 
x == int(CD+DE+EF+FG+GH) OR /* Erman */ 
x == int(CD+DE+EF+FG+GH+HI) OR /* Erman */ 
x == int(GH+IJ+CD+AB+EF); /* Erman */ 

Plot( Erman, "Erman", colorRed, styleHistogram | styleOwnScale ); 

FH = sqrt( FG ^ 2 + GH ^ 2 ); 

Coles = 
x == int(FH+FG+GH) OR /* Coles */ 
x == int(AB+BC+CD+DE) OR /* Coles */ 
x == int(AB+BC+CD+DE+GH) OR /* Coles */ 
x == int(FG+GH) OR /* Coles */ 
x == int(GH+HI) OR /* Coles */ 
x == int(FG+BC+CD) OR /* Coles */ 
x == int(FG+BC+CD+DE) OR /* Coles */ 
x == int(CD+BC) OR /* Coles */ 
x == int(DE+BC) OR /* Coles */ 
x == int(sqrt(CD^2+DE^2)+CD+DE) OR /* Coles */ 
x == int(sqrt(EF^2+FG^2)+EF+FG); /* Coles */ 

Plot( Coles, "Coles", colorGreen, styleHistogram | styleOwnScale );
Enjoy
Johnybhai...
Is ermanometry part required here?
 

johnnypareek

Well-Known Member
Johnybhai...
Is ermanometry part required here?
Okay chk this

HTML:
_SECTION_BEGIN("AAA TD Sequential");
Title = Name() +" ("+ FullName()+ ")  - "+" O="+O+", H="+H+", L="+L+", C="+C+"\nDate:"+Date() +"\n";
Compress= Param("Compress",1,1,100,1);
TimeFrameSet(Compress* Interval()); 


Style = ParamStyle("Style", styleBar, maskAll);
HideNumbers= ParamToggle("Show 1-8 Numbers","No|Yes", 1);
/////////////////////////////////////////////////////////////////////////////////////////
// *** Buy 9 Signal ***
//9 consecutive days closes less than the Close 4 days earlier
Con = C < Ref(C, -4);
Buy9Bars = BarsSince(BarsSince(Con));
Buy9Signal = Buy9Bars==9;

// **** Perfect 9 Buy ****
//The Low of either day 8 OR 9 must be less than the lows of both days 6 AND 7.
Lowst = IIf(Ref(L, -3)<Ref(L, -2), Ref(L, -3), Ref(L, -2));//find Lowest of 6 and 7
Con1 = L < Lowst;//close of 9 < lowest
Con2 = Ref(L, -1)<Lowst;// close of 8 < lowest
Perf9Buy = Buy9Signal AND (Con1 OR Con2);
/////////////////////////////////////////////////////////////////////////////////////////
// *** Sell 9 Signal ***
//9 consecutive days closes greater than the close 4 days earlier.
Con = C >Ref(C, -4);
Sell9Bars = BarsSince(BarsSince(Con));
Sell9Signal = Sell9Bars==9;

// *** Perfect 9 Sell ***
//The high of either day 8 or 9 must be greater than the highs of both days 6 and 7.
Highst = IIf(Ref(H, -3)>Ref(H, -2), Ref(H, -3), Ref(H, -2));// find highest of 6 and 7
Con1 = H < Highst;
Con2 = Ref(H, -1)>Highst;
Perf9Sell = Sell9Signal AND (Con1 OR Con2);
/////////////////////////////////////////////////////////////////////////////////////////
if(StrToNum(NumToStr(Buy9Signal))) Sell9Signal = False;
if(StrToNum(NumToStr(Sell9Signal))) Buy9Signal = False;
BuySignal = Flip(Buy9Signal, Sell9Signal);
/////////////////////////////////////////////////////////////////////////////////////////
// *** Buy 13 Signal ***
//13 days where each close is less than or equal to the low 2 days earlier.
// Count starts after the completion of Perf9Buy
Con = C < Ref(L, -2);
Buy13Bars = Sum(Con AND BuySignal, BarsSince(Perf9Buy ));
Con = BarsSince(Perf9Buy )<BarsSince(Perf9Sell );
Buy13Signal = Buy13Bars > 13 AND Con;
// *** Perfect 13 Buy ***
//The low of day 13 must be less than or equal to the close of day 8.
Con = L <= Ref(C, -5);
Perf13Buy = Buy13Signal AND Con AND BuySignal;

/////////////////////////////////////////////////////////////////////////////////////////
// *** Sell 13 Signal ***
//13 days where each close is greater than or equal to the low 2 days earlier.
// Count starts after the completion of Perf9Sell
Con = C > Ref(L, -2);
Sell13Bars = Sum(Con AND NOT BuySignal, BarsSince(Perf9Sell ));
Con = BarsSince(Perf9Buy )>BarsSince(Perf9Sell );
Sell13Signal = Perf9Sell > 13 AND Con;
// *** Perfect 13 Sell ***
//The high of day 13 must be greater than or equal to the close of day 8.
Con = H >= Ref(C, -5);
Perf13Sell = Sell13Signal AND Con AND NOT BuySignal;

/////////////////////////////////////////////////////////////////////////////////////////
//Plotting area
Color=IIf(O >= C, colorRed, colorBrightGreen);
PlotOHLC(O, H, L, C, "", Color, Style);
PlotShapes(IIf(Buy9signal OR Sell9Signal, shapeDigit9, shapeNone),colorBlue, 0, H, 20);
if(!HideNumbers)
PlotShapes(IIf(Buy9Bars==1, shapeDigit1,
 			 IIf(Buy9Bars==2, shapeDigit2,
  			 IIf(Buy9Bars==3, shapeDigit3,
  			 IIf(Buy9Bars==4, shapeDigit4,
  			 IIf(Buy9Bars==5, shapeDigit5,
  			 IIf(Buy9Bars==6, shapeDigit6,
  			 IIf(Buy9Bars==7, shapeDigit7,
  			 IIf(Buy9Bars==8, shapeDigit8,
			 IIf(Buy9Bars >9, shapeStar,shapeNone))))))))),colorRed, 0, H, 20);
if(!HideNumbers)
PlotShapes(
 			IIf(Sell9Bars==1, shapeDigit1,
 			IIf(Sell9Bars==2, shapeDigit2,
  			IIf(Sell9Bars==3, shapeDigit3,
  			IIf(Sell9Bars==4, shapeDigit4,
  			IIf(Sell9Bars==5, shapeDigit5,
  			IIf(Sell9Bars==6, shapeDigit6,
  			IIf(Sell9Bars==7, shapeDigit7,
  			IIf(Sell9Bars==8, shapeDigit8,
			IIf(sell9bars>9, shapeStar,shapeNone))))))))),colorGreen, 0, H, 20);

PlotShapes(IIf(Sell13Bars==13 AND NOT BuySignal, shapeDownArrow, shapeNone), colorRed, 0, H, -40);
PlotShapes(IIf(Buy13Bars==13 AND BuySignal, shapeUpArrow, shapeNone), colorGreen, 0, L, -40);

i = SelectedValue(BarIndex());
PlotText(WriteIf(BuySignal, "Buy Signal\nActive:"+Buy13Bars, "Sell Signal\nActive:"+Sell13Bars), i, L[i]-(L[i]*.01), colorGold);

if(StrToNum(NumToStr(BuySignal)))
bgColor = ColorRGB(0,66, 2);
else
bgColor = ColorRGB(66,2, 0);
SetChartBkGradientFill( colorBlack, bgColor); 

_SECTION_END();
 
Trying to figure out how the shared code is related to TD Wave :confused:

BTW I find that TD Seq is giving wrong signals during a prolonged rally as we saw in pre-2008 period.
Any views or means to improve the accuracy of TD sequential will be appreciated.


Hope this will help.

HTML:
// TD Sequential Setup 
Plot( C, "Price", colorBlack, styleCandle ); 
y = ParamField("Price field"); 

Buy = Sum( y < Ref( y, -4 ), 9 ) == 9 AND Ref( y, -9) > Ref( y, -13 ); 
Sell = Sum( y > Ref( y, -4 ), 9 ) == 9 AND Ref( y, -9) < Ref( y, -13 ); 

PlotShapes( Buy * shapeUpArrow + Sell * shapeDownArrow, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, L, H ) );


//LISTING 2
// Ermanometry 
Plot( C, "Price", colorBlack, styleCandle ); 
dt = DateTime(); 
Start = dt == SelectedValue( dt ); 

EF = Param("Seed Seg EF", 48, 1, 900 ); 
DE = Param("Seed Seg DE", 40, 1, 900 ); 

Ratio = EF/DE; 
InverseRatio = 1/Ratio; 

x = BarsSince( start ); 
CD = DE * Inverseratio; 
BC = CD * Inverseratio; 
AB = BC * Inverseratio; 
FG = EF* Ratio; 
GH = FG * Ratio; 
HI = GH * Ratio; 
IJ = HI * Ratio; 

FH = sqrt( FG ^ 2 + GH ^ 2 ); 

Erman = 
x == int(FH) OR /* Erman */ 
x == int(GH) OR /* Erman */ 
x == int(HI) OR /* Erman */ 
x == int(IJ) OR /* Erman */ 
x == int(DE+EF+CD) OR /* Erman */ 
x == int(GH+HI+IJ) OR /* Erman */ 
x == int(CD+DE+EF+FG+GH+HI) OR /* Erman */ 
x == int(EF+FG+GH) OR /* Erman */ 
x == int(CD+DE+EF+FG+GH) OR /* Erman */ 
x == int(CD+DE+EF+FG+GH+HI) OR /* Erman */ 
x == int(GH+IJ+CD+AB+EF); /* Erman */ 

Plot( Erman, "Erman", colorRed, styleHistogram | styleOwnScale ); 

FH = sqrt( FG ^ 2 + GH ^ 2 ); 

Coles = 
x == int(FH+FG+GH) OR /* Coles */ 
x == int(AB+BC+CD+DE) OR /* Coles */ 
x == int(AB+BC+CD+DE+GH) OR /* Coles */ 
x == int(FG+GH) OR /* Coles */ 
x == int(GH+HI) OR /* Coles */ 
x == int(FG+BC+CD) OR /* Coles */ 
x == int(FG+BC+CD+DE) OR /* Coles */ 
x == int(CD+BC) OR /* Coles */ 
x == int(DE+BC) OR /* Coles */ 
x == int(sqrt(CD^2+DE^2)+CD+DE) OR /* Coles */ 
x == int(sqrt(EF^2+FG^2)+EF+FG); /* Coles */ 

Plot( Coles, "Coles", colorGreen, styleHistogram | styleOwnScale );
Enjoy
 


TD Sequential has uncanny abilities of pinpointing tops/bottoms in even smaller timeframes.

Posted above is a TD Sequential Sell Countdown signal on today,s Nifty Futures 5 min chart.....the countdown bars are marked and 13th bar shown by yellow arrow.

Smart_trade
 
Smarttrade you are using the code I posted some weeks ago ?
Yes, that code is very useful. Though this particular chart does not show that AFL, but that AFL is very useful. Thanks for the same.

Smart_trade
 
Hi Smarttrade,

How do you decide your exit points. I am considering using MACD for exits, any views on that?

I am also using cash segment data instead of futures (close price) to find the setup and countdown. Is it fine or its advisable only to use futures data for the triggers?

- BlackHwk
 

Similar threads