erasing and redrawing a retracement area square  [SOLVED]

Questions about MultiCharts and user contributed studies.
florianp3
Posts: 20
Joined: 10 Jun 2014
Has thanked: 4 times

erasing and redrawing a retracement area square

Postby florianp3 » 25 Nov 2014

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.

User avatar
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

Postby TJ » 25 Nov 2014

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 draw a diagram(s) to illustrate what you would like to do.

Please post your code.

florianp3
Posts: 20
Joined: 10 Jun 2014
Has thanked: 4 times

Re: erasing and redrawing a retracement area square

Postby florianp3 » 25 Nov 2014

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;

User avatar
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

Postby TJ » 25 Nov 2014

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;
NOPLOT is only good for the current bar.

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;

User avatar
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

Postby TJ » 25 Nov 2014

ps.
[FAQ] How to Post Codes (that people can read)
viewtopic.php?f=16&t=11713

florianp3
Posts: 20
Joined: 10 Jun 2014
Has thanked: 4 times

Re: erasing and redrawing a retracement area square

Postby florianp3 » 26 Nov 2014

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

User avatar
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]

Postby TJ » 26 Nov 2014

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
YOu are welcome.

Enjoy!


Return to “MultiCharts”