From past history I calculate a projected retracement area from the current upswing and I need it to be redrawn every time this upswing has a new high. The problem I do not know how to solve is how to erase the old plot when a new upswing high is happening - I need to see only the current projected area, not all of them.
I tried in vain with noplot in a loop. Please help.
erasing and redrawing a retracement area square [SOLVED]
- TJ
- Posts: 7740
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2221 times
Re: erasing and redrawing a retracement area square
Please draw a diagram(s) to illustrate what you would like to do.From past history I calculate a projected retracement area from the current upswing and I need it to be redrawn every time this upswing has a new high. The problem I do not know how to solve is how to erase the old plot when a new upswing high is happening - I need to see only the current projected area, not all of them.
I tried in vain with noplot in a loop. Please help.
Please post your code.
Re: erasing and redrawing a retracement area square
Thanks for your reply.
Here is a picture of my chart:
http://screencast.com/t/AHvAuIge65o
The green area squares are drawn each time a new high in the upswing happens.
I need only the latest ones in the upswings shown, not all of them.
Here is my code:
Inputs:tv(0.01);
vars: h00(H),h00bn(1),L00bn(1),L00(L),dir0(1),olddir0(1),rev0(0.1),continuation0(false);
vars:newH(h),newL(L),faL0(15),faH0(23),fdb0(40),fde0(108);
vars:bn(0);
//***************************************************************************
bn=barnumber;
continuation0=false;
if olddir0= 1 and h>h00 then begin h00=H;h00bn=bn;continuation0=true;newH=1;end;
if olddir0=-1 and l<L00 then begin L00=L;L00bn=bn;continuation0=true;newL;end;
If continuation0=false then begin
if olddir0< 1 and H>= L00+rev0 then begin dir0= 1;h00=H;h00bn=bn;newH=1;end;
if olddir0>-1 and L<= h00-rev0 then begin dir0=-1;L00=L;L00bn=bn;newL=1;end;
end;
if newH=1 then begin
newH=0;
if dir0=1 then begin
for value1=bn-(H00bn+fdb0) downto bn-(H00bn+fde0) begin
Plot1[value1](h00-FaH0*tv) ;
Plot2[value1](h00-FaL0*tv) ;
end;
end;
end;
olddir0=dir0;
Here is a picture of my chart:
http://screencast.com/t/AHvAuIge65o
The green area squares are drawn each time a new high in the upswing happens.
I need only the latest ones in the upswings shown, not all of them.
Here is my code:
Inputs:tv(0.01);
vars: h00(H),h00bn(1),L00bn(1),L00(L),dir0(1),olddir0(1),rev0(0.1),continuation0(false);
vars:newH(h),newL(L),faL0(15),faH0(23),fdb0(40),fde0(108);
vars:bn(0);
//***************************************************************************
bn=barnumber;
continuation0=false;
if olddir0= 1 and h>h00 then begin h00=H;h00bn=bn;continuation0=true;newH=1;end;
if olddir0=-1 and l<L00 then begin L00=L;L00bn=bn;continuation0=true;newL;end;
If continuation0=false then begin
if olddir0< 1 and H>= L00+rev0 then begin dir0= 1;h00=H;h00bn=bn;newH=1;end;
if olddir0>-1 and L<= h00-rev0 then begin dir0=-1;L00=L;L00bn=bn;newL=1;end;
end;
if newH=1 then begin
newH=0;
if dir0=1 then begin
for value1=bn-(H00bn+fdb0) downto bn-(H00bn+fde0) begin
Plot1[value1](h00-FaH0*tv) ;
Plot2[value1](h00-FaL0*tv) ;
end;
end;
end;
olddir0=dir0;
- TJ
- Posts: 7740
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2221 times
Re: erasing and redrawing a retracement area square
NOPLOT is only good for the current bar.Thanks for your reply.
Here is a picture of my chart:
http://screencast.com/t/AHvAuIge65o
The green area squares are drawn each time a new high in the upswing happens.
I need only the latest ones in the upswings shown, not all of them.
Here is my code:
Inputs:tv(0.01);
vars: h00(H),h00bn(1),L00bn(1),L00(L),dir0(1),olddir0(1),rev0(0.1),continuation0(false);
vars:newH(h),newL(L),faL0(15),faH0(23),fdb0(40),fde0(108);
vars:bn(0);
//***************************************************************************
bn=barnumber;
continuation0=false;
if olddir0= 1 and h>h00 then begin h00=H;h00bn=bn;continuation0=true;newH=1;end;
if olddir0=-1 and l<L00 then begin L00=L;L00bn=bn;continuation0=true;newL;end;
If continuation0=false then begin
if olddir0< 1 and H>= L00+rev0 then begin dir0= 1;h00=H;h00bn=bn;newH=1;end;
if olddir0>-1 and L<= h00-rev0 then begin dir0=-1;L00=L;L00bn=bn;newL=1;end;
end;
if newH=1 then begin
newH=0;
if dir0=1 then begin
for value1=bn-(H00bn+fdb0) downto bn-(H00bn+fde0) begin
Plot1[value1](h00-FaH0*tv) ;
Plot2[value1](h00-FaL0*tv) ;
end;
end;
end;
olddir0=dir0;
YOu can use a loop to re-plot the square to zero. Then it will be out of sight and out of care.
eg.
Code: Select all
for value1= 1 to 50
begin
Plot1[value1]( 0 ) ;
Plot2[value1]( 0 ) ;
end;
- TJ
- Posts: 7740
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2221 times
Re: erasing and redrawing a retracement area square
excellent idea; if I then choose not to expand the scale to indicators (in the instrument menu), the zero values will not show!
Thanks a lot TJ
Thanks a lot TJ
- TJ
- Posts: 7740
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2221 times
Re: erasing and redrawing a retracement area square [SOLVED]
YOu are welcome.excellent idea; if I then choose not to expand the scale to indicators (in the instrument menu), the zero values will not show!
Thanks a lot TJ
Enjoy!