Black Friday great discounts start today Learn more
+1 888 340 6572

Miscellaneous > PITCH 4.02 (Andrews Pitchfork Enhanced Indicator)

Article/Author: Origin: Traders2traders website. Written by Wayne Mathews

Download: pitch4.02.ela

File Includes: Indicator - PITCH 4.02 (Andrews Pitchfork Enhanced Indicator)

Category: Miscellaneous > PITCH 4.02 (Andrews Pitchfork Enhanced Indicator)

Description:

This is enhanced version of Andrews Pitchfork indicator created by Wayne Mathews.

He added a few more variables/enhancements. He made two versions-one for log scale and one for linear scale. Also he added codes for various offsets of the start point, the ability to pick letters to use for marking pivots so as not to conflict with possible ABC, added an input switch for changing alert characteristics of channels, and an input switch for changing style characteristics.

Here is a commentary made by athour:

{ ======================================
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
========================================
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Notes to Chris Cheatham version dated 2/25/01

Greg's original work is outstanding. I took it a step further and added a few more variables/enhancements. Unfortunately due to needing to organize for memory efficiency, my adoption is not as easy to follow as the original. The engine works about the same though.

Additions:
1. Made two versions -- one for log scale and one for linear scale.
2. Added codes for various offsets of the start point (point A): Offset -- "O" added to end of point A offsets point A 50% of AB distance toward B(for example, AO or A1O). Reverse Offset -- "R" added to end of point A offsets point A 50% of AB distance away from B (for example, AR or A1R). Shoulder Pattern -- "S" added to end of point A moves point A to the price of point C. (for example, AS or A1S). You don't have to add the codes to point B or point C.
3. Ability to pick letters to use for marking pivots so as not to conflict with possible ABC Elliott labels (point1, point2, point3). You must have the quotes in the input box or it will not work. Use CAPITAL letters.
4. Uses the color of the 1st point text, e.g., "A," to determine the color or the channels. Automatically colors "B" and "C" to match "A." So if you want to change the color of a set of channels, just change "A" and refresh indicator.
5. Added input switch for changing alert characteristics of channels.
6. Added input switch for changing style characteristics of channels.

Deletions:
1. Will not actually plot anything -- just draws channels.
2. No longer has the TLs connecting A to B and A to C.
3. Only allows 4 sets of channels per use, instead of 7 in original version.

Other:
1. I have noticed that on occasion with log charts, the lines will not be parallel the first time drawn. If this happens just refresh the indicator and it should be fine.
2. The log version uses 2 non-Omega user functions, Log10, and TLValueLog.
3. I have been told that neither the original nor my versions works with 2000i products. Have not tried it and not sure why.

Good Luck,
Chris Cheatham
Nchrisc@swbell.net

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

UPDATE TO VERSION 4.01:

1. Fixed Log scale need to refresh an extra time problem
2. Fixed a little bug that caused letters to continue be moved if H= C
3. Noted a difference between code and documentation on reverse offset - actually is coded as 100% of A-B instead of 50%. Upon reflection this seems better than my original intent. Did not change code.

Addendum: From Peter Ryan, Code-List 6 Apr 1999 22:27:13 +0800 "I found an error in the Andrew's Pitchfork v2 indicator posted in November. The statement "while handl > 0 begin" should read "while handl >= 0 begin"

I found that if the only objects on the chart were A, B and C, then the first object reference used is zero. The existing logic would ignore the first text label, and produce nothing."

Also by Wayne Mathews:
1. " the "for xx = 0 to 6 begin" loop to activate "TL_SetExtRight(plots[xx],true);" does not work for me in TS2K. I commented out the "SetExRight" and substituted just before the for loop code the following.

TL_SetExtRight(handla,true);TL_SetExtRight(handlb,true);
TL_SetExtRight(handlc,true);
TL_SetExtRight(handlb1,true);TL_SetExtRight(handlb2,true);
TL_SetExtRight(handlc1,true);TL_SetExtRight(handlc2,true);"

2. The line "if vv[jj,ii] > mpt then begin" should read "if vv[jj,ii] > C then begin"

3. To more easly read the code

vv2[0,ii] = iff(codea[0,ii] = "O", vv[0,ii] /2 + vv[1,ii] /2, iff(codea[0,ii] = "R",
vv[0,ii] + iff(vv[0,ii] >vv[1,ii] , 1,-1) * AbsValue(vv[0,ii] - vv[1,ii] ) ,
iff(codea[0,ii] = "S", vv[2,ii], vv[0,ii]))) ;

I have rewritten it as (but not substituted it here)

if codea[0,ii] = "O" then
vv2[0,ii]= (vv[0,ii] + vv[1,ii] ) /2
else
if codea[0,ii]="R" then
if vv[0,ii]>vv[1,ii] then
vv2[0,ii]= vv[0,ii]+1* AbsValue(vv[0,ii]- vv[1,ii] )
else
vv2[0,ii]= vv[0,ii]+(-1* AbsValue(vv[0,ii]- vv[1,ii]))
else
if codea[0,ii]="S" then
vv2[0,ii]= vv[2,ii]
else
vv2[0,ii]= vv[0,ii];}

