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

alerts

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

    alerts

    To get MFI to sound an alert if it crosses above or below 50 or to make the background color change with an indicator, does it require the strategy package upgrade?

    Also, where are the sounds located so i can add some new ones.

    #2
    simpletrades,

    You should be able to create alerts for it from the Market Analyzer without programming. Note that it won't necessarily be a CrossAbove/Below, but you can do > or <. CrossAbove/Below for the Market Analyzer will be available in NT7. The sounds are located at C:\Program Files\NinjaTrader 6.5\sounds directory.

    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Josh View Post
      simpletrades,

      You should be able to create alerts for it from the Market Analyzer without programming. Note that it won't necessarily be a CrossAbove/Below, but you can do > or <. CrossAbove/Below for the Market Analyzer will be available in NT7. The sounds are located at C:\Program Files\NinjaTrader 6.5\sounds directory.

      http://www.ninjatrader-support.com/H...onditions.html
      i can wait for v7, but without the crossover wording how would you make it not constantly sound ?

      Comment


        #4
        You can have it not rearm.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          not rearming

          Originally posted by NinjaTrader_Josh View Post
          You can have it not rearm.
          I have been trying to get a simple Line Cross Above alert not to sound multiple times once it has been hit, but then to remain available to sound the next bar. I can't figure it out.

          I have an indicator with 2 lines (upper and lower). If Close[0] crosses above the upper price, then sound an alert. If Close [0] crosses below the lower price, then sound a different sounding alert. It works fine, although terribly clunky since I can't move the line with the mouse, but it sounds multiple times per bar and I would like it to just sound once and then be available to sound again any following bar. I have managed to make it sound just once with a boolean condition, but can't figure out how to reset the boolean for the next bar.

          Any (relatively) precise tips on how to do this?

          Comment


            #6
            Please provide the code you are using.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Josh View Post
              Please provide the code you are using.
              /// <summary>
              /// Two alerts, one crossing above, one crossing below
              /// </summary>
              [Description("Two alerts, one crossing above, one crossing below")]
              public class AlertLines : Indicator
              {
              #region Variables
              // Wizard generated variables
              private double upperPrice = 990; // Default setting for UpperPrice
              private double lowerPrice = 980; // Default setting for LowerPrice
              private bool warningup = false;
              private bool warningdown = false;
              // User defined variables (add any user defined variables below)
              #endregion

              /// <summary>
              /// This method is used to configure the indicator and is called once before any bar data is loaded.
              /// </summary>
              protected override void Initialize()
              {
              Add(new Plot(Color.FromKnownColor(KnownColor.HotPink), PlotStyle.Line, "Above"));
              Add(new Plot(Color.FromKnownColor(KnownColor.DodgerBlue), PlotStyle.Line, "Below"));
              Plots[0].Pen.DashStyle = DashStyle.Dash;
              Plots[1].Pen.DashStyle = DashStyle.Dash;

              if (warningup == true || warningdown == true)
              warningup = false; warningdown = false;

              CalculateOnBarClose = false;
              Overlay = true;
              PriceTypeSupported = false;
              }

              /// <summary>
              /// Called on each bar update event (incoming tick)
              /// </summary>
              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.
              Above.Set(upperPrice);
              Below.Set(lowerPrice);

              //if (CountIf(delegate {return CrossAbove(Close,upperPrice,1);}, 1) <= 1)
              //{warningup = false;}

              if (CrossAbove(Close,upperPrice,1) )
              {Alert("LineAlertUp",NinjaTrader.Cbi.Priority.Low, "LineCrossUp","Alert3.wav",6,Color.Black,Color.Yel low);warningup = true;}
              if (CrossBelow(Close,lowerPrice,1))
              {Alert("LineAlertDown",NinjaTrader.Cbi.Priority.Lo w,"LineCrossDown","bonk.wav",6,Color.Black,Color.Y ellow);warningdown = true;}
              }

              Now this is the current working version with the booleans warningup and warningdown being essentially disabled. When enabled the last 2 lines look like:

              if (CrossAbove(Close,upperPrice,1) && warningup == false
              {Alert("LineAlertUp",NinjaTrader.Cbi.Priority.Low, "LineCrossUp","Alert3.wav",6,Color.Black,Color.Yel low);warningup = true;}
              if (CrossBelow(Close,lowerPrice,1) && warningdown == false)
              {Alert("LineAlertDown",NinjaTrader.Cbi.Priority.Lo w,"LineCrossDown","bonk.wav",6,Color.Black,Color.Y ellow);warningdown = true;}

              +++++++++++

              The Countiff is an attempt that didn't do anything.
              I have tried putting the lines that set the warningup and warningdown back to false in the OnBarupdate versus Initialize section but whenever I have the warnings included in the Alert coding, they just sound once, then the boolean condition goes to true, and I can't get it to 'rearm' or go back to false at the beginning of the next bar.

              (The way I would like to use these is simply that once an alarm is hit, I can either leave it silent as is, or set a new alert level in the Indicator Menu. I like alerts for those times I step away from the computer to do something basically.)

              Comment


                #8
                Try something like this to reset the bool on the new bar.
                Code:
                OnBarUpdate()
                {
                     if (FirstTickOfBar)
                     {
                          warningup = true;
                          warningdown = true;
                     }
                
                     if (CrossAbove....)
                     {
                           Alert(...);
                           warningup = false;
                     }
                }
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Thanks, Josh. Works perfect!

                  Comment


                    #10
                    Originally posted by NinjaTrader_Josh View Post
                    Try something like this to reset the bool on the new bar.
                    Code:
                    OnBarUpdate()
                    {
                         if (FirstTickOfBar)
                         {
                              warningup = true;
                              warningdown = true;
                         }
                    
                         if (CrossAbove....)
                         {
                               Alert(...);
                               warningup = false;
                         }
                    }
                    +++++++++++

                    Have had many problems today with Ninja. Had to restore from a few days ago to get it to work. But then on opening a new workspace after using it for an hour or so live, the charts wouldn't open up with any historical data.

                    In the log I have an error that the AlertLines indicator needs to be serialized but I can't find any information about serialization in the Help Menu.

                    I have added in the XML ignore in the Properties section to the Plots but it would be good to get this serialization issue cleared up so that if there are other problems with the overall platform I can deal with them.

                    Comment


                      #11
                      See http://www.ninjatrader-support2.com/...ead.php?t=4977 for serialization.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_Josh View Post
                        Thanks Josh. I deleted the indicator to reduce platform malfunctions but will go back in there later and see if I can figure out how to serialize the Upper and Lower price inputs, which I suspect are the problem.

                        Suggestion: include something about 'serialization' in the Help Menu. It doesn't come up on any searches except as part of something that doesn't explain anything to do with this.

                        Comment


                          #13
                          cclsys, thanks for the suggestion.
                          BertrandNinjaTrader Customer Service

                          Comment


                            #14
                            Hi - I was looking for a cross over alert on google and ran across this thread. I can't seem to find the cross over option anywhere in MA. Am I missing something or has this been postponed?

                            Thanks!

                            Comment


                              #15
                              Day Trading Fool,

                              Cross over conditions are already available in the MA. Please bring up the MA, right click > Columns, select a Column, go to Alert conditions, in the Condition drop down you can find "Cross above" and "Cross below".
                              Josh P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Balage0922, Today, 07:38 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post Balage0922  
                              Started by JoMoon2024, Today, 06:56 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post JoMoon2024  
                              Started by Haiasi, 04-25-2024, 06:53 PM
                              2 responses
                              19 views
                              0 likes
                              Last Post Massinisa  
                              Started by Creamers, Today, 05:32 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post Creamers  
                              Started by Segwin, 05-07-2018, 02:15 PM
                              12 responses
                              1,786 views
                              0 likes
                              Last Post Leafcutter  
                              Working...
                              X