Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

No alert...

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

    No alert...

    Here is the script:
    Code:
     
    protected override void OnBarUpdate()
    {
    double MACDvalue = MACD(12, 26, 9)[0];
    if (MACDvalue < 0)
    {
    if (MACDpos == true)
    {
    Print(MACDvalue);
    Alert("CrossDown",Priority.High,"MACD is crossing down.","Alert2.wav",0,Color.Beige,Color.Black);
    MACDpos = false;
    MACDneg = true;
    }
    }
    if (MACDvalue > 0)
    {
    if (MACDneg == true)
    {
    Print(MACDvalue);
    Alert("CrossUp",Priority.High,"MACD is crossing up.","Alert2.wav",0,Color.Beige,Color.Black);
    MACDneg = false;
    MACDpos = true;
    }
    }
    }
    The Values are printing in output, but no Alert, what am I missing?

    #2
    Hello dhunnewell,

    The alerts will write to the alerts window. If yours are evaluating true but you don't see anything make sure you have a window open by going to File > New > Alert.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      I learn something every hour, however I have changed my script as follows and am using PlaySound instead of alert... Sound is not playing and there is no error in log... ?
      Code:
       
      protected override void OnBarUpdate()
      {
      double MACDvalue = MACD(12, 26, 9).Diff[0];
      if (MACDvalue < 0)
      {
      if (MACDpos == true)
      {
      PlaySound("Alert2");
      DrawTextFixed("MACDtext","MACD is a BEAR",TextPosition.BottomRight);
      MACDpos = false;
      MACDneg = true;
      }
      }
      if (MACDvalue > 0)
      {
      if (MACDneg == true)
      {
      PlaySound("Alert2");
      DrawTextFixed("MACDtext","MACD is a BULL",TextPosition.BottomRight);
      MACDneg = false;
      MACDpos = true;
      }
      }
      }

      Comment


        #4
        PlaySound() is looking for a sound file . You need to specify the complete path or simply the extension if the file is located in 'C:\Program Files\NinjaTrader\Sounds' folder. You could use
        Code:
        PlaySound("Alert2.wav");

        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        29 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        17 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        9 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        16 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        19 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X