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

Re: Help- I have seen this problem before- I just can't remember the solution



PureBytes Links

Trading Reference Links

At 05:35 AM 10/7/2004, Mike Marcott wrote:

>Is T3 a "simple" function or a "series" function?

Here is a "simple" version.

The .ELD file is attached for TradeStation 8.

For older TradeStation versions, you will have to copy-paste the text below into the editor and save as a function called "T3Average.simple". Make sure you make it a "simple" function in the Properties dialog.

Bob Fulks

{ *******************************************************************
 
   Function    : T3Average.simple
   
   Last Edit   : 12/16/98
 
   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 and to allow 
     variable inputs. 
 
     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 "simple" version of this function must be called on each 
     bar. It should not be put inside a conditional statement where 
     it is only evaluated on some bars.
 
     The inputs can be variables or arrays. The "Periods" input can 
     be changed dynamically from bar to bar, if necessary, and 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), Init(TRUE);
 
if Periods + 1 <> 0 then begin
 
   if Init 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;
      Init = FALSE;
 
   end else begin
 
      f1 = 2 / (Periods + 1);
      f2 = 1 - f1;
 
      e1 = f1 * Price + f2 * e1;
      e2 = f1 * e1 + f2 * e2;
      e3 = f1 * e2 + f2 * e3;
      e4 = f1 * e3 + f2 * e4;
      e5 = f1 * e4 + f2 * e5;
      e6 = f1 * e5 + f2 * e6;
 
   end;
 
   T3Average.simple = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3;
 
end;

Attachment: Description: Binary data