Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

alerts

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

    alerts

    if i want an alert when the +DMI or -DMI cross above 20 and above 25, with different sounds if possible at each number, how do i do it using the DM indicator as my start--obviously reset the lines to 20 and 25, but then what??
    Last edited by simpletrades; 10-23-2009, 06:44 AM.

    #2
    You would need to work with the Alert or PlaySound methods in NinjaScript; you could work this out also in the Strategy Wizard via point & click - http://www.ninjatrader-support.com/H...rdScreens.html

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      You would need to work with the Alert or PlaySound methods in NinjaScript; you could work this out also in the Strategy Wizard via point & click - http://www.ninjatrader-support.com/H...rdScreens.html

      http://www.ninjatrader-support.com/H...egyAction.html
      i tried to start with a diamond plotting the cross, but i want it in the indicator panel not the candles. Here is one alert condition:

      if (CrossAbove(DiPlus, 20, 1))DrawDiamond("di+20 up" + CurrentBar, false, 0, Low[0], Color.Cyan);

      Also I only want a diamond when the +DMI or the -DMI cross 20 or 25 on the way up not the way down and just that once not continuous diamonds. Once I get this, I can add sound.
      Last edited by simpletrades; 10-23-2009, 09:34 PM.

      Comment


        #4
        If you want it in the indicator panel, you will have to specify Overlay = false in initialize.

        The code you posted will only "fire" when DMI+ crosses 20 from below (on the way up), and it should only place one diamond. Is this not what you're experiencing?
        AustinNinjaTrader Customer Service

        Comment


          #5
          [quote=NinjaTrader_Austin;122494]If you want it in the indicator panel, you will have to specify Overlay = false in initialize.


          I tried that and it still prints on the candles.
          In protected override void Initialize() I added at the end:

          Overlay=false;
          Last edited by simpletrades; 10-24-2009, 02:41 PM.

          Comment


            #6
            Originally posted by NinjaTrader_Austin View Post
            If you want it in the indicator panel, you will have to specify Overlay = false in initialize.

            The code you posted will only "fire" when DMI+ crosses 20 from below (on the way up), and it should only place one diamond. Is this not what you're experiencing?

            It is putting dots where they should not be.
            Red dots are for Red-DMI crossing 20 or 25, Green are for Green +DMI crossing 20 or 25.
            Yellow lines mark the dots I am questioning as an example.
            But I am getting a red dot showing a bar later after it crossed below 25 in the example and the same with the green dot.
            Is using 'else' messing it up?
            //******************
            if (CrossAbove(DiPlus, 20, 2)) //2 is width of dot?
            DrawDot("di+20 up" + CurrentBar, false, 0, Low[0]- (TickSize*dist), Color.Lime);

            else if (CrossAbove(DiMinus, 20, 2))
            DrawDot("di-20 up" + CurrentBar, false, 0, High[0]+ (TickSize*dist), Color.Red);

            if (CrossAbove(DiPlus, 25, 2))
            DrawDot("di+25up" + CurrentBar, false, 0, Low[0]- (TickSize*dist), Color.Lime);

            else if (CrossAbove(DiMinus, 25,2 ))
            DrawDot("di-25 up" + CurrentBar, false, 0, High[0]+ (TickSize*dist), Color.Red);

            //***********************
            Also, if you would, what does the false refer to in the DrawDot line?
            Attached Files
            Last edited by simpletrades; 10-25-2009, 01:00 PM.

            Comment


              #7
              simpletrades, I would say the else statements could be causing you the trouble. Try without any else statements and see what happens.

              The false refers to whether or not the chart will auto scale to include the dot. If you're looking at a chart of 6E which typically ranges around 1.49 these days, and you draw a dot at 3, then it will include a dot way up at 3 and "squish" all the chart details to include the dot. Sorry if that didn't make much sense-just try it out (set it to true and plot it way away from the price) and see what happens.
              AustinNinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_Austin View Post
                simpletrades, I would say the else statements could be causing you the trouble. Try without any else statements and see what happens.

                The false refers to whether or not the chart will auto scale to include the dot. If you're looking at a chart of 6E which typically ranges around 1.49 these days, and you draw a dot at 3, then it will include a dot way up at 3 and "squish" all the chart details to include the dot. Sorry if that didn't make much sense-just try it out (set it to true and plot it way away from the price) and see what happens.
                i understand auto scale from playing around with bollinger bands. i just didnt know that false referred to it. False is better.

                Tonite in real time i'll watch the dots form and see how it works.
                It might be an intrabar crossdown then recross all within the same bar that triggers it.

                Why didnt this work? :
                [quote=NinjaTrader_Austin;122494]If you want it in the indicator panel, you will have to specify Overlay = false in initialize.

                I tried that and it still prints on the candles.
                In protected override void Initialize() I added at the end:
                Overlay=false;

                Comment


                  #9
                  Originally posted by NinjaTrader_Austin View Post
                  simpletrades, I would say the else statements could be causing you the trouble. Try without any else statements and see what happens.
                  .
                  taking out else didnt help at all.
                  plots the same.

                  Code is too large for the post to accept for viewing here, how do i get around that?
                  Last edited by simpletrades; 10-25-2009, 08:55 PM.

                  Comment


                    #10
                    How do I write the code to get it to eliminate dots if they were already there 1 bar ago
                    per my example in red?

                    if (CrossAbove(DiPlus, 20, 2)) and DiPlus<=20 1 bar ago
                    DrawDot("di+20 up" + CurrentBar, false, 0, Low[0]- (TickSize*dist), Color.Lime);

                    if (CrossAbove(DiMinus, 20, 2)) and DiMinus<=20 1 bar ago
                    DrawDot("di-20 up" + CurrentBar, false, 0, High[0]+ (TickSize*dist), Color.Red);

                    if (CrossAbove(DiPlus, 25, 2)) and DiPlus <=25 1 bar ago
                    DrawDot("di+25up" + CurrentBar, false, 0, Low[0]- (TickSize*dist), Color.Lime);

                    if (CrossAbove(DiMinus, 25,2 )) and DiMinus<=25 1 bar ago
                    DrawDot("di-25 up" + CurrentBar, false, 0, High[0]+ (TickSize*dist), Color.Red);

                    Here is the code reading Overlay=false; (the only code I added in the Initialize section except for changes to colors and line plot to 20 and 25)--it doesnt need to be in a separate pair of {} does it?

                    protected override void Initialize()
                    {
                    Add(new Plot(new Pen(Color.Transparent, 1), "ADX")); Add(new Plot(Color.Green, "+DI")); Add(new Plot(Color.Red, "-DI")); Add(new Line(Color.MediumOrchid, 20, "20")); Add(new Line(Color.Blue, 25, "25")); Add(new Line(Color.Transparent, 30, "30")); dmPlus = new DataSeries(this); dmMinus = new DataSeries(this); sumDmPlus = new DataSeries(this); sumDmMinus = new DataSeries(this); sumTr = new DataSeries(this); tr = new DataSeries(this); Overlay = false ;
                    }
                    Last edited by simpletrades; 10-25-2009, 11:45 PM.

                    Comment


                      #11
                      simpletrades, it would be helpful if you posed the full code you use so we can take a look, try attaching an exported zip version of it...

                      You could just include your one bar ago addtion in the if rule you use -

                      if (CrossAbove(DiPlus, 20, 2) && DiPlus[1] <= 20)
                      DrawDot("di+20 up" + CurrentBar, false, 0, Low[0]- (TickSize*dist), Color.Lime

                      Comment


                        #12
                        Originally posted by NinjaTrader_Bertrand View Post
                        simpletrades, it would be helpful if you posed the full code you use so we can take a look, try attaching an exported zip version of it...

                        You could just include your one bar ago addtion in the if rule you use -

                        if (CrossAbove(DiPlus, 20, 2) && DiPlus[1] <= 20)
                        DrawDot("di+20 up" + CurrentBar, false, 0, Low[0]- (TickSize*dist), Color.Lime
                        Thanks.
                        Here's the file without your 1 bar ago change.
                        Attached Files

                        Comment


                          #13
                          You see those multiple dots because you use 2 different conditions for each side all with unique tag's ids for the drawing objects...I would suggest you either use 2 different long and short colors to separate or you need to code in a bool checking if already a long condition has triggered and thus the additional dot would not be placed then...

                          Comment


                            #14
                            Originally posted by NinjaTrader_Bertrand View Post
                            You see those multiple dots because you use 2 different conditions for each side all with unique tag's ids for the drawing objects...I would suggest you either use 2 different long and short colors to separate or you need to code in a bool checking if already a long condition has triggered and thus the additional dot would not be placed then...
                            The colors arent the problem because from the screenshot and my other observations on the charts the mutiple dots show even if the second line wasnt also crossed. I've seen 3 or 4 reds or greens in a row but at most should ever see 2.
                            As to the other option, i dont know what bool checking means other than maybe does the test keep repeating, but how do i code it?

                            I know on tradestation, i could have put an end; statement after each of the 4 statements before the next if began.
                            Last edited by simpletrades; 10-26-2009, 07:56 AM.

                            Comment


                              #15
                              Try work only on one condition until you're confident this is what you're after, for example you have a lookback setting of 2 in all your condition, thus some double dots following each other would be expected, if I comment out all but the first condition you've setup and change the lookback for the CrossAbove to 1 it works as expected -

                              Code:
                               
                              if (CrossAbove(DiPlus, 20, 1))//1 is width of dot?
                              //DrawDot("di+20 up" + CurrentBar, false, 0, Low[0], Color.White);
                              DrawDot("di+20 up" + CurrentBar, false, 0, Low[0]- (TickSize*dist), Color.Lime);

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              569 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              330 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
                              548 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              548 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X