Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

trigger for PlaySound()

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

    trigger for PlaySound()

    Hey, can some post a basic code snippet to play a sound when a certain unrealized profit is reached? (say..$200) Ive tried several approaches but i can't seem to get the sound to play :-\

    #2
    Hi BishopM05,

    This expression can be created in the condition builder interface. I've attached screenshot of this setup and code snippet generated.

    // Condition set 1
    if (Position.GetProfitLoss(Close[0], PerformanceUnit.Currency) == 200)
    {
    PlaySound("");
    }
    Attached Files
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks Ryan, i'm currently using that expression..i just thought it was incorrect, but maybe i missed something. I'll recheck what i have when i can get back to my computer.

      Comment


        #4
        Maybe change operator to >=, that checks unrealized pnl is greater than or equal to. If your Pnl is not exactly equal to 200, the == condition would not trigger. PlaySound is also a real time only action.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Thanks again, the >= did the trick...

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          88 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          48 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          30 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          34 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          68 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X