Scanner help

Questions about MultiCharts and user contributed studies.
shortski
Posts: 27
Joined: 21 May 2008

Scanner help

Postby shortski » 08 Sep 2009

Hi all. I have the following basic Divergence scan in the scanner but it seems to retain the last positive or negative divergence even if the condition ended 5, 6 , 7 etc days ago. So I am just looking to tweak it to show only the current day. Thanks

Shortski

Inputs: BarPx(Close), AvePx(Close), Length(5);

Vars: Div(0);
Div = ELBC_Divergence(BarPx, AvePx, Length);

Condition1 = Div > +1;

Condition2 = Div < -1;

If Condition1 then
Plot1(+1, "Divergence", Green)
else
If Condition2 then
Plot1(-1, "Divergence", Red)

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

Postby TJ » 08 Sep 2009

you need to reset the conditions, because they are mutually exclusive.

replace this section

Code: Select all

Condition1 = Div > +1;

Condition2 = Div < -1;
with this

Code: Select all

if Div > +1
then
begin
Condition1 = true;
Condition2 = false;
end
else
if Div < -1 then
begin
Condition1 = false;
Condition2 = true;
end;
assume there is nothing between Div = 1 and Div = -1;

shortski
Posts: 27
Joined: 21 May 2008

Postby shortski » 09 Sep 2009

Thanks TJ. That plots a lot better now but as you said in your last line, I have to figure out the NoPlot zone between -1 and 1. I tried;

else
NoPlot ;

and it wouldn't compile.

So then I tried;

else
Plot1(""."Divergence");

and that didn't work.

I did get;

else
NoPlot(1);

to work but the chart is continuous +1 Greens and -1 Reds so that isn't right either.

Suggestions?

Thanks

S

Thanks
Last edited by shortski on 09 Sep 2009, edited 1 time in total.

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

Postby TJ » 09 Sep 2009

try this...

Code: Select all

Inputs: BarPx(Close), AvePx(Close), Length(5);

Vars: Div(0);
Div = ELBC_Divergence(BarPx, AvePx, Length);

if Div > +1
then
begin
Condition1 = true;
Condition2 = false;
end
else
if Div < -1 then
begin
Condition1 = false;
Condition2 = true;
end
else
begin
Condition1 = false;
Condition2 = false;
end;

If Condition1 then
Plot1(+1, "Divergence", Green)
else
If Condition2 then
Plot1(-1, "Divergence", Red)
else
Plot1(0, "Divergence", white);

you might want to consider these operations:

Div >= +1
Div <= -1

shortski
Posts: 27
Joined: 21 May 2008

Postby shortski » 09 Sep 2009

Thanks for the help TJ.

The;
else
Plot1(0, "Divergence"); plots as does the >=,<= and just shows up as zeros in the scanner, but I still can't get any breaks in the indicator on the chart.

Gotta be something subtle.

Shortski

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

Postby TJ » 09 Sep 2009

i don't understand this line:

but I still can't get any breaks in the indicator on the chart.



what results you are getting on the scanner display?

are you testing it in real time?
some indicators require live feed to work.

this logic should work, the hang up must be in the function ELBC_Divergence.
you have to find a way to test how your function produces outputs under different scenarios.

shortski
Posts: 27
Joined: 21 May 2008

Postby shortski » 09 Sep 2009

Maybe you're right about the real time. The scanner shows a number of no plots but on the charts, there is always a +1 or -1.

The Function is;

ELBC_Divergence = BarPx - Average(AvePx, Length);

Inputs: BarPx(Numeric), AvePx(Numeric), Length(Numeric);


Return to “MultiCharts”