// ----------Creating a Technical Ranking System Scan - not using Watch Lists------------
// Inspired by Darren Hawkins Blogs
// Scanning for a number of patterns and assigning points for each pattern
// This is a stripped down version of patterns and points - will add more can thin out the scan list based on the Technical Rank Value
//------------Scanning for a MA12 touch------------
// Set RG1 to 30% of the last day range
RG1 = ATR(Day(PERIODAMOUNT=1), BARS=1) * 30/100;
// Set MA1 and MA2 ranges to plus/minus RG1
MA1 = MA(BARS=12, STYLE=Exponential, CALC=HL Average) + RG1 ;
MA2 = MA(BARS=12, STYLE=Exponential, CALC=HL Average) - RG1;
// Check if the High or Low falls within these ranges
H1 = (HIGH() <= MA1 and HIGH() >= MA2);
L1 = (LOW() <= MA1 and LOW() >= MA2);
// Check if any of these conditions are true
Z1 = H1 or L1;
// Set this Technical Indicator to 2 points
V1 = 2;
//------------Scan for a Gartley------------
G1 = GPS(SCANTYPE=Both) Matches;
Z2 = G1;
// Set this Technical Indicator to 2 points
V2 = 2;
//------------Scanning for Oliver's Wedge------------
W1 = SWINGSTART( OLIVERWEDGESCAN(INSIDESWING=Three) ) Matches;
Z3 = W1;
// Set this Technical Indicator to 2 points
V3 = 2;
//------------Scanning for 3 Higher Lows------------
// Check for 3 Higher Lows and the third one is noy yet confirmed -set of stairs possibility
GS1 = GANNSWING(METHOD=USE NEXT BAR);
3HL = SWINGDOWN(GS1) AND ((SWINGEND(GS1) > SWINGEND(GS1,OFFSET=2))
AND
((SWINGEND(GS1,OFFSET=2) > SWINGEND(GS1,OFFSET=4))
AND
(SWINGEND(GS1,OFFSET=1) > SWINGEND(GS1,OFFSET=3))))
AND
LOW() > (SWINGEND(GS1,OFFSET=2));
//Check both conditions are true
Z4 = 3HL;
// Set this Technical Indicator to 2 points
V4 = 2;
//------------Scan for 3 Lower Tops------------
// Check for 3 Lower Tops and the third one is not yet confirmed - set of stairs possibility
GS2 = GANNSWING(METHOD=USE NEXT BAR);
3LT = SWINGUP(GS2) AND ((SWINGEND(GS2) < SWINGEND(GS2,OFFSET=2))
AND
((SWINGEND(GS2,OFFSET=2) < SWINGEND(GS2,OFFSET=4))
AND
(SWINGEND(GS2,OFFSET=1) < SWINGEND(GS2,OFFSET=3))))
AND
SWINGEND(GS2,OFFSET=2) > HIGH();
//Check that both conditions are true
Z5 = 3LT;
// Set this Technical Indicator to 2 points
V5 = 2;
// Check that the stock has and ADX greater or equal to 20
DX = ADX(#ADX Bars:BARS=12) >= #Value:20;
//------------Only choose stocks that fit the scan criteria------------
(Z1 or Z2 or Z3 or Z4 or Z5) and DX;
//----------Add up the Technical Indicators
TECH = V1+V2+V3+V4+V5;
//------------Only select Stocks with a score of 4 or higher (This does not work)
TECH >= #Value:4;