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

Market Analyzer Alert Message

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

    Market Analyzer Alert Message

    Is there a way to have this message contain a variable e.g the current value of an indicator?

    #2
    Not sure if this is what you need, but you could enter the trigger value into the MA message as text - http://www.ninjatrader-support.com/H...onditions.html

    If you want the alert to show you the value of the indicator at the time of the alert, you should custom code this using the Alert() method in the indicator directly.

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thank you,

      It looks like I need to use the Alert() method.
      Alert("myAlert", NinjaTrader.Cbi.Priority.High, "Reached threshold", "Alert1.wav", 10, Color.Black, Color.Yellow);

      How do I embed the value of a variable into the message?

      How do I set the trigger value and Indicator?

      I'm obviously new to this.

      Comment


        #4
        You can try something like this in the OnBarUpdate() of your indicator -

        Code:
         
        protected override void OnBarUpdate()
        {
        if (CurrentBar < 1) return;
        
        if (Close[0] > Close[1])
        Alert("Up", Priority.Medium, "Up with Close value" + " " + Close[0].ToString(), "Alert1.wav", 10, Color.Black, Color.Blue);
        }
        BertrandNinjaTrader Customer Service

        Comment


          #5
          I'm having problems:

          protected override void OnBarUpdate()
          {
          if (CurrentBar < 1) return;
          if Plot0.ContainsValue(0) > 0.5
          Alert("Up", Priority.Medium, "Up with Close value" + " " + projHigh.ToString(), "Alert1.wav", 10, Color.Black, Color.Blue);
          }

          I want to trigger on the current value of Plot0 defined earlier in the script
          I want to include the current value of the double projHigh defined earlier in the script in the message.

          Comment


            #6
            To check values you should use the [0] index instead of ContainsValue.

            Code:
            if (Plot0[0] > 0.5)
                // Do something;
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Sorry to keep bugging you.

              I'm still getting errors.

              protected override void OnBarUpdate()
              {
              if (CurrentBar < 1) return;
              if (Plot0 [0] > 0.5)
              Alert("Up", Priority.Medium, "Up with Close value" + " " + projHigh.ToString(), "Alert1.wav", 10, Color.Black, Color.Blue);
              }

              Comment


                #8
                Please provide the exact errors. Thank you.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  it's "protected override void OnBarUpdate()" is already in the code at the top.

                  If I delete the 2nd one I get a whole slew of errors

                  Indicator\GV_LynnDeesCriteria.cs Type 'NinjaTrader.Indicator.GV_LynnDeesCriteria' already defines a member called 'OnBarUpdate' with the same parameter types CS0111 - click for info 87 28

                  Comment


                    #10
                    jerryvellutini,

                    You cannot have two of the same methods. You need to put the code snippet inside the single OnBarUpdate() method.

                    Whatever is inside the { } is what needs to go into the original OnBarUpdate().
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      I did that.

                      NinjaScript File Error Code Line Column


                      Indicator\GV_LynnDeesCriteria.cs Expected class delegate enum interface or struct CS1518 - click for info 106 Indicator\GV_LynnDeesCriteria.cs Identifier expected CS1001 - click for info 108 33


                      Indicator\GV_LynnDeesCriteria.cs Type or namespace definition or end-of-file expected CS1022 - click for info 109 9

                      Indicator\GV_LynnDeesCriteria.cs The namespace 'NinjaTrader.Indicator' already contains a definition for '?' CS0101 - click for info 108 32

                      Comment


                        #12
                        jerryvellutini,

                        Please post the complete code you are using so we can assess it for you. Thank you.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          Thanks for all your help.

                          I don't understand but I hit F5 and it compiled with no errors. Hopefully this will work.

                          I really appreciate your efforts.

                          Comment


                            #14
                            I'm getting the audio alert but no message

                            Comment


                              #15
                              Do you have the Alerts window open? It should display in the 'message' field - http://www.ninjatrader-support.com/H...verview40.html
                              BertrandNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by ghoul, Today, 06:02 PM
                              3 responses
                              14 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              3 responses
                              44 views
                              0 likes
                              Last Post jeronymite  
                              Started by Barry Milan, Yesterday, 10:35 PM
                              7 responses
                              20 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by AttiM, 02-14-2024, 05:20 PM
                              10 responses
                              180 views
                              0 likes
                              Last Post jeronymite  
                              Started by DanielSanMartin, Yesterday, 02:37 PM
                              2 responses
                              13 views
                              0 likes
                              Last Post DanielSanMartin  
                              Working...
                              X