Identifying Double Tops

#46583

Trevor R
  • Topics: 11
  • Replies: 17
  • Posts: 28

Identifying Double Tops

Hi David,

I’ve been doing a bit of pattern evaluation and developed the following scripts for identifying what I call “Consecutive Double Tops” and “Non-Consecutive Double Tops” over the life of a market.

To explain, “Consecutive Double Tops” are swing tops that have no lower swing tops between them and “Non-Consecutive Double Tops” have at least one lower swing top between the “Double Top”. I use percent higher/lower parameter for the determining if a “Double Top” exists, say the latest top is 0.5% higher than the earlier top. I haven’t found a way to use a market’s tick size for the high/low parameter, but have found the percentage approach works on all the markets I’ve tried. You’ll find a sample of the results of my pattern evaluations at Auld Tyma Data under Reports & Tools > Market Analysis Reports > Chart Pattern Evaluations.

So here are my scripts:

“Consecutive Double Tops”

// Setup Signal – SHORT Entry ~ Double Top 1-Day Swing ~ 2ndTop 0.5% Higher 1 Down

// Setup Signal:
//         1 Day Gann Swing
//         Double Top with
//                  2nd Top between 0% and 0.5% greater than the 1st Top
// Short Entry Signal:
//         1 Down Bar, Low lower than Signal Bar Low and High greater than or equal to Signal Bar Low, ie no gap

// Gann Swing 1 Day
GS1 = SWINGEND(GANNSWING(METHOD=Use Next Bar, DAY(PERIODAMOUNT=1),SWINGCOUNT=1, DEFAULT=SwingEnd, USEINSIDE=False, USECLUSTERS=True, USEBREAKOUT=True));

// Identify Swing Top
1stTop = GS1 > GS1[1];

// Double Top with consecutive previous swing top
2ndTop = OFFSET(GS1, OFFSET=2);

// % ratio Top to previous Top
TopRatio = (GS1 * 1stTop – 2ndTop)/((GS1 * 1stTop+ 2ndTop)/2)*100;

//+++ Down Entry Bar
// Use the following for highlighting the Entry Bar with no gap, allow outside bar
DownBar0 = (LOW(0) < LOW(1)) AND (HIGH(0) >= LOW(1) );

//++++++++++++++++++++++
// Identify Tops when 2nd Top Greater than Previous Top
DoubleTopSetupSignal = TopRatio >= 0 and TopRatio <= 0.5 AND (TIMESINCESIGNAL(GS1Top)<1);

DoubleTopSetupSignal

 

Here’s what the “Consecutive Double Tops” looks like, the cyan plot is the Weekly Gann Swing:

Daily Swing Double Top

“Non-Consecutive Double Tops”

// Setup Signal – SHORT Entry ~ Double Top 1- WEEK Not Consecutive Swing ~ 2nd Top 0 to 0.5% Above 1st Top

// Setup Signal:
//         Weekly Gann Swing Chart
//         Double Top with:
//                 1st Top preceded and succeeded by Lower Swing Tops
//                 2nd Top preceded by Lower Swing Top and succeeded by a Down Bar
//                 2nd Top between 0% and 0.5% above the 1st Top
// Short Entry Signal
//                 1 Down Bar, High higher than Bar High and Low less than or equal to Bar High, ie no gap

// Gann Swing 1 Week
GS1 = GANNSWING(WEEK(PERIODAMOUNT=1), METHOD=Use Next Bar, SWINGCOUNT=3, USECLUSTERS=False, USEBREAKOUT=False, USEINSIDE=False, DEFAULT=SwingList);
GS1End = SWINGEND(GS1);

// +++++ Identify Swing Top of Double Top
// Succeeding Lower Top
SucLoTop = GS1End[0] > GS1End[-2] AND GS1End[-1] < GS1End[-2];

// Preceding Lower Top
PreLoTop = GS1End[0] > GS1End[2] AND GS1End[1] < GS1End[2] ;

// Identify 2nd Swing Top
Top = SucLoTop AND PreLoTop;

// 2nd Top Signal
2ndTopSignal = Top AND (TIMESINCESIGNAL(Top) < 1);
Top2Signal = PreLoTop AND LOW(0) > Low(-1) AND (TIMESINCESIGNAL(GS1End)<1);

// +++++ Idenifty 1st Top of Double Top, ie the Top preceding 2nd Top Signal
// use IF() to give the High at the Signal (2ndTopSignal) and fill the other positions with zero
2ndTopValue = If(2ndTopSignal > 0, PriceAtSignal(2ndTopSignal, PRICE=High), 0);

// Use NonZero() to shrink the GS2ndTopValue list by removing the zeros so it can use Offset() to find the next / previous signal
2ndTopNonZero = NONZERO(2ndTopValue);

// Determine the 1st Top Signal
1stTopSignal = (TIMESINCESIGNAL(2ndTopNonZero) < 1 AND TIMESINCESIGNAL(2ndTopNonZero) > -1) AND (2ndTopNonZero <= OFFSET(2ndTopNonZero, OFFSET=-1) or 2ndTopNonZero > OFFSET(2ndTopNonZero, OFFSET=-1) );

// Double Top Prices
1stTopValue = PRICEATSIGNAL(1stTopSignal, PRICE=High);
Top2Value = PRICEATSIGNAL(Top2Signal, PRICE=High);

// % range between 1st Top and 2nd Top
DoubleTopRatio = 100 * (Top2Value – 1stTopValue[1]) / 1stTopValue[1];

// Test if Top Ratio in range 0 to 0.5
DoubleTop = If(Top2Signal AND DoubleTopRatio >= 0 AND DoubleTopRatio < 0.5 , 1, 0);

// Identify Tops when 2nd Top Greater than Previous Top
DoubleTopSignal = IF(GS1End > GS1End[1] AND DoubleTop, 1, 0);

DoubleTopSignal

 

Here’s what the “Non-Consecutive Double Tops” looks like, the cyan plot is the Weekly Gann Swing:

Weekly Swing Double Top

 

Hope you find this useful.

Cheers

Trevor

Pin It on Pinterest

Share This

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close