Usage:

Set Plot1 and Plot2 to be large points. Note that the trendlines use the default trendline settings

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)

Use Median to add median lines

Set MyColor (below) to be the colors for each Pitchfork




Inputs:

Median - use it to add median lines
Beep - sets the alert status for the specified trendline:
0 = no alert
1 = Breakout Intrabar alert
2 = Breakout on Close alert
Thick - sets the width (line thickness) setting for the specified trendline object: Thickness widths range from 0 (the thinnest) to 6 (the thickest)
Style - sets the line style setting for the specified trendline:
1 (solid)
2 (dashed)
3 (dotted)
4 (dashed pattern)
5 (dashed pattern)
Point1 - label of swing high/low
Point2 - label of swing high/low
Point3 - label of swing high/low

EasyLanguage Code:
INPUT:   MEDIAN(1), BEEP(0), THICK(0), STYLE(0),  POINT1("A"), POINT2("B"), POINT3("C");


IF CURRENTBAR = 1 THEN BEGIN
ARRAY:ABC[3]("");
ABC[0] = POINT1; ABC[1] = POINT2; ABC[2] = POINT3;

ARRAY:NUMS[4]("");
NUMS[0] = ""; NUMS[1] = "1"; NUMS[2] = "2"; NUMS[3] = "3";
END;

ARRAY:CODE[4]("");
CODE[0] = ""; CODE[1] = "S"; CODE[2] = "O"; CODE[3] = "R";

ARRAY:DD[3,4](0),TT[3,4](0),VV[3,4](0),BB[3,4](0),HH[3,4](0), VV2[3,4](0), PLOTS[7](0) ,

CODEA[3,4]("");
VAR: FVV(0), PVV(0), FBB(0), PBB(0), PVV2(0),PVVB(0), PVVC(0), II(0), JJ(0) , KK(0), XX(0) ;
VAR: HANDL(0), HANDLA(0), HANDLB(0), HANDLC(0), HANDLB1(0), HANDLC1(0), HANDLB2(0), HANDLC2(0),

SS("") ;


IF CURRENTBAR = 1 THEN BEGIN
HANDL = TEXT_GETFIRST(2);
WHILE HANDL >= 0 BEGIN
SS = TEXT_GETSTRING(HANDL);
FOR II = 0 TO 3 BEGIN
FOR JJ = 0 TO 2 BEGIN
FOR KK = 0 TO 3 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;
CODEA[JJ,II] = RIGHTSTR(TEXT_GETSTRING(HH[JJ,II] ),1) ;

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;

IF VV[JJ,II] > C THEN BEGIN
VV[JJ,II] = H;
TEXT_SETLOCATION(HH[JJ,II],DD[JJ,II],TT[JJ,II],H);
TEXT_SETSTYLE(HH[JJ,II],2,1);
TEXT_SETCOLOR(HH[JJ,II],TEXT_GETCOLOR(HH[0,II]));
END ELSE BEGIN
VV[JJ,II] = L;
TEXT_SETLOCATION(HH[JJ,II],DD[JJ,II],TT[JJ,II],L);
TEXT_SETSTYLE(HH[JJ,II],2,0);
TEXT_SETCOLOR(HH[JJ,II],TEXT_GETCOLOR(HH[0,II]));
END;

