Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

PriceOscillator alert

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

    PriceOscillator alert

    Hi, I would like to add 2 alerts to the PriceOscillator indicator when it crosses the zero line (from previous bar it passes from negative to positive or viceversa).

    How can I do it or when can I find some code of example? I tried by myself but without result.

    thanks in advance

    #2
    Hello,

    you can do this using the code sample below, you will need to create a copy of the original script as you can not save changes to the included scripts, here are the steps:

    Click Tools -> Edit NinjaScript -> Indicator -> Price Oscillator
    Right click in the script and click Save As.
    Give the file a name and press OK.
    Now the script that is open will be the new file you just saved.

    The code would look like the following:

    Code:
    if(CrossAbove(Value, 0, 1))
    {
    	Alert("myAlert1", NinjaTrader.Cbi.Priority.High, "Reached threshold", "Alert1.wav", 10, Color.Black, Color.Yellow);
    } 
    else if(CrossBelow(Value, 0, 1))
    {
    	Alert("myAlert2", NinjaTrader.Cbi.Priority.High, "Reached threshold", "Alert1.wav", 10, Color.Black, Color.Yellow);	
    }
    This would go directly below the existing line:

    Code:
    Value.Set(EMA(smoothEma, Smooth)[0]);
    The methods used are in the help guide here:





    I look forward to being of further assistance.

    Comment


      #3
      Great!! very fast and detailed. Tomorrow I will try.

      thanks

      Comment


        #4
        I followed the instructions: the sound is played every time zero is crossed but a pop up with the message doesn't appear. Any suggestion? I attach the script of the indicator modified thanks
        Attached Files

        Comment


          #5
          Hello gimir,
          Thanks for the reply.

          The indicator is currently coded for to create and alert.

          The Alert() method does not create a pop up. Creating a pop up is not supported using NinjaScript.

          However, this has been discussed in a previous forum post. This can be done using the standard C# library.

          Here is a link to a forum post discussing how to accomplish this. http://www.ninjatrader-support2.com/...p+alert+window

          Please let us know if we may be of further assistance for anything NinjaTrader.
          Alex G.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          571 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          331 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          549 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          549 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X