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

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.
    JesseNinjaTrader Customer Service

    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 proptrade13, Today, 11:06 AM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by quantismo, 04-17-2024, 05:13 PM
          4 responses
          30 views
          0 likes
          Last Post quantismo  
          Started by love2code2trade, 04-17-2024, 01:45 PM
          4 responses
          31 views
          0 likes
          Last Post love2code2trade  
          Started by cls71, Today, 04:45 AM
          2 responses
          10 views
          0 likes
          Last Post eDanny
          by eDanny
           
          Started by kulwinder73, Today, 10:31 AM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_Erick  
          Working...
          X