# Plotting H & L of day problem

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
Posts: 640
Joined: 09 Apr 2010
Has thanked: 411 times
Been thanked: 239 times
Contact:

### Plotting H & L of day problem

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");`

TJ
Posts: 6667
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 973 times
Been thanked: 1925 times

### Re: Plotting H & L of day problem

sptrader wrote: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);oncebegin   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 onlyend;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]

TJ
Posts: 6667
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 973 times
Been thanked: 1925 times

### Re: Plotting H & L of day problem

sptrader wrote: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.

Posts: 640
Joined: 09 Apr 2010