Announcement

Collapse
No announcement yet.

Alert.addToList not running

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

  • Alert.addToList not running

    I'm trying to run Alert.addToList... but when I load this script it doesn't output anything. However if I click the "syntax check" button in EFS editor, the alerts output... but if I remove/load or reload this script, the alerts never generate...

    I have two other scripts that use alerts successfully, but for some reason I can't have more than two EFS scripts that use addToList??? what am I doing wrong? has anybody seen this before?

    Code:
    function preMain() {}
    
    var thrice = true;
    
    function main() {
    
    if (thrice) {
        thrice = false;
        debugPrintln("thrice");
        Alert.addToList( "IBM", "Breakout!", Color.green, Color.black ); 
        Alert.addToList(getSymbol(),"test",Color.blue,Color.black);
    
    }
    
    }

  • #2
    I think it's because alerts only get generated if they are triggered on the LAST bar of the chart.

    Try changing:

    if(thrice)

    to:

    if (thrice==true &&
    isLastBarOnChart()==true)

    Hope that helps.

    Comment


    • #3
      that's it

      yup that was the problem, didn't know that (not in the documentation for that function)... thanks!

      Comment

      Working...
      X