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

Plotting horiz lines w/o screwing up scaling



PureBytes Links

Trading Reference Links

Hello omegaList,

  A few months ago  there was some discussion of ways to plot
horizontal lines on an intraday chart, such as yesterday's high and
low or floor pivots whithout having lines from previous days screw up
the scaling.  I borrowed pieces from various posts and put together my
own set of pivot lines.  the plotting technique would work for other
line indicators as well.  I've set an input to allow you to show all
the lines for the current day or only when price comes within x points
of the line.  I use FutureSource so the point value are large; other
data vendor will require a number smaller probably by a factor of 100.

{Jim Johnson, May, 2001. Use with *Pivot 1x.}

Inputs: Pts(300), Showall(false);
Vars: pHigh(0), pLow(99999), Pivot(0), Support1(0), Support2(0), pC(0), Resist1(0), Resist2(0), FirstDate(0);

If CurrentBar = 1 then FirstDate = Date;

If time = Sess1StartTime + BarInterval then begin
        pHigh = High;
        pLow = Low;
end;

If High > pHigh then pHigh = High;
If Low < pLow then pLow = Low;

If Time = Sess1Endtime then begin
        pC = Close;
        Pivot = (pHigh + pLow + pC)/3;
        Support1 = (pivot*2) - pHigh;
        Resist1 = (pivot*2) - pLow;
        Support2 = Pivot - (Resist1 - Support1);
        Resist2 = (Pivot - Support1) + Resist1;
end;


If Showall = false then begin
If Date >= LastCalcDate then begin
        If (Support2[1] + Pts) > L then
                Plot1(Support2[1], "Support2");
        If (Resist2[1] - Pts) < H then
                Plot2(Resist2[1], "Resistance2");
end;
End;

If Showall = true then begin If Date >= LastCalcDate then begin {If
(Support2[1] + Pts) > L then}                 Plot1(Support2[1],
"Support2");         {If (Resist2[1] - Pts) < H then}
Plot2(Resist2[1], "Resistance2"); end; End;


{\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\}

 {Jim Johnson, May, 2001. Use
with *Pivot 2x}

If time = Sess1StartTime + BarInterval then begin
        pHigh = High;
        pLow = Low;
end;

If High > pHigh then pHigh = High;
If Low < pLow then pLow = Low;

If Time = Sess1Endtime then begin
        pC = Close;
        Pivot = (pHigh + pLow + pC)/3;
        Support = (pivot*2) - pHigh;
        Resist = (pivot*2) - pLow;
end;

If Showall = false then begin
If Date >= LastCalcDate then begin
        If (Support[1] + Pts) > L  then
                Plot1(Support[1], "Support");
        If (Resist[1] - 1.2*Pts) < H then
                Plot2(Resist[1], "Resistance");
        If ( L-Pivot[1]  < 1.2*Pts) or (H - Pivot[1] < Pts)  then
        Plot3(Pivot[1], "Pivot");
end;
End;

If Showall = true then begin
If Date >= LastCalcDate then begin
        {If (Support[1] + Pts) > L  then}
                Plot1(Support[1], "Support");
        {If (Resist[1] - 1.2*Pts) < H then}
                Plot2(Resist[1], "Resistance");
        {If ( L-Pivot[1]  < 1.2*Pts) or (H - Pivot[1] < Pts)  then}
        Plot3(Pivot[1], "Pivot");
end;
End;


-- 
Best regards,
 Jim Johnson                        mailto:jejohn@xxxxxxxxx