[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RT] Re: GEN - digital pivot ela



PureBytes Links

Trading Reference Links

> robert,
> thanks for the ela and code.  This look really good.  I am playing around
> with the idea of using an average range.  What do you think?  have you
seen
> a piviot formula that used a three day average of the range?  Or 5 day?
> thanks
>
> Andrew.


That posted code could be eaily modified for an "n" day average range.
First add another input for the number of days to average.  Then change the
Rang= line to reflect the new calculation as done below for both the support
and resistance.  Use n(1) for one day, n(2) for two day, etc.  Range can be
calculated various ways, Rang=average(HighD(1) - LowD(1),n) or you could
replace that with, Rang=AvgTrueRange(n) as below.  However, the previous
day's high and low may be considered more immediately significant to day
traders than an average of n days of true range.

BobRoeske

{Resistance}
{If Pvt1 = 1 then pivot = classical pivot, else pivot = yesterday's close}
Inputs: k1(0.5),k2(0.618),k3(1.0),Pvt1(1),n(1);
Vars:   R3(0),R2(0),R1(0),Pvt(0),Rang(0),Near1(0),Near2(0);

If Pvt1=1 then
Pvt=(HighD(1)+LowD(1)+CloseD(1))/3
else
Pvt = CloseD(1);

Rang=AvgTrueRange(n);
R3=Pvt+k3*Rang;
R2=Pvt+k2*Rang;
R1=Pvt+k1*Rang;
Near1=(R1-Pvt)/2;
Near2 = (R3-R2)/2;

IF (TrueHigh>=Pvt and TrueLow<=R1-Near1)Then Plot4(Pvt,"Pvt");
IF (TrueHigh>=Pvt+near1 and TrueLow<=R1) Then Plot3(R1,"R1");
If (TrueHigh>=R1 and TrueLow<=R2) Then Plot3(R1,"R1");
If (TrueHigh>=R1 and TrueLow<=R2) Then Plot2(R2,"R2");
If(TrueHigh>=R2+Near2 and TrueLow<=R3)Then Plot1(R3,"R3");
If(TrueHigh>=R2 and TrueLow<=R3-Near2)Then Plot2(R2,"R2");
If TrueLow>=R3 then Plot1(R3,"R3");

{Support}
{Use Pvt=1 for the classical pivot or use Pvt=0 for the Close pivot}


Inputs: k1(0.5),k2(0.618),k3(1.0),Pvt1(1),n(1);
Vars:   S3(0),S2(0),S1(0),Pvt(0),Rang(0),Near1(0),Near2(0);


If Pvt1=1 then
Pvt=(HighD(1)+LowD(1)+CloseD(1))/3
else
Pvt = CloseD(1);

Rang=AvgTrueRange(n);
S3=Pvt-k3*Rang;
S2=Pvt-k2*Rang;
S1=Pvt-k1*Rang;
Near2=(S2-S3)/2;
Near1=(Pvt -S1)/2;

IF (TrueHigh>=S1+ Near1 and TrueLow<=Pvt)Then Plot1(Pvt,"Pvt");
IF (TrueHigh>=S1 and TrueLow<=Pvt-Near1) Then Plot2(S1,"S1");
If (TrueHigh>=S2 and TrueLow<=S1) Then Plot2(S1,"S1");
If (TrueHigh>=S2 and TrueLow<=S1) Then Plot3(S2,"S2");
If(TrueHigh>=S3+near2 and TrueLow<=S2)Then Plot3(S2,"S2");
If(TrueHigh>=S3 and TrueLow<=S2-Near2)Then Plot4(S3,"S3");
If TrueHigh<=S3  then Plot4(S3,"S3");