IF C<>C THEN PLOT1(VV[JJ,II],"SELECTION");

VV2[0,II] = IFF(CODEA[0,II] = "O", VV[0,II] /2 + VV[1,II] /2, IFF(CODEA[0,II] = "R",
VV[0,II] + IFF(VV[0,II] >VV[1,II] , 1,-1) * ABSVALUE(VV[0,II] - VV[1,II] ) ,
IFF(CODEA[0,II] = "S", VV[2,II], VV[0,II]))) ;

IF JJ = 2 THEN BEGIN

FBB = BB[1,II] / 2 + BB[2,II] / 2;

FVV = VV[1,II] / 2 +VV[2,II] / 2;
PVV = TLVALUE(VV2[0,II],BB[0,II],FVV,FBB,CURRENTBAR);
PVVB =TLVALUE(VV[1,II],BB[1,II], FVV + VV[1,II] - VV2[0,II]

,FBB+BB[1,II]-BB[0,II],CURRENTBAR);
PVVC = TLVALUE(VV2[0,II] - (FVV - VV[2,II] ) ,

BB[0,II]+(BB[2,II]-FBB),VV[2,II],BB[2,II],BB [1,II]);


HANDLA = TL_NEW(DD[0,II],TT[0,II], VV2[0,II],DATE,TIME,PVV);
HANDLB = TL_NEW(DD[1,II],TT[1,II],VV[1,II],DATE,TIME,PVVB);
HANDLC = TL_NEW(DD[1,II],TT[1,II],PVVC,DATE,TIME,VV[2,II]);

IF MEDIAN = 1 THEN BEGIN
HANDLB1 = TL_NEW(DD[1,II],TT[1,II], VV[1,II] - (VV[1,II]- PVVC)/4, DATE,TIME, PVVB - (PVVB

- VV[2,II])/4 ) ;
HANDLB2 = TL_NEW(DD[1,II],TT[1,II], VV[1,II] + (VV[1,II] - PVVC)/4 , DATE,TIME, PVVB+ (PVVB

- VV[2,II])/4 ) ;
HANDLC1 = TL_NEW(DD[1,II],TT[1,II], PVVC+ (VV[1,II] -PVVC)/4, DATE,TIME, VV[2,II] + (PVVB

- VV[2,II] )/4) ;
HANDLC2 = TL_NEW(DD[1,II],TT[1,II], PVVC-(VV[1,II] -PVVC)/4, DATE,TIME, VV[2,II]- (PVVB -

VV[2,II] )/4);
END;

PLOTS[0] = HANDLA;
PLOTS[1] = HANDLB;
PLOTS[2] = HANDLC;
PLOTS[3] = HANDLB1;
PLOTS[4] = HANDLB2;
PLOTS[5] = HANDLC1;
PLOTS[6] = HANDLC2;


TL_SETEXTRIGHT(HANDLA,TRUE);TL_SETEXTRIGHT(HANDLB,TRUE);
TL_SETEXTRIGHT(HANDLC,TRUE);
TL_SETEXTRIGHT(HANDLB1,TRUE);TL_SETEXTRIGHT(HANDLB2,TRUE);
TL_SETEXTRIGHT(HANDLC1,TRUE);TL_SETEXTRIGHT(HANDLC2,TRUE);


FOR XX = 0 TO 6 BEGIN
TL_SETSTYLE(PLOTS[XX],STYLE);
TL_SETSIZE(PLOTS[XX],THICK);
TL_SETALERT(PLOTS[XX],BEEP);
{ TL_SETEXTRIGHT(PLOTS[XX],TRUE);
} TL_SETCOLOR(PLOTS[XX] , TEXT_GETCOLOR(HH[JJ,II]));
END;
END;
END;
END;
END;