**Article/Author:**Origin: Traders2traders website. Modified by Chris Cheatham, 11/11/2001. Originally coded by Gregory Wood.

**Download:**andb1101.ela

**File Includes:**

Indicator - AndrewsBabson Lin 2 (Pitchfork indicator)

Indicator - AndrewsBabson Log 2 (Pitchfork indicator)

Function - TLValueLog

Function - MPT

Function - Log10

**Category:**Miscellaneous > AndrewsBabson Lin 2 (Pitchfork indicator)

**Description:**

The Andrews' Babson Pitchfork is a set of chart lines drawn at uncommon places on a price chart. When linked together, the arrangement of lines closely resembles a farmer's pitchfork.

Here are commentaries made by authors of the study:

{ Notes to Chris Cheatham November 11, 2001 3rd revision of Gregory Woods Andrews pitchfork code Additions, Deletions, etc.:

1. Much of code has been rewritten to shrink size, permit more options in TS4.

2. Made selected major pitchfork lines thicker.

3. Expansion codes (BX codes) have been revised. X1 and X2 are the same as before. X3 now adds expansions below main pitchfork. X4 now adds expansions above main pitchfork. Added X5 for even bigger expansions below, and X6 for even bigger expansions above.

4. Add "X4" code for "semi-Schiff" pitchfork. If you use AX4, A1X4, etc. the start point will be 1/4 of the AB distance, instead of 1/2 for a Schiff pitchfork.

5. For Babson channels, moved the "handle" to show the origin of the channel. For example, using an AB Babson code the long handle line will connect A and B, rather than being the median line previously.

Enjoy,

Chris Cheatham

11/11/01

}

{ Notes to Chris Cheatham July 15, 2001 2nd revision of Gregory Woods Andrews pitchfork code

Major Additions, Deletions, etc.:

1. Separate linear scale and log scale versions.

2. TS2000i compatible.

3. Only allows 4 pitchforks due to TS4 code size limitations.

4. Added code to make Schiff offset starting point for pitchfork. To do this, instead of using "A" or "A1", etc. use "AX3", "A1X3".

5. Added code so as not to require capital letters.

6. Added inputs for colors.

7. Deleted "AB" and "AC" line segments.

8. Added Shoulder Pattern code. Think of this as the opposite of the Schiff offset. If you use "AX1","A1X1", etc. the pitchfork angles will be shifted such that the 1/4 divider line comes out of the starting point, rather than the median line. (the median (middle) line is the 1/2 divider.)

9. Added steeper Shoulder Pattern code.. Sometimes shifting from a basic pitchfork (A, B, C) to X1 code (AX1, B, C) still does not create a steep enough angle to fit market activity. If you use "AX2, B, C", the angles will be shifted such that a theoretical 1/8 divider line comes from the "A" point, instead of the 1/4 divider in the case of "AX1, B, C".

11. Added code for subdivision lines. If you add "X1" to the "B" code, as in" BX1" additional divider lines will be drawn at the midpoint of the other lines.

12. Added code for expansion lines. "BX2", instead of "BX1" adds addtional lines outside of the existing pitchfork, instead of inside for "X1" code.

13. Added code for wider expansion lines. "BX3", instead of "BX2" moves the expansion lines further out than "BX2".

14. Added "CX" codes. The idea of "CX" codes is to permit you to anticipate the "C" point based on knowing the median line (1/2 divider) , the 1/4 divider line or the 3/4 divider line. "CX2" causes the pitchfork to be drawn in such a way that the "CX2" point is the median line, rather than the "C" pitchfork line. Likewise, a point you label "CX1" will be the 1/4 divider line, and the remainder of the pitchfork will be drawn accordingly. A point you label "CX3" will be the 3/4 divider line. These codes can be combined with the various "A" codes for pitchfork variations also.

15. Added code to also draw Babson channels. If you use "AB, B, C" a line will be drawn from "A" to "B", with corresponding parallel Babson channel lines drawn accordingly. Likewise, if you use "AC, B, C" a line will be drawn from "A" to "C", with corresponding parallel lines. Remember that the "C" point must ALWAYS come after the "A" and "B" points for all tools. Either "A" or "B" points may come first.

16. Hint for ease of use: Buy a windows macro program such as macro express (macros.com, about $30) write some simple little keystroke macros like 1. typing the A,B,C, A1,B1,C1, etc. on the chart, and 2. Automatically refreshing ( turn status off and on again). MUCH more efficient.

Many thanks to Gregory Woods for his outstanding original code.

Regards,

Chris Cheatham

nchrisc@swbell.net

chrischeatham@yahoo.com

}

