Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Line Alerts Absence driving me nuts

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

    #16
    Originally posted by MicroAl View Post
    I created the following enumeration and placed in under the using declarations line
    Code:
    [FONT=Courier New][COLOR=black][SIZE=2]public enum[/SIZE][/COLOR][/FONT][FONT=Courier New][SIZE=2]SoundEffect[/SIZE][/FONT]
    [SIZE=2][FONT=Courier New]{[/FONT][/SIZE]
    [SIZE=2][FONT=Courier New]SoundFile1,[/FONT][/SIZE]
    [SIZE=2][FONT=Courier New]SoundFile2[/FONT][/SIZE]
     
    [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
    i have a question about public enum's ... i have a picklist for MA-type (EMA, SMA, etc) and noticed that this code *only* compiles whenever it exists outside of namespace NinjaTrader.Indicator{} (just as MicroAl demonstrated)

    the code that invokes MAType is declared as a private MAType in the variables section and then properly get/set in the properties section. and it's used inside of OnBarUpdate via a switch() statement to plot lines using the selected MAType.

    when i copied my enum code from indicator#1 (which works great) to indicator#2, i started getting errors when i tried to compile it ... from what i can tell, the only way to complie it is to change the name of the enum (eg. from MAType to Indicator2MAType).

    if i understand this correctly, it's b/c i have something "public" that is outside of the context of just this indicator. i'm not a c# expert, but something tells me this may not be the best-practice way to do an enum.

    so two questions:
    1) is there a way to isolate this code inside of the Indicator{} section so that i can just copy/paste the code over and over again (thinking the answer is no, and would love to know "why");
    2) assuming there's a very good reason for a "no" answer to #1 above, where might one put a "global" type like this? can i make a file called MAType.cs and drop it somewhere and then invoke it from within indicator#1 and indicator#2

    sorry for the super-geeky question here, but i would rather do it the right way than continue to hack things.

    final comment ... i noticed that PriceType works pretty much like what i'm trying to do with MAType ... so another way of asking #2 would be: how do i make my MAType work like PriceType

    thanks in advance for any ideas,
    -e

    Comment


      #17
      You should only create an enum outside as you have seen. You cannot create the same one twice in a second indicator since it will conflict with the first. If you just want this enum to be available across all your indicators, try putting it in UserDefinedMethods.cs. Regardless of where you put it, you just need it once and it should be available across all your other indicators.
      Josh P.NinjaTrader Customer Service

      Comment


        #18
        brilliant! thanks so much!

        Comment


          #19
          Originally posted by MicroAl View Post
          Ok this is how I modified an indicator to select a sound file. I created the following enumeration and placed in under the using declarations line

          +Using declarations
          public enum SoundEffect
          {
          SoundFile1,
          SoundFile2

          }

          in the OnBarUpdate Method I used a switch statement to select the sound file required eg

          switch (MySoundType)

          {

          case SoundEffect.SoundFile1 :
          (What you wish to do here eg Alert statement etc)
          break;

          case SoundEffect.SoundFile2 :
          (What you wish to do here eg Alert statement etc)
          break;
          }

          To create the drop down box in the region Properties section goes

          [Description("Sound Required")]
          [Category("Parameters")]
          public SoundEffect MySoundType
          {
          get { return mySoundType; }
          set { mySoundType = value; }
          }

          I am sure there are probably better ways to achieve this. I am not a professional programmer. In my modified indicator I have a selection of about 10 sound files, but it means 10 case statements that the computer
          has to run through on every tick. However it does not seem to affect the running of the program.

          Hope This Helps



          Try defining a string variable for your different sound files, then put the switch where it is not acted upon at every tick:

          if(CurrentBar < 1)
          {
          switch (MySoundType)
          {
          case SoundEffect.Ding:
          SoundFile1 = "c:\\windows\\media\\ding.wav";sound file
          break;
          case SoundEffect.Chimes:also).
          SoundFile1 = "c:\\windows\\media\\chimes.wav";
          break;
          case SoundEffect.DingDong:
          SoundFile1 = "alert4.wav";
          break;
          }
          return;
          }

          Now the only execution is when the choice is made and the string is applied to the variable SoundFile1. Now you do whatever you want with that variable later in your code.
          Last edited by eDanny; 05-16-2009, 04:20 PM.
          eDanny
          NinjaTrader Ecosystem Vendor - Integrity Traders

          Comment


            #20
            Code Modification

            eDanny

            Looks like a much better idea, Thanks for sharing.

            Note for Moderators. For any discretionary day trader trading a fast moving index like the S&P, trying to take notice of tick readings, trin readings, put call ratio's, volume spikes, Moving averages, stochastics, RSI, elliot wave counts, pit audio, CNBC, BBC, ABC etc, Do you know how frustrating it is not to be able to quickly draw a support and resistance line (angled or straight) and put an alert on it?

            I understand that this basic facility will not be available in Ninja 7. Ninja is a great product and clearly you people are excellent programmers, so I cannot see why almost every other package has this facility and yours does not. (I bet its another stupid patent problem)

            Comment


              #21
              Originally posted by TAJTrades View Post
              You may want to consider a creating a variable lastTriggerTime and then do a check for Current Time > lastTriggerTime + 10 seconds. Then reset the lastTriggerTime to Current Time when conditions evaluate to true.

              sorry, I am trying to figure this out too, could you please give me some sample coding to do that. I built a simple indicator, and added the alert, but I am kindof stumped on how to get it to delay after the first alert.

              thanks

              Comment


                #22
                Solution for alerts for Lines

                For the info of MicroAl and others interested in alerts from lines, there is now a solution, where you can just draw a line on a chart and have it trigger alerts.
                It's a commercial product, at www.tradingcoders.com called Diagonal.

                Cheers,
                saltminer

                Comment


                  #23
                  Line Alert

                  Thanks for info. Looks quite good.

                  Perhaps they should licence it to the Ninja developers who after at least two years have still not worked out a way to accomplish this

                  Comment


                    #24
                    it is now free

                    The product mentioned below, Diagonal, at www.tradingcoders.com is now a free give-away. (was $65)
                    Works on 6.5 and 7.
                    saltminer

                    Comment


                      #25
                      Line Alerts

                      Saltminer

                      Been playing around with this works very well. Looks like you can have 2 horizontal lines or 2 sloping lines or a mixture of both. I also like the Alt and right click combination to draw the lines.

                      Are you connected with the company? If so thanks for donating to the community.

                      The only thing missing that I would like is a way to use my own sound alerts.

                      Edit looks like you can just replace the sound files in the documents folder
                      to whatever you want as long as you keep the names the same
                      Last edited by MicroAl; 09-21-2010, 12:43 AM.

                      Comment


                        #26
                        Originally posted by MicroAl View Post
                        eDanny

                        Looks like a much better idea, Thanks for sharing.

                        Note for Moderators. For any discretionary day trader trading a fast moving index like the S&P, trying to take notice of tick readings, trin readings, put call ratio's, volume spikes, Moving averages, stochastics, RSI, elliot wave counts, pit audio, CNBC, BBC, ABC etc, Do you know how frustrating it is not to be able to quickly draw a support and resistance line (angled or straight) and put an alert on it?

                        I understand that this basic facility will not be available in Ninja 7. Ninja is a great product and clearly you people are excellent programmers, so I cannot see why almost every other package has this facility and yours does not. (I bet its another stupid patent problem)
                        I also think so.thanks





                        __________________
                        Watch Let Me In Online Free

                        Comment


                          #27
                          Hi

                          I was looking for an Alert Line and this Diagonal indicator serves my purpose very well. Many thanks!

                          Comment


                            #28
                            Glad to help

                            Thanks for your kind words. Glad to be of service.
                            Yes, I'm a programmer for TradingCoders.
                            saltminer

                            Comment

                            Latest Posts

                            Collapse

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