Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Sound if else

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

    Sound if else


    I have an indicator with if with 7 or 8 else if I have put a sound option in an "else if" but once it is executed, the sound is executed 8 times in a row ... I have tried to put the sound out but when it is executed the same thing happens, how can I break the sound so that a sound is executed? once? if {} else if {} else if { Alert(CurrentBar.ToString(), Priority.High, "Alert4", WAVFileName1, 1, Brushes.White, Brushes.Green);} else if {} if{} .... etc

    #2
    Hello anmir55,

    Can you provide a larger sample of the logic used to control the alerts?

    If you are hearing the sound 8 times that would mean the logic was called 8 times. It sounds like you tried what I would suggest or to move the Alert to another area however I would need to see what you did to understand why that's not working.

    I would need to see a more specific example of the syntax to know why it was called more than once.

    I look forward to being of further assistance.

    Comment


      #3
      Originally posted by anmir55 View Post
      I have an indicator with if with 7 or 8 else if I have put a sound option in an "else if" but once it is executed, the sound is executed 8 times in a row ... I have tried to put the sound out but when it is executed the same thing happens, how can I break the sound so that a sound is executed? once? if {} else if {} else if { Alert(CurrentBar.ToString(), Priority.High, "Alert4", WAVFileName1, 1, Brushes.White, Brushes.Green);} else if {} if{} .... etc
      It sounds like you may have spurious semicolons on your "if" clauses.

      Comment


        #4
        How can I identify them because if I delete them I will have a ninja compilation error ....

        Comment


          #5
          Hello anmir55,

          We would need to see more of a sample in this case, I agree with koganam it sounds like from the description your conditions are falling through in some way. From what has been provided I can't really see what may be happening, if you can provide the whole if statement you are using that would help, if that is a large section of code you may need to make a quick sample of your if statement and just include where you use the alert.

          I would also suggest using the "A" button at the top of the forums text editor, it will expand options including the "#" for wrapping code, this would be helpful so its not just a long line of text and keeps its spacing/doesn't loose any formatting.

          I look forward to being of further assistance.

          Comment


            #6
            Originally posted by anmir55 View Post
            How can I identify them because if I delete them I will have a ninja compilation error ....
            Just look at the lines to see if there is a terminal semi-colon. A common and annoying mistake that I have done many times.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            44 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            56 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            35 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by cmoran13, 04-16-2026, 01:02 PM
            0 responses
            95 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            57 views
            0 likes
            Last Post PaulMohn  
            Working...
            X