Erase a previous plotted dot  [SOLVED]

Questions about MultiCharts and user contributed studies.
User avatar
Al3cs
Posts: 34
Joined: 22 Jun 2017
Location: Italy
Has thanked: 31 times
Been thanked: 1 time

Erase a previous plotted dot

Postby Al3cs » 19 Dec 2017

Hi guys,
I'm writing an indicator for pattern recognition.
The indicator looks for lower highs and it starts looking for an high and marks it with a dot.
But if an higher high occurs I want to mark this recent one as the high and erase provious plotted dot.

This is the code but it doesn't erase previous dots

Code: Select all

if stato = 0 and High[1] > Highest(High[2],20) and High < High[1] then
begin
stato = 1;
barCount = 0;
PVH1 = High[1];
PVH1Pos = BarNumber;
Plot1[BarNumber - PVH1Pos + 1](PVH1,"1");
Print("Trovato 1 il ", Date);
end;

if stato = 1 then
begin
barCount = barCount + 1;
if barCount > numBarreReset then stato = 0;
if high > PVH1 then begin
NoPlot(1);
PVH1 = high;
Plot1[high-1](PVH1, "1");
end;
Connessione Desktop remoto.png
(4.56 KiB) Downloaded 743 times

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Erase a previous plotted dot

Postby TJ » 19 Dec 2017

Hi guys,
I'm writing an indicator for pattern recognition.
The indicator looks for lower highs and it starts looking for an high and marks it with a dot.
But if an higher high occurs I want to mark this recent one as the high and erase provious plotted dot.

This is the code but it doesn't erase previous dots

Code: Select all

if stato = 0 and High[1] > Highest(High[2],20) and High < High[1] then
begin
stato = 1;
barCount = 0;
PVH1 = High[1];
PVH1Pos = BarNumber;
Plot1[BarNumber - PVH1Pos + 1](PVH1,"1");
Print("Trovato 1 il ", Date);
end;

if stato = 1 then
begin
barCount = barCount + 1;
if barCount > numBarreReset then stato = 0;
if high > PVH1 then begin
NoPlot(1);
PVH1 = high;
Plot1[high-1](PVH1, "1");
end;
Connessione Desktop remoto.png

Which line of code is used to erase previous dots?

User avatar
Al3cs
Posts: 34
Joined: 22 Jun 2017
Location: Italy
Has thanked: 31 times
Been thanked: 1 time

Re: Erase a previous plotted dot

Postby Al3cs » 19 Dec 2017

There's a NoPlot(1) in the fourth line from the end.
The code finds and marks the high in the first indentation.
The second indentation checks for an higher high then it (tries to) delete the dot previously plotted and marks the new one.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Erase a previous plotted dot

Postby TJ » 19 Dec 2017

There's a NoPlot(1) in the fourth line from the end.
The code finds and marks the high in the first indentation.
The second indentation checks for an higher high then it (tries to) delete the dot previously plotted and marks the new one.

The noplot removes the plot in the CURRENT BAR, not the previous bars.

User avatar
Al3cs
Posts: 34
Joined: 22 Jun 2017
Location: Italy
Has thanked: 31 times
Been thanked: 1 time

Re: Erase a previous plotted dot

Postby Al3cs » 19 Dec 2017

Well, now I know what the problem is.
What about the solution?

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Erase a previous plotted dot

Postby TJ » 19 Dec 2017

Try this:

Code: Select all


Plot1 [ BarNumber - PVH1Pos ] ( 0 );

User avatar
ABC
Posts: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Re: Erase a previous plotted dot

Postby ABC » 19 Dec 2017

Al3cs,

Powerlanguage allows displacing NoPlot, too.

Code: Select all

Plot1( Close ) ;
NoPlot[10]( 1 ) ;
Regards,

ABC
Well, now I know what the problem is.
What about the solution?

MAZINGUER
Posts: 75
Joined: 06 Jan 2017
Has thanked: 9 times
Been thanked: 25 times

Re: Erase a previous plotted dot  [SOLVED]

Postby MAZINGUER » 06 Jan 2018

Hi Al13cs,

I think it's better that you use blocks "if .... then begin .... end else ..." so that something like that remains:

Code: Select all

If .....{conditions}.... then begin
....{instructions ó assignments}....
Plot1[BarNumber - PVH1Pos + 1](PVH1,"1");
Else
NoPlot(1);
end;


Return to “MultiCharts”