PureBytes Links
Trading Reference Links
|
At 3:57 PM -1000 1/12/98, Ron Augustine wrote:
>One simple solution is to multiply all of your Weekly Indicator period
>references by 5 and switch them over to daily charts and dump the Weekly
>data stream from your charts.
>It's not always immediately 100% accurate, but you can play with the
>values and eventually get the daily indicator to mimic the weekly.
>i.e. If you're using an 13 period Exponential Moving Average on a Weekly
>data stream, change it to a 65 period ExpMa and plot it on a daily
>chart...
At 8:47 PM -0800 1/12/98, Phil wrote:
>If someone has or could write an EL code that uses a running 5 days for an
>indicator etc. then you could have a weekly indicator in a daily chart!
>The running indicator as an example would say run from last monday to this
>monday, then on tues. it would run from last tues to this tues. etc. In
>other words compress the last 5 days into a week and do it each a every
>day then you would have a weekly indicator in a daily chart. If anyone has
>any code to do this I would also like to have it!! Also any other ideas
>along this line of thinking would be very helpful!!
Converting a weekly indicator to one working off of daily data is not
complicated but has some quirks, particularly if you want it to get the
same results as the weekly charts and account correctly for holidays. (Of
course, it is just an indicator and so an approximation might work just as
well as an exact calculation.)
Below is an example of a function that is evaluated every Friday, or at the
beginning of the next week if Friday was a holiday.
This is a Function and to verify, it must be named "XAverage.Wk". If you
name it anything else, you must change the code to correspond.
Since it is only evaluated once a week, if you wanted, for example, a 13
week moving average on a weekly chart, you need to use 13 as the length
input for this function.
Bob Fulks
{ *******************************************************************
Function : XAverage.Wk
Last Edit : 1/13/98
Provided By : Bob Fulks
Description : This is a recoding of the XAverage function as a
weekly function operating on daily bars. Is it recalculated
each Friday or at the start of the next week if the last bar
was not a Friday. For correct results it must be evaluated
on every daily bar.
********************************************************************}
inputs : Price(NumericSeries), Length(NumericSimple);
vars : Factor(0), XLast(0), DoW(0);
DoW = DayOfWeek(Date);
if Length + 1 <> 0
then begin
if CurrentBar <= 1
then begin
Factor = 2 / (Length + 1);
XAverage.Wk = Price;
XLast = Price;
end
else begin
{If Friday do calculation}
if DoW = 5 then begin
Value1 = Factor * Price + (1 - Factor) * XLast;
XAverage.Wk = Value1;
XLast = Value1;
end;
{If new week and last bar was not Friday do calculation}
if DoW < DoW[1] and DoW[1] <> 5 then begin
Value1 = Factor * Price[1] + (1 - Factor) * XLast;
XAverage.Wk = Value1;
XLast = Value1;
end;
end;
end;
--
Bob Fulks
bfulks@xxxxxxxxxxxx
|