{ ======================================

This is my implementation of some aspects of Andrews Pitchforks. You are welcome to use this code freely. You may redistribute it provided you include this comment block, plus a description of any changes you make.

If you extend it, or adapt it to other uses, I'd appreciate a look at what you've done. Thanks.

Gregory Wood

SwissFranc@worldnet.att.net

12/18/96 v1.0 - Initial distribution

01/08/96 v1.1 - Added median lines

01/15/96 v1.2 - Added TL_Thick, user-customizable colors (see "SET COLORS HERE")

01/16/96 v1.3 - Removed projections to make room for up to 7 pitchforks

========================================}

**Usage:**

SETUP

Set Plot1 and Plot2 to be large points. ( CC note -- this is no longer applicable). Note that the trendlines use the default trendline settings

USAGE

Use the text tool to label swing high/lows with "A", "B" and "C", then refresh the indicator (clicking "Status" twice causes the indicator to recalculate). Be sure to put the label above the bar's high for a swing high, and below the low for a swing low.

You can display other groups of points by using labels "Ax", "Bx" and "Cx", where 'x' is 1, 2, or 3, e.g. "A3", "B3", "C3".

Note that you can use the pointer tool to move the points anytime. Then to view the new Pitchfork, refresh the indicator.

Use the Proj values to place a dot at a time expansion. Try values like .618, 1.0, 1.618 etc. Then use Diff to control how near the dot needs to be to the close for it to be seen. (This keeps the chart from shrinking.( CC note -- this is no longer applicable)

Use Median to add median lines. ( CC note -- this is no longer applicable)

Set MyColor (below) to be the colors for each Pitchfork ( CC note -- this is no longer applicable)}

**Inputs:**

Color1, Color2, Color3, Color4 - are the colors for each pitchfork.

**EasyLanguage Code:**

INPUT: COLOR0(TOOL_DARKGREEN), COLOR1(TOOL_BLUE), COLOR2(TOOL_DARKGRAY), COLOR3(TOOL_RED) ;

ARRAY:DD[3,4](0),TT[3,4](0),VV[3,4](0),BB[3,4](0),HH[3,4](0) , PLOTS[13](0), TEXTSTRG[3,4]("") ,

ABC[3]("") , NUMS[4]("") , CODE[9]("") , MYCOLOR[4](0), PVALUE[13](0) ;

VAR: II(0), JJ(0), KK(0), XX(0), YY(0), HANDL(0), SS(""), CXNUM(4), AENDP(0), AENDB(0) , AATC(0),

AATB(0), ASNUM(0) ,BCDIFVV(0), BCDIFBB(0) , BATC(0), CATB(0), CATC(0), NEWA(0) , VV4THS(0), VV8THS(0) ,

VVBAB(0), VVBAB2(0) , DDTTVAL(0) , PVALUE1(0), PHEIGHT(0), STYLESET(0), STYLEFAT(0) ;

IF CURRENTBAR = 1 THEN BEGIN

ABC[0] = "A"; ABC[1] = "B"; ABC[2] = "C"; NUMS[0] = ""; NUMS[1] = "1"; NUMS[2] = "2"; NUMS[3] = "3";

CODE[0] = ""; CODE[1] = "X1"; CODE[2] = "X2"; CODE[3] = "X3"; CODE[4] = "B" ; CODE[5] = "C";

CODE[6] = "X4"; CODE[7] = "X5"; CODE[8] = "X6";

