Announcement

Collapse
No announcement yet.

Prior version of esignal

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

  • #16
    Steve,

    Thank you for the assistance. The following script is based on the one you provided with some minor changes. I have been testing this on two charts running side by side. Both are ym h9 and the 1st is a 1 minute and the 2nd is 50t. After both are loaded with the exact same script and begin running, they are in sync historically. When the 1 minute chart changes direction from positive to negative or the opposite, the 50t chart does NOT change direction at all and continues constant. If I reload a different time templet onto the 50t chart, the prior data becomes in sync and the process continues. If I wait for the 1 minute to reverse direction a second time, the 50t again does NOT reverse direction until I reload a different time templet again.

    Your thoughts on how to resolve this would be appreciared. After we clear this issue up, I would like to address the issue you raised on improving the resource utilization.

    Best Regards,

    Alan


    var MA1, MA2, aa1, aa11, bInit, paa1, paa11, pp;

    function preMain() {
    setPriceStudy(false);
    setStudyTitle("Steve2a");
    setCursorLabelName("paa1", 0);
    setCursorLabelName("paa11", 1);
    setCursorLabelName("pp", 2);
    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarStyle(PS_SOLID, 1);
    setDefaultBarStyle(PS_SOLID, 2);
    setDefaultBarFgColor(Color.black, 0);
    setDefaultBarFgColor(Color.black, 1);
    setDefaultBarFgColor(Color.black, 2);
    setDefaultBarThickness(1, 0);
    setDefaultBarThickness(1, 1);
    setDefaultBarThickness(3, 2);
    setPlotType(PLOTTYPE_LINE, 0);
    setPlotType(PLOTTYPE_LINE, 1);
    setPlotType(PLOTTYPE_LINE, 2);
    }

    paa1 = 0;
    paa11 = 0;
    pp = 0;

    function main() {

    pp = 0;

    if (!bInit) {
    var Symbol1 = getSymbol();
    var Interval1 = "1";
    var vSymbol1 = Symbol1 + "," + Interval1;
    MA1 = efsInternal("myFunction1", sym(vSymbol1));
    MA2 = efsInternal("myFunction2", sym(vSymbol1));
    aa1 = efsInternal("myFunction3", sym(vSymbol1));
    aa11 = efsInternal("myFunction4", sym(vSymbol1));
    bInit = true;
    }

    if (MA1.getValue(0) >= MA2.getValue(0)) {
    setBarThickness(3, 0);
    setBarFgColor(Color.blue, 0);
    }

    if (MA2.getValue(0) >= MA1.getValue(0)) {
    setBarThickness(1, 0);
    setBarFgColor(Color.black, 0);
    paa1 = 0;
    }

    else {
    paa1 = aa1.getValue(0);
    }

    if (MA2.getValue(0) >= MA1.getValue(0)) {
    setBarThickness(3, 1);
    setBarFgColor(Color.red, 1);
    }

    if (MA1.getValue(0) >= MA2.getValue(0)) {
    setBarThickness(1, 1);
    setBarFgColor(Color.black, 1);
    paa11 = 0;
    }

    else {
    paa11 = aa11.getValue(0);
    }

    return new Array(paa1, paa11, pp);
    }

    function myFunction1() {

    if (!bInit) {
    MA1 = sma(7, close());
    bInit = true;
    }

    return MA1.getValue(0);
    }

    function myFunction2() {

    if (!bInit) {
    MA2 = sma(25, close());
    bInit = true;
    }

    return MA2.getValue(0);
    }

    function myFunction3() {

    var aa1 = 0;
    if (!bInit) {
    MA1 = sma(7, close());
    MA2 = sma(25, close());
    bInit = true;
    }

    if (MA1.getValue(0) >= MA2.getValue(0)) {
    aa1 = 4;
    }

    else if (MA2.getValue(0) >= MA1.getValue(0)) {
    aa1 = 0;
    }

    return aa1;
    }

    function myFunction4() {

    var aa11 = 0;
    if (!bInit) {
    MA1 = sma(7, close());
    MA2 = sma(25, close());
    bInit = true;
    }

    if (MA2.getValue(0) >= MA1.getValue(0)) {
    aa11 = -4;
    }

    else if (MA1.getValue(0) >= MA2.getValue(0)) {
    aa11 = 0;
    }

    return aa11;
    }

    Comment


    • #17
      Hi Alan,

      I ran this efs in a 1 minute template and a 50T template for two days this week. I did not run into any issues like you described with the data feed halting or synchronization.
      Not sure what else I can do at this point to help you get further on this.

      Steve






      Originally posted by Alan2004
      Steve,

      Thank you for the assistance. The following script is based on the one you provided with some minor changes. I have been testing this on two charts running side by side. Both are ym h9 and the 1st is a 1 minute and the 2nd is 50t. After both are loaded with the exact same script and begin running, they are in sync historically. When the 1 minute chart changes direction from positive to negative or the opposite, the 50t chart does NOT change direction at all and continues constant. If I reload a different time templet onto the 50t chart, the prior data becomes in sync and the process continues. If I wait for the 1 minute to reverse direction a second time, the 50t again does NOT reverse direction until I reload a different time templet again.

      Your thoughts on how to resolve this would be appreciared. After we clear this issue up, I would like to address the issue you raised on improving the resource utilization.

      Best Regards,

      Alan


      var MA1, MA2, aa1, aa11, bInit, paa1, paa11, pp;

      function preMain() {
      setPriceStudy(false);
      setStudyTitle("Steve2a");
      setCursorLabelName("paa1", 0);
      setCursorLabelName("paa11", 1);
      setCursorLabelName("pp", 2);
      setDefaultBarStyle(PS_SOLID, 0);
      setDefaultBarStyle(PS_SOLID, 1);
      setDefaultBarStyle(PS_SOLID, 2);
      setDefaultBarFgColor(Color.black, 0);
      setDefaultBarFgColor(Color.black, 1);
      setDefaultBarFgColor(Color.black, 2);
      setDefaultBarThickness(1, 0);
      setDefaultBarThickness(1, 1);
      setDefaultBarThickness(3, 2);
      setPlotType(PLOTTYPE_LINE, 0);
      setPlotType(PLOTTYPE_LINE, 1);
      setPlotType(PLOTTYPE_LINE, 2);
      }

      paa1 = 0;
      paa11 = 0;
      pp = 0;

      function main() {

      pp = 0;

      if (!bInit) {
      var Symbol1 = getSymbol();
      var Interval1 = "1";
      var vSymbol1 = Symbol1 + "," + Interval1;
      MA1 = efsInternal("myFunction1", sym(vSymbol1));
      MA2 = efsInternal("myFunction2", sym(vSymbol1));
      aa1 = efsInternal("myFunction3", sym(vSymbol1));
      aa11 = efsInternal("myFunction4", sym(vSymbol1));
      bInit = true;
      }

      if (MA1.getValue(0) >= MA2.getValue(0)) {
      setBarThickness(3, 0);
      setBarFgColor(Color.blue, 0);
      }

      if (MA2.getValue(0) >= MA1.getValue(0)) {
      setBarThickness(1, 0);
      setBarFgColor(Color.black, 0);
      paa1 = 0;
      }

      else {
      paa1 = aa1.getValue(0);
      }

      if (MA2.getValue(0) >= MA1.getValue(0)) {
      setBarThickness(3, 1);
      setBarFgColor(Color.red, 1);
      }

      if (MA1.getValue(0) >= MA2.getValue(0)) {
      setBarThickness(1, 1);
      setBarFgColor(Color.black, 1);
      paa11 = 0;
      }

      else {
      paa11 = aa11.getValue(0);
      }

      return new Array(paa1, paa11, pp);
      }

      function myFunction1() {

      if (!bInit) {
      MA1 = sma(7, close());
      bInit = true;
      }

      return MA1.getValue(0);
      }

      function myFunction2() {

      if (!bInit) {
      MA2 = sma(25, close());
      bInit = true;
      }

      return MA2.getValue(0);
      }

      function myFunction3() {

      var aa1 = 0;
      if (!bInit) {
      MA1 = sma(7, close());
      MA2 = sma(25, close());
      bInit = true;
      }

      if (MA1.getValue(0) >= MA2.getValue(0)) {
      aa1 = 4;
      }

      else if (MA2.getValue(0) >= MA1.getValue(0)) {
      aa1 = 0;
      }

      return aa1;
      }

      function myFunction4() {

      var aa11 = 0;
      if (!bInit) {
      MA1 = sma(7, close());
      MA2 = sma(25, close());
      bInit = true;
      }

      if (MA2.getValue(0) >= MA1.getValue(0)) {
      aa11 = -4;
      }

      else if (MA1.getValue(0) >= MA2.getValue(0)) {
      aa11 = 0;
      }

      return aa11;
      }

      Comment


      • #18
        The following EFS was created using the custom MA efs 2 in esignal created by Alex. This calculates the 1 minute crossover of 2 sma when placed on a 50T chart. It matches an eval sma placed on a 1 munite chart. Is there a way to constrain efs so it only computes at the close of the minute?

        Best Regards,

        Alan



        function preMain() {

        setPriceStudy(false);
        setStudyTitle("customMA9");
        setCursorLabelName("customMA1",0);
        setDefaultBarFgColor(Color.red,0);
        setPlotType(PLOTTYPE_LINE,0);
        setDefaultBarThickness(1,0);
        }

        var bInit1 = false;
        var xMA1 = null;
        var xMA2 = null;

        pp = 0;
        ww = 1;
        qq = -1;
        paa1 = 0;
        paa11 = 0;

        function main() {

        if(bInit1 == false){
        Symbol = getSymbol();
        Interval1 = "1";
        var vSymbol1 = Symbol+","+Interval1;
        xMA1 = offsetSeries(eval(sma)(7,eval(close)(sym(vSymbol1) )),0, false);
        xMA2 = offsetSeries(eval(sma)(25,eval(close)(sym(vSymbol1 ))),0, false);
        bInit1 = true;
        }

        RFT = (getSeries(xMA1) - getSeries(xMA2));

        if (RFT >= 0) {
        paa1 = 0.5;
        setBarThickness(3, 0);
        setBarFgColor(Color.blue, 0);
        }

        if (RFT < 0) {
        paa1 = 0;
        setBarThickness(1, 0);
        setBarFgColor(Color.black, 0);
        }

        if (RFT <= 0) {
        paa11 = -0.5;
        setBarThickness(3, 1);
        setBarFgColor(Color.red, 1);
        }

        if (RFT > 0) {
        paa11 = 0;
        setBarThickness(1, 1);
        setBarFgColor(Color.black, 1);
        }

        return new Array(paa1, paa11, pp, qq, ww);
        }

        Comment


        • #19
          Hi Alan,

          I ran your new efs adaptation alongside your previous version of the efs for several days and verified it stayed in sync in both a 50T and 1 minute chart. This was not unexpected on my end, but did you see similar results?

          As far as your question regarding limiting the efs execution to to once every one minute bar on a 50T chart, I am not aware of how to impose this cleanly. At first I though you could limit the number of executions by setting the 50T chart to compute on close. However, since you have forced the series to a different interval, I question whether this would accomplish what you are looking for. The best reference I could find that related to your request is in a thread where you discussed something similar with Alex and Jason here.

          I hope this helps.

          Originally posted by Alan2004
          The following EFS was created using the custom MA efs 2 in esignal created by Alex. This calculates the 1 minute crossover of 2 sma when placed on a 50T chart. It matches an eval sma placed on a 1 munite chart. Is there a way to constrain efs so it only computes at the close of the minute?

          Best Regards,

          Alan



          function preMain() {

          setPriceStudy(false);
          setStudyTitle("customMA9");
          setCursorLabelName("customMA1",0);
          setDefaultBarFgColor(Color.red,0);
          setPlotType(PLOTTYPE_LINE,0);
          setDefaultBarThickness(1,0);
          }

          var bInit1 = false;
          var xMA1 = null;
          var xMA2 = null;

          pp = 0;
          ww = 1;
          qq = -1;
          paa1 = 0;
          paa11 = 0;

          function main() {

          if(bInit1 == false){
          Symbol = getSymbol();
          Interval1 = "1";
          var vSymbol1 = Symbol+","+Interval1;
          xMA1 = offsetSeries(eval(sma)(7,eval(close)(sym(vSymbol1) )),0, false);
          xMA2 = offsetSeries(eval(sma)(25,eval(close)(sym(vSymbol1 ))),0, false);
          bInit1 = true;
          }

          RFT = (getSeries(xMA1) - getSeries(xMA2));

          if (RFT >= 0) {
          paa1 = 0.5;
          setBarThickness(3, 0);
          setBarFgColor(Color.blue, 0);
          }

          if (RFT < 0) {
          paa1 = 0;
          setBarThickness(1, 0);
          setBarFgColor(Color.black, 0);
          }

          if (RFT <= 0) {
          paa11 = -0.5;
          setBarThickness(3, 1);
          setBarFgColor(Color.red, 1);
          }

          if (RFT > 0) {
          paa11 = 0;
          setBarThickness(1, 1);
          setBarFgColor(Color.black, 1);
          }

          return new Array(paa1, paa11, pp, qq, ww);
          }

          Comment

          Working...
          X