Announcement

Collapse
No announcement yet.

Another Indicator no calc correctly, is there issue with Painting...

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

  • Another Indicator no calc correctly, is there issue with Painting...

    Thx for help on past link http://forum.esignal.com/showthread....&threadid=5238

    But I gave up in then end..switch to another indicator..but its happen again...see the indicators in the picture, the wobly one is realtime on 2 min chart, the tidy one is immediate after chart reload with the symbol...WHY...

    I have 4 monitors, 2.4 gig CPU, 1 Gig RAM, Win 2000...

    Code...

    Description : This Indicator plots Ergotic_TSI2 indicator
    Provided By : Developed by TS Support, LLC for eSignal. (c) Copyright 2002
    ************************************************** ******************/


    function preMain()
    {
    setStudyTitle("Ergotic_TSI-2");
    setCursorLabelName("ErgTSI-1", 0);
    setCursorLabelName("ErgTSI-2", 1);
    setCursorLabelName("SigLin", 2);
    setCursorLabelName("ZeroLine", 3);
    setDefaultBarFgColor(Color.red, 0);
    setDefaultBarFgColor(Color.green, 1);
    setDefaultBarFgColor(Color.brown, 2);
    setDefaultBarFgColor(Color.black, 3);
    setColorPriceBars(true);
    }
    var XA11_1 = 0.0;
    var XA12_1 = 0.0;
    var XA13_1 = 0.0;
    var aXA11_1 = 0.0;
    var aXA12_1 = 0.0;
    var aXA13_1 = 0.0;
    var XA11_1 = 0.0;
    var XA12_1 = 0.0;
    var XA13_1 = 0.0;
    var aXA11_1 = 0.0;
    var aXA12_1 = 0.0;
    var aXA13_1 = 0.0;
    var XA1_1 = 0.0;

    var XA21_1 = 0.0;
    var XA22_1 = 0.0;
    var XA23_1 = 0.0;
    var aXA21_1 = 0.0;
    var aXA22_1 = 0.0;
    var aXA23_1 = 0.0;
    var XA21_1 = 0.0;
    var XA22_1 = 0.0;
    var XA23_1 = 0.0;
    var aXA21_1 = 0.0;
    var aXA22_1 = 0.0;
    var aXA23_1 = 0.0;

    function main(r1, s1, u1, r2, s2, u2, ZeroLine, SmthLen1)
    {
    if (r1 == null) r1 = 14;/*20*/
    if (s1 == null) s1 = 6;/*8*/
    if (u1 == null) u1 = 4;/*8*/
    if (r2 == null) r2 = 14;/*16*/
    if (s2 == null) s2 = 6;/*5*/
    if (u2 == null) u2 = 4;/*1*/
    if (ZeroLine == null) ZeroLine = 0;
    if (SmthLen1 == null) SmthLen1 = 3;
    var High = getValue("High", 0, -2);
    var Low = getValue("Low", 0, -2);

    var FactorR1 = 2 / (r1 + 1);
    var FactorS1 = 2 / (s1 + 1);
    var FactorU1 = 2 / (u1 + 1);

    var FactorR2 = 2 / (r2 + 1);
    var FactorS2 = 2 / (s2 + 1);
    var FactorU2 = 2 / (u2 + 1);

    var Price1 = (High[0] + Low[0]) / 2;
    var Price2 = (High[1] + Low[1]) / 2;

    var vPrice = Price1 - Price2;


    var XA11 = FactorR1 * vPrice + (1 - FactorR1) * XA11_1;
    var XA12 = FactorS1 * XA11 + (1 - FactorS1) * XA12_1;
    var XA13 = FactorU1 * XA12 + (1 - FactorU1) * XA13_1;
    vPrice = Math.abs(Price1 - Price2);
    var aXA11 = FactorR1 * vPrice + (1 - FactorR1) * aXA11_1;
    var aXA12 = FactorS1 * aXA11 + (1 - FactorS1) * aXA12_1;
    var aXA13 = FactorU1 * aXA12 + (1 - FactorU1) * aXA13_1;
    var Val11 = 100 * XA13;
    var Val12 = aXA13;
    var TSI1 = 0.0;
    if (Val12 != 0) TSI1 = Val11 / Val12;
    else TSI1 = 0.0;
    var Factor1 = 2 / (SmthLen1 + 1);
    var XA1 = Factor1 * TSI1 + (1 - Factor1) * XA1_1;

    var vPrice = Price1 - Price2;


    var XA21 = FactorR2 * vPrice + (1 - FactorR2) * XA21_1;
    var XA22 = FactorS2 * XA21 + (1 - FactorS2) * XA22_1;
    var XA23 = FactorU2 * XA22 + (1 - FactorU2) * XA23_1;
    vPrice = Math.abs(Price1 - Price2);
    var aXA21 = FactorR2 * vPrice + (1 - FactorR2) * aXA21_1;
    var aXA22 = FactorS2 * aXA21 + (1 - FactorS2) * aXA22_1;
    var aXA23 = FactorU2 * aXA22 + (1 - FactorU2) * aXA23_1;
    var Val21 = 100 * XA23;
    var Val22 = aXA13;
    var TSI2 = 0.0;
    if (Val22 != 0) TSI2 = Val21 / Val22;
    else TSI2 = 0.0;

    if (getBarState() == BARSTATE_NEWBAR)
    {
    XA11_1 = XA11;
    XA12_1 = XA12;
    XA13_1 = XA13;
    aXA11_1 = aXA11;
    aXA12_1 = aXA12;
    aXA13_1 = aXA13;
    XA1_1 = XA1;
    XA21_1 = XA11;
    XA22_1 = XA12;
    XA23_1 = XA13;
    aXA21_1 = aXA11;
    aXA22_1 = aXA12;
    aXA23_1 = aXA13;
    }

    /*Paint Price Bars*/

    if(TSI2<ZeroLine)
    setPriceBarColor(Color.red);

    else if(TSI2>ZeroLine)
    setPriceBarColor(Color.blue);

    else if(1==1)
    setPriceBarColor(Color.black);

    /*Paint Bottom*/
    if(TSI1 > XA1) {
    setBarBgColor(Color.yellow);
    } else if(TSI1 < XA1) {
    setBarBgColor(Color.white);
    }

    return new Array(TSI1, TSI2, XA1, ZeroLine);


    }

  • #2
    Pict One
    Attached Files

    Comment


    • #3
      pict two
      Attached Files

      Comment


      • #4
        The charts look the same to me, I expect you attached the same one twice...however, you have caught a well known problem with this formula.

        There is a fix found

        HERE

        Garth
        Garth

        Comment


        • #5
          Looks good so far...

          Comment

          Working...
          X