[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Days Up/Days Down Ratio



PureBytes Links

Trading Reference Links


-- Shawn wrote: 

> Just wondering is there a way of just specifying the
> number of days back the indicator should use (say
> 360) as one does with moving averages, or RSI
> instead of specifying a specific begining date ?



Sure...

You could do it this way:


Input:

NumDays(360);


Var:

DayCount(0),
UpDays(0),
DnDays(0);


If DayCount = NumDays then begin

  UpDays = 0;
  DnDays = 0;
  DayCount = 0;

End
Else begin

  If C > C[1] then UpDays = UpDays + 1;
  If C < C[1] then DnDays = DnDays + 1;
  DayCount = DayCount + 1;

End;

If DnDays > 0 then
Plot1(UpDays/DnDays, "Up/Dn");