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)
Scanner help
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
you need to reset the conditions, because they are mutually exclusive.
replace this section
with this
assume there is nothing between Div = 1 and Div = -1;
replace this section
Code: Select all
Condition1 = Div > +1;
Condition2 = Div < -1;
Code: Select all
if Div > +1
then
begin
Condition1 = true;
Condition2 = false;
end
else
if Div < -1 then
begin
Condition1 = false;
Condition2 = true;
end;
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
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.
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
try this...
you might want to consider these operations:
Div >= +1
Div <= -1
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
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
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.
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.