MYCOLOR[0] = COLOR0; MYCOLOR[1] = COLOR1; MYCOLOR[2] = COLOR2; MYCOLOR[3] = COLOR3;

PVALUE[0] = 0; PVALUE[1] = .5; PVALUE[2] = -.5; PVALUE[3] = .25; PVALUE[4] = .75; PVALUE[5] = -.25;

PVALUE[6] = -.75; PVALUE[7] = .125; PVALUE[8] =.375; PVALUE[9] =.625; PVALUE[10] = -.125;

PVALUE[11] = -.375; PVALUE[12] = -.625;

HANDL = TEXT_GETFIRST(2);

WHILE HANDL >= 0 BEGIN

SS = UPPERSTR(TEXT_GETSTRING(HANDL));

FOR II = 0 TO 3 BEGIN FOR JJ = 0 TO 2 BEGIN FOR KK = 0 TO 8 BEGIN

IF SS = ABC[JJ] + NUMS[II] + CODE[KK] THEN BEGIN

TT[JJ,II] = TEXT_GETTIME(HANDL); DD[JJ,II] = TEXT_GETDATE(HANDL);

VV[JJ,II] = TEXT_GETVALUE(HANDL); HH[JJ,II] = HANDL;

END; END; END; END;

HANDL = TEXT_GETNEXT(HANDL,2);

END; END;

FOR II = 0 TO 3 BEGIN FOR JJ = 0 TO 2 BEGIN

IF TIME = TT[JJ,II] AND DATE = DD[JJ,II] THEN BEGIN

BB[JJ,II] = CURRENTBAR;

TEXTSTRG[JJ,II] = UPPERSTR(TEXT_GETSTRING(HH[JJ,II]));

TEXT_SETLOCATION(HH[JJ,II],DD[JJ,II],TT[JJ,II],IFF(VV[JJ,II] > MPT,H,L));

VV[JJ,II] = TEXT_GETVALUE(HH[JJ,II]);

TEXT_SETSTYLE(HH[JJ,II],2,IFF(VV[JJ,II] > MPT,1,0));

TEXT_SETSTRING(HH[JJ,II],TEXTSTRG[JJ,II]);

TEXT_SETCOLOR(HH[JJ,II],MYCOLOR[II]);

IF JJ = 2 THEN BEGIN

IF INSTR(TEXTSTRG[0,II], "X3")>0 THEN VV[0,II]= (VV[0,II] + VV[1,II])/2;

IF INSTR(TEXTSTRG[0,II], "X4")>0 THEN VV[0,II]= VV[0,II] - (VV[0,II] - VV[1,II])/4 ;

CXNUM = IFF( INSTR(TEXTSTRG[2,II], "X")>0, STRTONUM(RIGHTSTR(TEXTSTRG[2,II],1)), 4) ;

ASNUM = IFF( INSTR(TEXTSTRG[0,II], "X2")>0, 8, IFF( INSTR(TEXTSTRG[0,II], "B")>0, 99999,

IFF( INSTR(TEXTSTRG[0,II], "C")>0, 1, IFF( INSTR(TEXTSTRG[0,II], "X1")>0, 4, 2) ) ) ) ;

BCDIFVV = 4/CXNUM * (VV[1,II] - VV[2,II]) ; BCDIFBB = 4/CXNUM *(BB[1,II] - BB[2,II]) ;

AENDP = VV[1,II] - BCDIFVV/ASNUM ; AENDB = BB[1,II] - BCDIFBB/ASNUM;

AATC = TLVALUE(VV[0,II],BB[0,II],AENDP, AENDB,CURRENTBAR);

AATB = TLVALUE(VV[0,II],BB[0,II],AENDP, AENDB,BB[1,II]);

BATC = AATC-(AATB-VV[1,II]) ;

CATB = VV[1,II] - 4/CXNUM*(BATC-VV[2,II]) ;

CATC = BATC - 4/CXNUM*(BATC-VV[2,II]) ;

AATB= (VV[1,II]+CATB)/2 ;

AATC= (BATC+CATC)/2 ;

