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;
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