Announcement

Collapse
No announcement yet.

efs alerts in 11.3?

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

  • efs alerts in 11.3?

    I'm trying without success to get alerts to fire in efs. First, I went to the "Trade" drop-down and set up email--a test works as it's supposed to. I also set a simple "price above" alert in the alert list, and it sounds (with "train.wav") and emails, as advertised.

    But I can't make these things happen in efs:

    I added these lines to some code that fires upon startup of a script:

    Alert.email( "email test" );
    Alert.playSound( "train.wav" );
    Alert.addToList( "IBM", "Breakout!", Color.green, Color.black );
    debugPrintln( "did email go?" );

    The debug line prints to the formula output, the indicator loads and displays as it should, but none of the alert functions occur.

    What am I doing wrong?

  • #2
    Re: efs alerts in 11.3?

    snovotny
    Alerts are executed only at bar index 0 [ie the most recent/current bar]
    Alex


    Originally posted by snovotny
    I'm trying without success to get alerts to fire in efs. First, I went to the "Trade" drop-down and set up email--a test works as it's supposed to. I also set a simple "price above" alert in the alert list, and it sounds (with "train.wav") and emails, as advertised.

    But I can't make these things happen in efs:

    I added these lines to some code that fires upon startup of a script:

    Alert.email( "email test" );
    Alert.playSound( "train.wav" );
    Alert.addToList( "IBM", "Breakout!", Color.green, Color.black );
    debugPrintln( "did email go?" );

    The debug line prints to the formula output, the indicator loads and displays as it should, but none of the alert functions occur.

    What am I doing wrong?

    Comment


    • #3
      I entered this code further down:

      if(getDay(0) == 25 && getDay(-1) == 23){
      Alert.email( "email test" );
      Alert.playSound( "train.wav" );
      Alert.addToList( "IBM", "Breakout!", Color.green, Color.black );
      debugPrintln( getDay(0), " ", getDay(-1) );
      }

      I got a single '25 23' in the formula Output window, but nothing else.

      Comment


      • #4
        Ah! OK. I tried this and it worked:

        if(getMinute(0) == 40 && getSecond(0) == 15){
        Alert.email( "email test" );
        Alert.playSound( "train.wav" );
        Alert.addToList( "IBM", "Breakout!", Color.green, Color.black );
        debugPrintln( getDay(0), " ", getDay(-1) );
        }

        This was on a 15 second chart. When the new bar hit that time, everything worked as it should.

        THANKS!
        Last edited by snovotny; 09-26-2011, 09:46 PM.

        Comment


        • #5
          but this is interesting...

          When I put setComputeOnClose() in preMain, with:

          if(getMinute(0) == 46 && getSecond(0) == 15){
          Alert.email( "email test" );
          Alert.playSound( "train.wav" );
          Alert.addToList( "IBM", "Breakout!", Color.green, Color.black );
          debugPrintln( getDay(0), " ", getDay(-1) );

          I got a single alert (instead of every new tick), but the alert occurred on bar with time: xx:46:30.

          How is that? Actually, there IS no "bar index 0" on setComputeOnClose(), right?

          Comment


          • #6
            Re: but this is interesting...

            snovotny
            That is because setComputeOnClose() forces the formula to wait until the bar at index 0 is completed and moved to bar index -1 [which occurs only at the open of a new bar that will now be at index 0] at which point the formula is executed one time only.
            In your case the efs was not executed on the xx:46:15 bar while this was at index 0 but only when it was moved to index -1 which occurred when the new bar time stamped xx:46:30 [now at bar index 0] was created
            Alex


            Originally posted by snovotny
            When I put setComputeOnClose() in preMain, with:

            if(getMinute(0) == 46 && getSecond(0) == 15){
            Alert.email( "email test" );
            Alert.playSound( "train.wav" );
            Alert.addToList( "IBM", "Breakout!", Color.green, Color.black );
            debugPrintln( getDay(0), " ", getDay(-1) );

            I got a single alert (instead of every new tick), but the alert occurred on bar with time: xx:46:30.

            How is that? Actually, there IS no "bar index 0" on setComputeOnClose(), right?

            Comment

            Working...
            X