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

Re: Pivot points



PureBytes Links

Trading Reference Links

> As some of you will have seen there is an article on Pivot points in the
> Omega research magazine which whilst not telling me anything new it did
> get me thinking about plotting the levels on my intraday chart.  Can't
> quite see the point of putting them on a daily chart as they have it in
> the article so I thought I would code them to be shown on a five min
> chart.
> 
> The following is what I came up with....
> 
> 
> Firstly :
> 
> {Function to calculate the Pivot point which I just changed the TS Typical
> Price Function}
> 
> TypicalPriceID = (HighD(1)+LowD(1)+CloseD(1))/3;

What is this (HighD etc.)?  I have no such functions.
I wrote some code to plot the pivot points on an intraday chart some time ago, and have copied 
it below.  It works reliably.  It has a feature which ensures that only pivots within a point range 
defined by the 'zoom' input from the current price are plotted,  which avoids compression of the 
actual prices into a small area of the chart.

It is important to remember to set the Scaling to Price, rather than Screen, or the lines will be 
plotted in the wrong place on the screen, even though the values have been calculated correctly 
by the code.
 
Bob Young

------------------------------------------------------------------------------------
{INDICATOR: Pivots}
input: zoom(2.5);
var: pp(0),r1(0),r2(0),s1(0),s2(0),hy(0),ly(0),cy(0),ih(0),il(0),t1(0),t2(0),t3(0),t4(0),t5(0);

if date <> date[1] then begin
	hy = ih;
	ly = il;
	ih = high;
	il = low;
	cy = close[1];
	pp = (hy+ ly + cy) / 3;
	r1 = 2*pp - ly;
	s1 = 2*pp - hy;
	r2 = pp - s1 + r1;
	s2 = pp - r1 + s1;
	print(hy,ly,cy,pp,r1,r2,s1,s2);
end;

if high > ih then ih = high;
if low < il then il = low;


if cy<>0 and hy<>0 and ly<>0 then begin
	t1 = absvalue(close - pp);
	if t1 < zoom then plot1(pp,"PP");

	if close > pp then begin
		t2 = absvalue(close - r1);
		t3 = absvalue(close - r2);
		if t2 < zoom then plot2(r1,"RS1");
		if t3 < zoom then plot3(r2,"RS2");
	end;

	if close < pp then begin
		t4 = absvalue(close - s1);
		t5 = absvalue(close - s2);
		if t4 < zoom then plot2(s1,"RS1");
		if t5 < zoom then plot3(s2,"RS2");
	end;
end;