Announcement

Collapse
No announcement yet.

inside bar alarm problems

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

  • inside bar alarm problems

    efs seems to work on historical price.. but in real tie it puts a circle on every new bar formed.

    Any suggestions?
    Thank you

    Provided By : eSignal (c) Copyright 2007
    ****************************************/

    function preMain() {
    setPriceStudy(true);
    setStudyTitle("Insidebar");
    setShowCursorLabel(false);
    setShowTitleParameters(false);
    setPlotType(PLOTTYPE_CIRCLE, 0);
    setDefaultBarThickness(5, 0);

    var fp1 = new FunctionParameter("cColor", FunctionParameter.COLOR);
    fp1.setName("Color");
    fp1.setDefault(Color.blue);
    var fp2 = new FunctionParameter("nSize", FunctionParameter.NUMBER);
    fp2.setName("Size");
    fp2.setDefault(4);
    var fp3 = new FunctionParameter("bEnable", FunctionParameter.BOOLEAN);
    fp3.setName("Enable Alerts");
    fp3.setDefault(true);
    }

    var bInit = false;
    var bAlert = false;

    function main(cColor, nSize, bEnable) {
    if (bInit == false) {
    setDefaultBarThickness(nSize, 0);
    setDefaultBarFgColor(cColor, 0);
    }

    if (getBarState() == BARSTATE_NEWBAR) {
    if (bAlert == true && bEnable == true) {
    Alert.playSound("pop.wav");
    Alert.addToList(getSymbol(), "Insidebar", cColor, Color.white);
    }
    bAlert = false;
    }

    if (high(0) < high(-1) && low(0) > low(-1) ) {

    {
    bAlert = true;
    }
    }

    if (bAlert == true) {
    return close(0);
    } else {
    return;
    }
    }

  • #2
    Re: inside bar alarm problems

    jand1
    Replace this whole section of code in your efs (in which BTW you have some redundant brackets)
    PHP Code:
    if (high(0) < high(-1) && low(0) > low(-1) ) { 

             {

                
    bAlert true;

            } 

        } 
    with the following
    PHP Code:
    if (high(0) < high(-1) && low(0) > low(-1) ) {
            
    bAlert true;
        } else {
            
    bAlert false;
        } 
    This modification should resolve the problem in the code logic
    Alex


    Originally posted by jand1
    efs seems to work on historical price.. but in real tie it puts a circle on every new bar formed.

    Any suggestions?
    Thank you

    Provided By : eSignal (c) Copyright 2007
    ****************************************/

    function preMain() {
    setPriceStudy(true);
    setStudyTitle("Insidebar");
    setShowCursorLabel(false);
    setShowTitleParameters(false);
    setPlotType(PLOTTYPE_CIRCLE, 0);
    setDefaultBarThickness(5, 0);

    var fp1 = new FunctionParameter("cColor", FunctionParameter.COLOR);
    fp1.setName("Color");
    fp1.setDefault(Color.blue);
    var fp2 = new FunctionParameter("nSize", FunctionParameter.NUMBER);
    fp2.setName("Size");
    fp2.setDefault(4);
    var fp3 = new FunctionParameter("bEnable", FunctionParameter.BOOLEAN);
    fp3.setName("Enable Alerts");
    fp3.setDefault(true);
    }

    var bInit = false;
    var bAlert = false;

    function main(cColor, nSize, bEnable) {
    if (bInit == false) {
    setDefaultBarThickness(nSize, 0);
    setDefaultBarFgColor(cColor, 0);
    }

    if (getBarState() == BARSTATE_NEWBAR) {
    if (bAlert == true && bEnable == true) {
    Alert.playSound("pop.wav");
    Alert.addToList(getSymbol(), "Insidebar", cColor, Color.white);
    }
    bAlert = false;
    }

    if (high(0) < high(-1) && low(0) > low(-1) ) {

    {
    bAlert = true;
    }
    }

    if (bAlert == true) {
    return close(0);
    } else {
    return;
    }
    }

    Comment


    • #3
      Hi, I wonder whether anybody can help, I tried editing that code below, I think I followed instruction correctly but still getting an error message:

      Provided By : eSignal (c) Copyright 2007
      ****************************************/

      function preMain() {
      setPriceStudy(true);
      setStudyTitle("Insidebar");
      setShowCursorLabel(false);
      setShowTitleParameters(false);
      setPlotType(PLOTTYPE_CIRCLE, 0);
      setDefaultBarThickness(5, 0);

      var fp1 = new FunctionParameter("cColor", FunctionParameter.COLOR);
      fp1.setName("Color");
      fp1.setDefault(Color.blue);
      var fp2 = new FunctionParameter("nSize", FunctionParameter.NUMBER);
      fp2.setName("Size");
      fp2.setDefault(4);
      var fp3 = new FunctionParameter("bEnable", FunctionParameter.BOOLEAN);
      fp3.setName("Enable Alerts");
      fp3.setDefault(true);
      }

      var bInit = false;
      var bAlert = false;

      function main(cColor, nSize, bEnable) {
      if (bInit == false) {
      setDefaultBarThickness(nSize, 0);
      setDefaultBarFgColor(cColor, 0);
      }

      if (getBarState() == BARSTATE_NEWBAR) {
      if (bAlert == true && bEnable == true) {
      Alert.playSound("pop.wav");
      Alert.addToList(getSymbol(), "Insidebar", cColor, Color.white);
      }
      bAlert = false;
      }

      if (high(0) < high(-1) && low(0) > low(-1) ) {

      bAlert = true;

      } else {

      bAlert = false;

      }

      if (bAlert == true) {
      return close(0);
      } else {
      return;
      }
      }

      Comment


      • #4
        J123
        The error is caused by the following line in the script
        Provided By : eSignal (c) Copyright 2007
        which is missing the characters /* at the beginning of the line ie
        /*Provided By : eSignal (c) Copyright 2007
        that are used to start a comment block
        Once you add those characters the formula should no longer return an error
        Alex


        Originally posted by J123
        Hi, I wonder whether anybody can help, I tried editing that code below, I think I followed instruction correctly but still getting an error message:

        Provided By : eSignal (c) Copyright 2007
        ****************************************/

        function preMain() {
        setPriceStudy(true);
        setStudyTitle("Insidebar");
        setShowCursorLabel(false);
        setShowTitleParameters(false);
        setPlotType(PLOTTYPE_CIRCLE, 0);
        setDefaultBarThickness(5, 0);

        var fp1 = new FunctionParameter("cColor", FunctionParameter.COLOR);
        fp1.setName("Color");
        fp1.setDefault(Color.blue);
        var fp2 = new FunctionParameter("nSize", FunctionParameter.NUMBER);
        fp2.setName("Size");
        fp2.setDefault(4);
        var fp3 = new FunctionParameter("bEnable", FunctionParameter.BOOLEAN);
        fp3.setName("Enable Alerts");
        fp3.setDefault(true);
        }

        var bInit = false;
        var bAlert = false;

        function main(cColor, nSize, bEnable) {
        if (bInit == false) {
        setDefaultBarThickness(nSize, 0);
        setDefaultBarFgColor(cColor, 0);
        }

        if (getBarState() == BARSTATE_NEWBAR) {
        if (bAlert == true && bEnable == true) {
        Alert.playSound("pop.wav");
        Alert.addToList(getSymbol(), "Insidebar", cColor, Color.white);
        }
        bAlert = false;
        }

        if (high(0) < high(-1) && low(0) > low(-1) ) {

        bAlert = true;

        } else {

        bAlert = false;

        }

        if (bAlert == true) {
        return close(0);
        } else {
        return;
        }
        }

        Comment


        • #5
          Hi Alexis, thank you so much for your help, that seems to have fixed it!

          Comment


          • #6
            J123
            My pleasure
            Alex


            Originally posted by J123
            Hi Alexis, thank you so much for your help, that seems to have fixed it!

            Comment

            Working...
            X