• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Making an Alert on conditional indicator

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

    Making an Alert on conditional indicator

    Code:
    protected override void OnBarUpdate()
            {
                // Use this method for calculating your indicator values. Assign a value to each
                // plot below by replacing 'Close[0]' with your own formula.
    			
    			if (MACD(12,26,9).Diff[0] > 0 && MACD(12,26,9)[0] > 0)
          			BarColor = Color.Green;
    				
    			else if (MACD(12,26,9).Diff[0] < 0 && MACD(12,26,9)[0] < 0)
          			BarColor = Color.Red;
    			
            }
    How would you program this to play an audible alert on a green bar being made and a seperate one for the red bar color. THanks.

    #2
    Use PlaySound().

    Code:
    if (....)
    {
         BarColor = Color.Green;
         PlaySound(@"C:\mySound.wav");
    }
    Josh P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by bosajin, Today, 02:06 PM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_ChrisL  
    Started by jaboo, Today, 11:53 AM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by iq200, Today, 02:32 PM
    1 response
    3 views
    0 likes
    Last Post NinjaTrader_Melissa  
    Started by egurenk, Today, 09:49 AM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_Kate  
    Started by teafortwo, Today, 02:05 PM
    1 response
    4 views
    0 likes
    Last Post NinjaTrader_Jim  
    Working...
    X