Announcement

Collapse
No announcement yet.

Alert Problem.

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

  • Alert Problem.

    Hi,
    i am having a problem with EFS. the problem is whenever a alert is issued it doesnt stop it continuously send alert until the bar is closed e.g. when i add the efs to a 5min chart and after 3min the condition are meet and alert is issued till than it ok but as price move up in the same bar it issue alert again and again until the bar is closed. Could u pls advised what to add so it doesnt issue more than 1 alert in the same bar. Below is the efs.

    function preMain() {
    setPriceStudy(true);
    setStudyTitle("Blue Squat");
    setShowCursorLabel(false);
    setShowTitleParameters(false);
    }

    function main() {

    //If current bar high is higher than previous 5 bars high
    var condition1 = high(0)>Math.max(high(-1),high(-2),high(-3),high(-4),high(-5));

    // If current bar close, lower than previous 1 bar close
    var condition2 = close(0)<close(-1);

    //if both are true, draw round colored dot at the top of current bar
    if(condition1 && condition2){
    drawShape( Shape.CIRCLE, AboveBar1, Color.blue);
    Alert.addToList(getSymbol(), "Short" + " " + getSymbol() + " " + getInterval(), Color.red, Color.black);
    Alert.playSound("Bullet.wav");
    }

    // If current bar low is lower than previous 5 bars low
    var condition3 = low(0)<Math.min(low(-1),low(-2),low(-3),low(-4),low(-5));

    // If current bar close, higher than previous 1 bar close
    var condition4 = close(0)>close(-1);

    //if both are true, draw round colored dot at the bottom of current bar
    if(condition3 && condition4){
    drawShape( Shape.CIRCLE, BelowBar1, Color.blue);
    Alert.addToList(getSymbol(), "Long" + " " + getSymbol() + " " + getInterval(), Color.lime, Color.black);
    Alert.playSound("Bullet.wav");

    }

    Thanks.
    Suharwardi.

  • #2
    Re: Alert Problem.

    Suharwardi
    See this thread for an example of how to write an alert that will be triggered only once on each bar
    Alex


    Originally posted by suharwardi
    Hi,
    i am having a problem with EFS. the problem is whenever a alert is issued it doesnt stop it continuously send alert until the bar is closed e.g. when i add the efs to a 5min chart and after 3min the condition are meet and alert is issued till than it ok but as price move up in the same bar it issue alert again and again until the bar is closed. Could u pls advised what to add so it doesnt issue more than 1 alert in the same bar. Below is the efs.

    function preMain() {
    setPriceStudy(true);
    setStudyTitle("Blue Squat");
    setShowCursorLabel(false);
    setShowTitleParameters(false);
    }

    function main() {

    //If current bar high is higher than previous 5 bars high
    var condition1 = high(0)>Math.max(high(-1),high(-2),high(-3),high(-4),high(-5));

    // If current bar close, lower than previous 1 bar close
    var condition2 = close(0)<close(-1);

    //if both are true, draw round colored dot at the top of current bar
    if(condition1 && condition2){
    drawShape( Shape.CIRCLE, AboveBar1, Color.blue);
    Alert.addToList(getSymbol(), "Short" + " " + getSymbol() + " " + getInterval(), Color.red, Color.black);
    Alert.playSound("Bullet.wav");
    }

    // If current bar low is lower than previous 5 bars low
    var condition3 = low(0)<Math.min(low(-1),low(-2),low(-3),low(-4),low(-5));

    // If current bar close, higher than previous 1 bar close
    var condition4 = close(0)>close(-1);

    //if both are true, draw round colored dot at the bottom of current bar
    if(condition3 && condition4){
    drawShape( Shape.CIRCLE, BelowBar1, Color.blue);
    Alert.addToList(getSymbol(), "Long" + " " + getSymbol() + " " + getInterval(), Color.lime, Color.black);
    Alert.playSound("Bullet.wav");

    }

    Thanks.
    Suharwardi.

    Comment


    • #3
      Re: Re: Alert Problem.

      Thanks for the help it worked!

      best regards
      suharwardi

      Originally posted by Alexis C. Montenegro
      Suharwardi
      See this thread for an example of how to write an alert that will be triggered only once on each bar
      Alex

      Comment


      • #4
        Re: Re: Re: Alert Problem.

        suharwardi
        My pleasure
        Alex


        Originally posted by suharwardi
        Thanks for the help it worked!

        best regards
        suharwardi

        Comment

        Working...
        X