Page 1 of 1

Plotting H & L of day problem

Posted: 15 Nov 2011
by sptrader
I'm just trying to plot the high or low of the day, ONLY plotting from the "current" high or low.. As the study is written, it plots ALL highs and lows of the day, bar by bar.
When a new high or low happens, I'd like it to redraw(erasing previous line), from the new high or low point forward only..
I'm having a "Perry" moment and am stuck..(tried noplot, when H > hod etc) with no luck.

Code: Select all

vars:hod(0),Lod(0);

HOD= highD(0);
LOD = LOWD(0);

plot1(hod,"hi");
plot2(Lod,"Lod");

Re: Plotting H & L of day problem

Posted: 15 Nov 2011
by TJ
I'm just trying to plot the high or low of the day, ONLY plotting from the "current" high or low.. As the study is written, it plots ALL highs and lows of the day, bar by bar.
When a new high or low happens, I'd like it to redraw(erasing previous line), from the new high or low point forward only..
I'm having a "Perry" moment and am stuck..(tried noplot, when H > hod etc) with no luck.

Code: Select all

vars:hod(0),Lod(0);

HOD= highD(0);
LOD = LOWD(0);

plot1(hod,"hi");
plot2(Lod,"Lod");
it would be easier to use trendlines.

try this:

Code: Select all

var:
tl.h(-1),
tl.l(-1);

once
begin
tl.h = tl_new(d, t, 0, d, t, 0);
tl_setextright(tl.h, true);
tl_setextleft(tl.h, true); // <-- comment this out if you want forward only

tl.l = tl_new(d, t, 0, d, t, 0);
tl_setextright(tl.l, true);
tl_setextleft(tl.l, true); // <-- comment this out if you want forward only
end;

tl_setend(tl.h, d, t, highd(0));
tl_setbegin(tl.h, d[1], t[1], highd(0));

tl_setend(tl.l, d, t, lowd(0));
tl_setbegin(tl.l, d[1], t[1], lowd(0));
[note: code revised 20111115 1330]

Re: Plotting H & L of day problem

Posted: 15 Nov 2011
by TJ
I'm just trying to plot the high or low of the day, ONLY plotting from the "current" high or low.. As the study is written, it plots ALL highs and lows of the day, bar by bar.
When a new high or low happens, I'd like it to redraw(erasing previous line), from the new high or low point forward only..
I'm having a "Perry" moment and am stuck..(tried noplot, when H > hod etc) with no luck.

Code: Select all

vars:hod(0),Lod(0);

HOD= highD(0);
LOD = LOWD(0);

plot1(hod,"hi");
plot2(Lod,"Lod");
if you want to use plot,
you have to set up a counter to count how many bars since the beginning of the day.

You then create a loop,
every time a new high or a new low is made,
you have to re-plot the highd or lowd, using the loop, every bar since the beginning of the day.

Re: Plotting H & L of day problem

Posted: 15 Nov 2011
by sptrader
Thanks TJ !
It works great with trendlines !

(now I may try it with the loop)