Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Indicator with sound

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

    Indicator with sound

    Hi all,
    I would like to add a sound to CurrentDayOHL indicator.
    Whenever the price reaches new Low or High of the day, I would like to play it sound. How should I modify that indicator?
    Any help appreciated. Thanks a lot
    Godi

    #2
    Use "alert"

    Comment


      #3
      Reply

      I was thinking about function Playsound(@"C:\Buzzer.wav"); but I do not know where to paste it in that indicator

      Comment


        #4
        You would first of all need to create a condition that expresses when you want Alert or PlaySound to be called, like

        Code:
        if (High[0] > CurrentDayOHL().CurrentHigh[1])
                    {
                        PlaySound / RaiseAlert etc
                    }
        BertrandNinjaTrader Customer Service

        Comment


          #5
          I think that condotion is in that indicator already. It draws the line when new H/L appears and it calculates it each tick, not just at the end of time.
          I think, actual condition is:


          protected override void OnBarUpdate()
          {
          if (Bars.SessionBreak)
          {
          currentHigh = High[0];
          currentLow = Low[0];
          }

          currentHigh = Math.Max(currentHigh, High[0]);
          currentLow = Math.Min(currentLow, Low[0]);

          if (ShowHigh)
          {
          if (!PlotCurrentValue || currentHigh != High[0])
          CurrentHigh.Set(currentHigh);
          else
          for (int idx = 0; idx < CurrentHigh.Count; idx++)
          CurrentHigh.Set(idx, currentHigh);
          }

          if (ShowLow)
          {
          if (!PlotCurrentValue || currentLow != Low[0])
          CurrentLow.Set(currentLow);
          else
          for (int idx = 0; idx < CurrentLow.Count; idx++)
          CurrentLow.Set(idx, currentLow);
          }
          }


          I just donnt know where to paste the sound

          Comment


            #6
            Hi godiamond,

            This can be placed with the new High actions...

            Code:
            if (!PlotCurrentValue || currentHigh != High[0])
            {
            CurrentHigh.Set(currentHigh);
            PlaySound("sound file");
            }
            TimNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by zstheorist, Today, 07:52 PM
            0 responses
            3 views
            0 likes
            Last Post zstheorist  
            Started by pmachiraju, 11-01-2023, 04:46 AM
            8 responses
            149 views
            0 likes
            Last Post rehmans
            by rehmans
             
            Started by mattbsea, Today, 05:44 PM
            0 responses
            5 views
            0 likes
            Last Post mattbsea  
            Started by RideMe, 04-07-2024, 04:54 PM
            6 responses
            33 views
            0 likes
            Last Post RideMe
            by RideMe
             
            Started by tkaboris, Today, 05:13 PM
            0 responses
            5 views
            0 likes
            Last Post tkaboris  
            Working...
            X