TD Sequential strategy

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
Posts: 46
Joined: 02 May 2006

TD Sequential strategy

Postby traderwep » 03 Jun 2006


below is the TS code for the td sequential strategy. it shows up in signals but i cannot get it to show up on a chart in multicharts. it compiles but has a red check instead of a yellow one in the power editor. what does a red check mean? i do not know how to change this to an indicator. if someone does know how and could do it that would be appreciated. this is public code as you can see below. thanks, wayne at

Code: Select all

{ Tom DeMark TD Setup Long/Short Entry Strategy
   Written by: HamFon
   Date:      07/27/2002, original 07/27/2002
   Revision:   1.00
   Status:      Gnu Public License - this indicator may be used or shared freely with
            no fee, as long as this original header comment is included.
   Purpose:   Generates a Buy or Sell Short order based on conditions price trend
   Source:      Active Trader Magazine, July 2002, page 64.

{ Generates a Buy signal when:
1)  For each of the last 9 bars, the close is less than the close of the bar 4 bars earlier.
Reverse everything for Sell Short signal.

   TimeStart (0), TimeEnd (0),  { hhmm integer or 0 to ignore }
   AllowMultipleEntries (false), { blocks new trades if one already active }
   DoLong (true), DoShort (true)
variables: CountLong (0), CountShort (0);

if CurrentBar < 9 then begin
   CountLong = 0;
   CountShort = 0;
end else begin
   if C >= C[4] then CountLong = 0
   else CountLong = CountLong + 1;
   if C <= C[4] then CountShort = 0
   else CountShort = CountShort + 1;

if (AllowMultipleEntries or MarketPosition = 0)
   and (TimeStart = 0 or Time >= TimeStart) and (TimeEnd = 0 or time <= TimeEnd)
   then begin
   if DoLong and CountLong >= 9
      and (L < L[2] and L < L[3]) or (L[1] < L[2] and L[1] < L[3])
      then begin      
      Buy ("TMSetupLE") next bar at C or higher;
      Alert ("Ham TMSetup LE");
      CountLong = 0;
   if DoShort and CountShort >= 9
      and (H > H[2] and H > H[3]) or (H[1] > H[2] and H[1] > H[3])
      then begin
      Sell Short ("TMSetupSE") next bar at C or lower;
      Alert ("Ham TMSetup SE");
      CountShort = 0;

User avatar
Alex Kramer
Posts: 834
Joined: 23 Feb 2006

Postby Alex Kramer » 05 Jun 2006

Thanks for the strategy - actually, MultiCharts will support strategies soon, - but as concerns indicators, you'll realy have to look around for them, on forums etc.

Like this: ... 3-1-a.html

Here's for instance the code for TD Camouflage I found on a Dutch trading server

Code: Select all

Vars: expltr(0);

Inputs: LL(5), HH(5), RiskPerc(3);
Vars  : Stp(0);

Condition1 = Close < Close[1] and Low  = Lowest(Low,LL) and   Close >= Open and Close > Low + (Range*.5);
Condition2 = Close > Close[1] and High = Highest(High,HH) and Close <= Open and Close < Low + (Range*.5);

{--** Buy Signal  **--}
If Condition1 then begin
   Buy this bar on close;
   Stp = Low;

{--** Sell Signal  **--}
If Condition2 then begin
   Sell this bar on close;
   Stp = High;

{--** StopLoss  **--}
ExitLong at Stp * (1 - .01*RiskPerc)  stop;
ExitShort at Stp * (1 + .01*RiskPerc) stop;

Posts: 46
Joined: 02 May 2006


Postby traderwep » 05 Jun 2006

thanks for this code. i have been spending what seems like endless hours looking on the internet for demark TS code :-)

Return to “User Contributed Studies and Indicator Library”