Announcement

Collapse
No announcement yet.

Widening of the Bands

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

  • Widening of the Bands

    In the following script, can someone suggest what might be changed to widen these bands?

    Thanks,

    DaTridr

    **************************

    function preMain()
    {
    setPriceStudy(false);
    setStudyTitle("Upper-Lower Pro Band");
    setCursorLabelName("PL", 0);
    setCursorLabelName("PU", 1);
    setDefaultBarFgColor(Color.blue, 0);
    setDefaultBarFgColor(Color.blue, 1);
    }
    function main(Length)
    {
    if (Length == null) Length = 18;
    var SL = 0.0;
    var SH = 0.0;
    var Low = getValue("Low", 0, - Length);
    var High = getValue("High", 0, -Length);
    var SumBars = Length * (Length - 1) * .5;
    var SumSqrBars = (Length - 1) * Length * (2 * Length - 1) / 6;
    var Sum1_1 = 0.0;
    var Sum1_2 = 0.0;
    var SumY1 = 0.0;
    var SumY2 = 0.0;
    var i = 0;
    for (i = 0; i < Length; i++)
    {
    Sum1_1 += i * Low[i];
    Sum1_2 += i * High[i];
    SumY1 += Low[i];
    SumY2 += High[i];
    }
    var Sum2_1 = SumBars * SumY1;
    var Sum2_2 = SumBars * SumY2;
    var Num1_1 = Length * Sum1_1 - Sum2_1;
    var Num1_2 = Length * Sum1_2 - Sum2_2;
    var Num2 = SumBars * SumBars - Length * SumSqrBars;
    SL = Num1_1 / Num2;
    SH = Num1_2 / Num2;
    var Value2 = 0.0;
    var Value3 = 0.0;
    var PL = 0.0;
    var PU = 0.0;
    for (i = 1; i <= Length; i++)
    {
    Value2=Low[i - 1] + (SL * i - 1);
    Value3=High[i - 1] + (SH * i - 1);
    if (i == 1)
    {
    PL=Value2;
    PU=Value3;
    };
    if (Value2 < PL) PL = Value2;
    if (Value3 > PU) PU = Value3;
    }
    return new Array (PL, PU);

  • #2
    Try messing with the Length variable.

    The easiet way to do this after the efs is loaded...

    right click on chart, edit studies, then select the efs and edit length.

    Comment

    Working...
    X