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

Re: Function & Indicator help



PureBytes Links

Trading Reference Links

Jimmy,

Couldn't find "indicators", but here are two functions provided by Bob
Fulks.

Regards,

Barry Silberman

=======================================================
{ *******************************************************************

  Function    : T3Average

  Last Edit   : 12/14/97 - 05/01/99

  Provided By : Bob Fulks
  Recoded By: : Clyde Lee for speed and really simple function

  Description : This function is an EasyLanguage version of the
     moving average described in the January. 1998 issue of TASC,
     p57, "Smoothing Techniques for More Accurate Signals", by Tim
     Tillson. It is translated from the MetaStock code presented
     in the article. The function was modified by C. Lee to not use
     any call to external exponential average function but rather
     perform the same operation internally.  This saves the
     overhead of a bunch of calls to the XAverage function.  This
     modification increases speed and allows variables as inputs.

     The variable, "b", is a damping coefficient which is set to
     the suggested default value of 0.7. The variable "b" is
     substituted for the variable, "a" used in the article since
     "a" is a reserved word.

     The resulting indicator plotting this function appears to
     duplicate the results shown in Figure 4 of the article.

     Damp: A damping factor = any value between +100 and -100:

      -100 = No damping (with ringing)
         0 = Critically damped for a triangle wave.
      +100 = Overdamped

     Lag: The lag in bars is given by:

         Lag = (Length - 1) * (1 + Damp / 100) / 2

     The Lag is equal to the lag of an exponential or simple
     moving average of the same "Length" when Damp = 0. When
     Damp = -100 then Lag = 0 but there is ringing and overshoot
     as with a linear regression value.

    © 2000 Bob Fulks, All rights reserved.
      only portion dealing with damp ! ! !

********************************************************************}
Inputs:     Price(NumericSimple), Period(NumericSimple);
Variables:  e1(Price),   e2(Price),   e3(Price),
            e4(Price),   e5(Price),   e6(Price);
Variables:  XAlpha(2/6), XBeta(0),    OldPeriod(-999999);
Vars:       damp(-70),
            b(-0.01 * damp),
            aa(b*b),               aaa(b*b*b),
            c1(-aaa),              c2(3*aa+3*aaa),
            c3(-6*aa-3*b-3*aaa),   c4(1+3*b+aaa+3*aa);

If Period<>0 then begin
If Period<>OldPeriod then begin;
  XAlpha=(2/(AbsValue(Period)+1));
  XBeta=(1-XAlpha);
  OldPeriod=Period;
End;

e1 = e1*XBeta + Price*Xalpha;
e2 = e2*XBeta + e1   *Xalpha;
e3 = e3*XBeta + e2   *Xalpha;
e4 = e4*XBeta + e3   *Xalpha;
e5 = e5*XBeta + e4   *Xalpha;
e6 = e6*XBeta + e5   *Xalpha;


T3Average = c1*e6 + c2*e5 + c3*e4 + c4*e3;
End
Else T3Average=Price;

======================================================
{ *******************************************************************

 Function    : T3Average.series

 Last Edit   : 12/16/97

 Provided By : Bob Fulks

 Description : This function is an EasyLanguage version of the
     moving average described in the January. 1998 issue of TASC,
     p57, "Smoothing Techniques for More Accurate Signals", by Tim
     Tillson. It is translated from the MetaStock code presented
     in the article and recoded for efficiency.

     The variable, "Hot", is a damping coefficient which is set to
     the suggested default value of 0.7. The variable "b" is
     substituted for the variable, "a" used in the article since
     "a" is a reserved word. The variables e1 through e6 calculate
     the exponential moving averages in-line rather than calling
     other functions.

     The resulting indicator plotting this function appears to
     duplicate the results shown in Figure 4 of the article.

     The series version of this function uses previous values
     and, hence, cannot call variables.

     The "Periods" input can need not be an integer.

********************************************************************}

Inputs:   Price(NumericSeries), Periods(NumericSimple);

Variables: b(0), b2(0), b3(0), e1(Price), e2(Price), e3(Price),
    e4(Price), e5(Price), e6(Price), c1(0), c2(0), c3(0),
    c4(0), f1(0), f2(0), Hot(0.7);

if Periods + 1 <> 0 then begin

 if CurrentBar <= 1 then begin

  b  = Hot;
  b2 = b * b;
  b3 = b * b * b;
  c1 = -b3;
  c2 = 3 * b2 + 3 * b3;
  c3 = -6 * b2 - 3 * b - 3 * b3;
  c4 = 1 + 3 * b + b3 + 3 * b2;
  f1 = 2 / (Periods + 1);
  f2 = 1 - f1;

 end else begin

  e1 = f1 * Price + f2 * e1[1];
  e2 = f1 * e1 + f2 * e2[1];
  e3 = f1 * e2 + f2 * e3[1];
  e4 = f1 * e3 + f2 * e4[1];
  e5 = f1 * e4 + f2 * e5[1];
  e6 = f1 * e5 + f2 * e6[1];

 end;

 T3Average.series = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3;

end;



======================================================


----- Original Message -----
From: "Jimmy Snowden" <jhsnowden@xxxxxxx>
To: <Omega-list@xxxxxxxxxx>
Sent: Thursday, March 06, 2003 1:19 PM
Subject: Re: Function & Indicator help


> Help.  I lost a bunch of indicators and functions some time ago and
> would like the T3 indicator again.
>
> Also I have a function called t1 that is source code protected.  Does
> anyone know what that is?  I want to delete it but it sounds too much
> like the T3 to just delete it.  Probably part of some usless junk.
>
>
>
> --
> Best regards,
>  Jimmy Snowden                          mailto:jhsnowden@xxxxxxx
>