NEWA = TLVALUE( AATB, BB[1,II] , AATC, BB[2,II], BB[0,II]);

PHEIGHT = ABSVALUE(BATC-CATC) ;

FOR XX = 0 TO IFF(INSTR(TEXT_GETSTRING(HH[1,II] ), "X")>0,12,6) BEGIN

VVBAB=0; PVALUE1 = PVALUE[XX];

IF INSTR(TEXT_GETSTRING(HH[1,II] ), "X")>0 THEN BEGIN

VVBAB = (STRTONUM( RIGHTSTR( TEXT_GETSTRING( HH[1,II]),1)));

IF VVBAB>1 AND XX >6 THEN PVALUE1 = SIGN(PVALUE[XX]) * (ABSVALUE(PVALUE[XX])+.875);

IF VVBAB= 6 AND XX>2 THEN PVALUE1 = 1+(XX-3)/2;

IF VVBAB= 5 AND XX>2 THEN PVALUE1 = -1-(XX-3)/2;

IF VVBAB=3 THEN BEGIN IF XX= 4 THEN PVALUE1 = -1.75; IF XX= 7 THEN PVALUE1 = -2;

IF XX=8 THEN PVALUE1 = -2.25; IF XX= 9 THEN PVALUE1 = -2.5; END;

IF VVBAB=4 THEN BEGIN IF XX= 6 THEN PVALUE1 = 1.75; IF XX= 10 THEN PVALUE1 = 2;

IF XX=11 THEN PVALUE1 = 2.25; IF XX= 12 THEN PVALUE1 = 2.5; END;

END;

PLOTS[XX] = TL_NEW(DD[1 ,II],TT[1 ,II], AATB + PHEIGHT*PVALUE1 , DATE,TIME, AATC + PHEIGHT*PVALUE1) ;

TL_SETALERT(PLOTS[XX],0); TL_SETCOLOR(PLOTS[XX] ,MYCOLOR[II] );

STYLESET = 0;

IF VVBAB=0 AND XX>2 THEN BEGIN

STYLESET = 1; END ELSE BEGIN

IF (VVBAB=3 OR VVBAB=4) AND ( XX=3 OR XX=4 OR XX=5 OR XX=6 OR XX=8 OR XX=11) THEN BEGIN

STYLESET = 1; END ELSE BEGIN

IF VVBAB=1 AND XX>6 THEN BEGIN

STYLESET = 1; END ELSE BEGIN

IF VVBAB=2 AND (( XX>2 AND XX<7) OR (XX=8 OR XX =11) ) THEN

STYLESET = 1; END; END; END;

IF STYLESET = 1 THEN TL_SETSTYLE(PLOTS[XX] ,2);

STYLEFAT = 0;

IF (XX>= IFF( ASNUM=99999,1,IFF(ASNUM=1,1,0)) AND XX <= 2) THEN BEGIN

STYLEFAT = 1; END ELSE BEGIN

IF (VVBAB=3 OR VVBAB=4) AND ( XX=12 OR XX=9 ) THEN BEGIN

STYLEFAT = 1; END ELSE BEGIN

IF VVBAB=2 AND (XX=9 OR XX =12 ) THEN BEGIN

STYLEFAT = 1; END ELSE BEGIN

IF (VVBAB=5 OR VVBAB=6) AND ( XX=4 OR XX=6 OR XX = 8 OR XX = 10 OR XX=12) THEN

STYLEFAT = 1; END; END; END;

IF STYLEFAT = 1 THEN TL_SETSIZE(PLOTS[XX] ,1);

END;

IF BATCTHEN ASNUM = IFF(ASNUM=99999,1, IFF(ASNUM=1,99999,ASNUM));

IF BB[0,II] < BB[1,II] THEN

TL_SETBEGIN(PLOTS[IFF(ASNUM = 99999,1, IFF(ASNUM = 1,2,0))],DD[0,II],TT[0,II],

IFF(ASNUM = 99999 OR ASNUM = 1,VV[0,II],NEWA)) ;

END; END; END; END;

IF C<> C THEN PLOT1(C,"C");