Announcement

Collapse
No announcement yet.

Alert.playSound() only works on the last bar

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

  • Alert.playSound() only works on the last bar

    It seems Alert.playSound() works only if it is called while processing the last bar on the chart. For example, there are two testing scripting, one plays a sound at the barindex == -5 while another one plays a sound at bar 0.

    if ( getCurrentBarIndex() == -5 && getBarState() == BARSTATE_NEWBAR ) {
    Alert.playSound("Dong.wav");
    }



    if ( getCurrentBarIndex() == 0 && getBarState() == BARSTATE_NEWBAR ) {
    Alert.playSound("Dong.wav");
    }

    No sound is heard while running The first testing script although the function is called, and the second script works normally.

    Is this a designed behavior or it is an implementation bug of Alert.playSound()?

    - Clearpicks
    Last edited by clearpicks; 01-29-2008, 11:08 AM.

  • #2
    Re: Alert.playSound() only works on the last bar

    clearpicks
    That is the intended behavior. The Alert.xxx() functions execute only on bar index 0 (or bar index -1 when setComputeOnClose() is used)
    Alex


    Originally posted by clearpicks
    It seems Alert.playSound() works only if it is called while processing the last bar on the chart. For example, there are two testing scripting, one plays a sound at the barindex == -5 while another one plays a sound at bar 0.

    if ( getCurrentBarIndex() == -5 && getBarState() == BARSTATE_NEWBAR ) {
    Alert.playSound("Dong.wav");
    }



    if ( getCurrentBarIndex() == 0 && getBarState() == BARSTATE_NEWBAR ) {
    Alert.playSound("Dong.wav");
    }

    No sound is heard while running The first testing script although the function is called, and the second script works normally.

    Is this a designed behavior or it is an implementation bug of Alert.playSound()?

    - Clearpicks

    Comment

    Working...
    X