PureBytes Links
Trading Reference Links
|
At 5:14 PM -0400 4/28/99, Tom Cathey wrote:
>Can someone tell me why this indicator will not flag +1 or -1 when it
>makes higher low swings or lower low swings? If not, anyone have another
>solution?
>
>Thanks.
>
>Tom Cathey
>
>
>Var: MA(0),Trend(0);
>MA = Average(Close,20);
>If SwingLow(2,MA,10,30) < SwingLow(1,MA,10,30) then Trend= 1;
>If SwingLow(2,MA,10,30) > SwingLow(1,MA,10,30) then Trend= -1;
>Plot1(Trend,""); {+1 or -1}
The SwingLow function returns -1 if it doesn't find anything. So you need
to test if it has found something. In addition, I have had trouble getting
it to find previous occurrences so I find that it is better to find them as
you move through the bars and save them.
The following code should do it.
Bob Fulks
-----
Inputs: Strength(3);
Var: MA(Close), Trend(0);
MA = Average(Close, 1);
Value1 = SwingLow(1, MA, Strength, Strength+1);
if Value1 > 0 then begin
if Value2 <> 0 then Trend = iff(Value1 > Value2, 1, -1);
Value2 = Value1;
end;
Plot1(Trend, "Trend");
|