Announcement

Collapse
No announcement yet.

Tillson T3 Avg

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tillson T3 Avg

    I'm trying to understand how the calculation is done on the efs. One of the reasons is to duplicate it in Excel.

    Can someone answer the questions in certain parts in the following code, what it means in plain language? Your help will be greatly appreciated.

    function preMain()
    {
    setPriceStudy(false);
    setCursorLabelName("T3Avg");
    setHistogramBase(0)
    setPlotType(PLOTTYPE_HISTOGRAM, 0)
    }
    var e1_1 = 0.0; //Does this mean on the first price this var is=0?
    var e2_1 = 0.0;
    var e3_1 = 0.0;
    var e4_1 = 0.0;
    var e5_1 = 0.0;
    var e6_1 = 0.0;
    function main(Price, Periods)
    {
    if (Price == null) Price = "Close";
    if (Periods == null) Periods = 5;
    var vPrice = getValue(Price, 0);
    var b = 0.7;
    var b2 = b * b;
    var b3 = b * b * b;
    var c1 = -b3;
    var c2 = 3 * b2 + 3 * b3;
    var c3 = -6 * b2 - 3 * b - 3 * b3;//straight cal, no ()
    var c4 = 1 + 3 * b + b3 + 3 * b2;
    var f1 = 2 / (Periods + 1);
    var f2 = 1 - f1;
    var e1 = f1 * vPrice + f2 * e1_1;
    var e2 = f1 * e1 + f2 * e2_1;
    var e3 = f1 * e2 + f2 * e3_1;
    var e4 = f1 * e3 + f2 * e4_1;
    var e5 = f1 * e4 + f2 * e5_1;
    var e6 = f1 * e5 + f2 * e6_1;
    if (getBarState() == BARSTATE_NEWBAR)//What does this mean? On the next bar, e1_1 becomes the old e1?
    {
    e1_1 = e1;
    e2_1 = e2;
    e3_1 = e3;
    e4_1 = e4;
    e5_1 = e5;
    e6_1 = e6;
    }
    var T3Average = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3;
    return T3Average;
    Last edited by WilliamV; 03-19-2008, 07:24 AM.

  • #2
    Re: Tillson T3 Avg

    WilliamV

    //Does this mean on the first price this var is=0?
    That means that on the first execution of the efs that [global] variable will be set to 0. On subsequent executions of the efs the variable will contain the last calculated value.

    //What does this mean? On the next bar, e1_1 becomes the old e1?
    It means that on the first tick of a new bar the value of e1_1 becomes the last calculated value of e1
    Hope this helps
    Alex


    Originally posted by WilliamV
    I'm trying to understand how the calculation is done on the efs. One of the reasons is to duplicate it in Excel.

    Can someone answer the questions in certain parts in the following code, what it means in plain language? Your help will be greatly appreciated.

    function preMain()
    {
    setPriceStudy(false);
    setCursorLabelName("T3Avg");
    setHistogramBase(0)
    setPlotType(PLOTTYPE_HISTOGRAM, 0)
    }
    var e1_1 = 0.0; //Does this mean on the first price this var is=0?
    var e2_1 = 0.0;
    var e3_1 = 0.0;
    var e4_1 = 0.0;
    var e5_1 = 0.0;
    var e6_1 = 0.0;
    function main(Price, Periods)
    {
    if (Price == null) Price = "Close";
    if (Periods == null) Periods = 5;
    var vPrice = getValue(Price, 0);
    var b = 0.7;
    var b2 = b * b;
    var b3 = b * b * b;
    var c1 = -b3;
    var c2 = 3 * b2 + 3 * b3;
    var c3 = -6 * b2 - 3 * b - 3 * b3;//straight cal, no ()
    var c4 = 1 + 3 * b + b3 + 3 * b2;
    var f1 = 2 / (Periods + 1);
    var f2 = 1 - f1;
    var e1 = f1 * vPrice + f2 * e1_1;
    var e2 = f1 * e1 + f2 * e2_1;
    var e3 = f1 * e2 + f2 * e3_1;
    var e4 = f1 * e3 + f2 * e4_1;
    var e5 = f1 * e4 + f2 * e5_1;
    var e6 = f1 * e5 + f2 * e6_1;
    if (getBarState() == BARSTATE_NEWBAR)//What does this mean? On the next bar, e1_1 becomes the old e1?
    {
    e1_1 = e1;
    e2_1 = e2;
    e3_1 = e3;
    e4_1 = e4;
    e5_1 = e5;
    e6_1 = e6;
    }
    var T3Average = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3;
    return T3Average;

    Comment


    • #3
      Thank you as always Alexis.

      How about this line: var c3 = -6 * b2 - 3 * b - 3 * b3;//straight cal, no ()

      Is it a straight calculation, or certain ones have priority?

      And a more straight up question, do you know a better way to duplicate the T3 avg in excel? Perhaps using the formulas below?

      GD(n,v) = EMA(n) * (1+v)-EMA(EMA(n)) * v,

      T3(n) = GD(GD(GD(n))),

      Thanks, William

      Comment


      • #4
        William
        In Javascript the operations are performed in the normal math order (ie * / + -) so in the example the result would be the same as
        var c3 = (-6 * b2) - (3 * b) - (3 * b3);
        I am not familiar with other ways to calculate the T3 in Excel.
        Alex



        Originally posted by WilliamV
        Thank you as always Alexis.

        How about this line: var c3 = -6 * b2 - 3 * b - 3 * b3;//straight cal, no ()

        Is it a straight calculation, or certain ones have priority?

        And a more straight up question, do you know a better way to duplicate the T3 avg in excel? Perhaps using the formulas below?

        GD(n,v) = EMA(n) * (1+v)-EMA(EMA(n)) * v,

        T3(n) = GD(GD(GD(n))),

        Thanks, William

        Comment

        Working...
        X