Announcement

Collapse
No announcement yet.

isIntraday() and getInterval() returning wrong information

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

  • isIntraday() and getInterval() returning wrong information

    Hi,

    I am writing a new efs script. In this script I am trying to use isIntraday() to check if the chart is an intraday chart. I have a 260 bar time template. For some reason the isIntraday() is returning D even if my chart is showing 30 min chart. I tried to check this by printing getInterval() and it also shows D instead of 30. I am baffled. I have looked in the forums and have not seen anything like this. The code is below. Any help would be greatly appreciated.

    Regards,
    Jane

    var aFPArray = new Array();

    function preMain() {
    var dateObject = new Date();
    var defaultDate = dateObject.getFullYear()*10000+(dateObject.getMont h()+1)*100+dateObject.getDate();
    var x;
    setPriceStudy(true);
    setStudyTitle("CycleAdder");
    setShowTitleParameters( false );
    setShowCursorLabel(false); // supresses this study's label in cursor window
    setComputeOnClose(); // forces this study to only update on each new bar

    //initialize formula parameters
    x=0;
    aFPArray[x] = new FunctionParameter("lowDate", FunctionParameter.NUMBER);
    with(aFPArray[x++]) {
    setName("Low Date");
    setDefault(defaultDate);
    }
    aFPArray[x] = new FunctionParameter("lowTime", FunctionParameter.STRING);
    with(aFPArray[x++]) {
    setName("Low Time");
    setDefault("1600");
    }
    aFPArray[x] = new FunctionParameter("period1", FunctionParameter.NUMBER);
    with(aFPArray[x++]) {
    setName("Period 1");
    setLowerLimit(1);
    setDefault(38);
    }
    aFPArray[x] = new FunctionParameter("period2", FunctionParameter.NUMBER);
    with(aFPArray[x++]) {
    setName("Period 2");
    setLowerLimit(1);
    setDefault(19);
    }
    aFPArray[x] = new FunctionParameter("skew2", FunctionParameter.NUMBER);
    with(aFPArray[x++]) {
    setName("Skew 2");
    setDefault(0);
    }
    aFPArray[x] = new FunctionParameter("amp1", FunctionParameter.NUMBER);
    with(aFPArray[x++]) {
    setName("Amplitude 1");
    setLowerLimit(1);
    setDefault(10);
    }
    aFPArray[x] = new FunctionParameter("amp2", FunctionParameter.NUMBER);
    with(aFPArray[x++]) {
    setName("Amplitude 2");
    setLowerLimit(1);
    setDefault(5);
    }
    aFPArray[x] = new FunctionParameter("show2", FunctionParameter.BOOLEAN);
    with(aFPArray[x++]) {
    setName( "Show 2");
    addOption(true);
    addOption(false);
    setDefault(true);
    }
    aFPArray[x] = new FunctionParameter("showSum", FunctionParameter.BOOLEAN);
    with(aFPArray[x++]) {
    setName("Show Sum");
    addOption(true);
    addOption(false);
    setDefault(true);
    }
    aFPArray[x] = new FunctionParameter("barLength", FunctionParameter.NUMBER);
    with(aFPArray[x++]) {
    setName("Bar Length");
    setLowerLimit(1);
    setDefault(260);
    }
    aFPArray[x] = new FunctionParameter("degrees", FunctionParameter.NUMBER);
    with(aFPArray[x++]) {
    setName("Degrees");
    setLowerLimit(-360);
    setUpperLimit(360);
    setDefault(270);
    }
    askForInput("CycleAdder"); // force the script parameter menu to be displayed when the script
    // is first loaded.
    }

    function main(lowDate, lowTime, period1, period2, skew2, amp1, amp2, show2, showSum, barLength, degrees) {
    var angFreq1 = 0;
    var angFreq2 = 0;
    var lowBar = 50;
    var backPlot = 0;
    var phase1 = 0;
    var phase2 = 0;
    var numbBar = 253;
    var barsToLow = 0;
    var totalBars = 0;
    var barsFromEnd = 0;
    var loopCount = 0;
    var textStr1 = 0;
    var highMax = 0;
    var lowMax = 99999;

    if(getCurrentBarIndex() == 0) {
    if(period1 != 0) angFreq1 = 360/period1;
    if(period2 != 0) angFreq2 = 360/period2;
    } else {
    return;
    }
    debugPrintln(lowDate, "1 ");
    debugPrintln(getInterval(), "2 ");
    debugPrintln(isIntraday(), "3 ");
    return 0;
    }

  • #2
    Re: isIntraday() and getInterval() returning wrong information

    Jane
    As far as I can see getInterval() and isIntraday() are returning the correct information (see enclosed screenshot)
    FWIW your script is also returning 30 and true when the chart is set to 30 minutes
    Alex




    Originally posted by jg
    Hi,

    I am writing a new efs script. In this script I am trying to use isIntraday() to check if the chart is an intraday chart. I have a 260 bar time template. For some reason the isIntraday() is returning D even if my chart is showing 30 min chart. I tried to check this by printing getInterval() and it also shows D instead of 30. I am baffled. I have looked in the forums and have not seen anything like this. The code is below. Any help would be greatly appreciated.

    Regards,
    Jane

    var aFPArray = new Array();

    function preMain() {
    var dateObject = new Date();
    var defaultDate = dateObject.getFullYear()*10000+(dateObject.getMont h()+1)*100+dateObject.getDate();
    var x;
    setPriceStudy(true);
    setStudyTitle("CycleAdder");
    setShowTitleParameters( false );
    setShowCursorLabel(false); // supresses this study's label in cursor window
    setComputeOnClose(); // forces this study to only update on each new bar

    //initialize formula parameters
    x=0;
    aFPArray[x] = new FunctionParameter("lowDate", FunctionParameter.NUMBER);
    with(aFPArray[x++]) {
    setName("Low Date");
    setDefault(defaultDate);
    }
    aFPArray[x] = new FunctionParameter("lowTime", FunctionParameter.STRING);
    with(aFPArray[x++]) {
    setName("Low Time");
    setDefault("1600");
    }
    aFPArray[x] = new FunctionParameter("period1", FunctionParameter.NUMBER);
    with(aFPArray[x++]) {
    setName("Period 1");
    setLowerLimit(1);
    setDefault(38);
    }
    aFPArray[x] = new FunctionParameter("period2", FunctionParameter.NUMBER);
    with(aFPArray[x++]) {
    setName("Period 2");
    setLowerLimit(1);
    setDefault(19);
    }
    aFPArray[x] = new FunctionParameter("skew2", FunctionParameter.NUMBER);
    with(aFPArray[x++]) {
    setName("Skew 2");
    setDefault(0);
    }
    aFPArray[x] = new FunctionParameter("amp1", FunctionParameter.NUMBER);
    with(aFPArray[x++]) {
    setName("Amplitude 1");
    setLowerLimit(1);
    setDefault(10);
    }
    aFPArray[x] = new FunctionParameter("amp2", FunctionParameter.NUMBER);
    with(aFPArray[x++]) {
    setName("Amplitude 2");
    setLowerLimit(1);
    setDefault(5);
    }
    aFPArray[x] = new FunctionParameter("show2", FunctionParameter.BOOLEAN);
    with(aFPArray[x++]) {
    setName( "Show 2");
    addOption(true);
    addOption(false);
    setDefault(true);
    }
    aFPArray[x] = new FunctionParameter("showSum", FunctionParameter.BOOLEAN);
    with(aFPArray[x++]) {
    setName("Show Sum");
    addOption(true);
    addOption(false);
    setDefault(true);
    }
    aFPArray[x] = new FunctionParameter("barLength", FunctionParameter.NUMBER);
    with(aFPArray[x++]) {
    setName("Bar Length");
    setLowerLimit(1);
    setDefault(260);
    }
    aFPArray[x] = new FunctionParameter("degrees", FunctionParameter.NUMBER);
    with(aFPArray[x++]) {
    setName("Degrees");
    setLowerLimit(-360);
    setUpperLimit(360);
    setDefault(270);
    }
    askForInput("CycleAdder"); // force the script parameter menu to be displayed when the script
    // is first loaded.
    }

    function main(lowDate, lowTime, period1, period2, skew2, amp1, amp2, show2, showSum, barLength, degrees) {
    var angFreq1 = 0;
    var angFreq2 = 0;
    var lowBar = 50;
    var backPlot = 0;
    var phase1 = 0;
    var phase2 = 0;
    var numbBar = 253;
    var barsToLow = 0;
    var totalBars = 0;
    var barsFromEnd = 0;
    var loopCount = 0;
    var textStr1 = 0;
    var highMax = 0;
    var lowMax = 99999;

    if(getCurrentBarIndex() == 0) {
    if(period1 != 0) angFreq1 = 360/period1;
    if(period2 != 0) angFreq2 = 360/period2;
    } else {
    return;
    }
    debugPrintln(lowDate, "1 ");
    debugPrintln(getInterval(), "2 ");
    debugPrintln(isIntraday(), "3 ");
    return 0;
    }

    Comment


    • #3
      Re: Re: isIntraday() and getInterval() returning wrong information

      Hi Alex,

      Thank you very much for your fast reply. I am completely confused. I am running this script on a stock, symbol HL, my chart states:

      (HL - HECLA MNG CO,30) 260 Bars,0:00-0:00

      and the script is returning:
      20081215 for date, D for getInterval() and false for isIntraday()

      I have reloaded, removed and reapplied, and I can't figure out why it's working on your computer and giving me the wrong info on mine. Is this a stock thing?
      Regards,
      Jane


      Originally posted by Alexis C. Montenegro
      Jane
      As far as I can see getInterval() and isIntraday() are returning the correct information (see enclosed screenshot)
      FWIW your script is also returning 30 and true when the chart is set to 30 minutes
      Alex

      Comment


      • #4
        Re: Re: Re: isIntraday() and getInterval() returning wrong information

        Jane
        I set up the same symbol, interval and Time Template and I am getting the correct values in the Formula Output window
        Alex




        Originally posted by jg
        Hi Alex,

        Thank you very much for your fast reply. I am completely confused. I am running this script on a stock, symbol HL, my chart states:

        (HL - HECLA MNG CO,30) 260 Bars,0:00-0:00

        and the script is returning:
        20081215 for date, D for getInterval() and false for isIntraday()

        I have reloaded, removed and reapplied, and I can't figure out why it's working on your computer and giving me the wrong info on mine. Is this a stock thing?
        Regards,
        Jane

        Comment


        • #5
          Hi Alex,

          Thank you very much again. I shut down eSignal, restarted the computer, restarted eSignal and the script is now working exactly the same way as you stated. I am not sure what happened and why but thank you very much. There must have been some glitch somewhere in my system. Once again, very many thanks.
          Regards,
          Jane

          Comment


          • #6
            Jane
            You are most welcome
            Alex


            Originally posted by jg
            Hi Alex,

            Thank you very much again. I shut down eSignal, restarted the computer, restarted eSignal and the script is now working exactly the same way as you stated. I am not sure what happened and why but thank you very much. There must have been some glitch somewhere in my system. Once again, very many thanks.
            Regards,
            Jane

            Comment

            Working...
            X