Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trend Line Alert - Alert when price crosses a line, ray, or extended line

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

    Trend Line Alert - Alert when price crosses a line, ray, or extended line

    Hello traders,

    I just programmed this alert indicator for my own system and I thought I would share it.

    Install

    Go to File-> Utilities-> Import NinjaScript and select the attached file.

    Parameters:

    TrendLineTag: trigger
    AlertSound: CompiledSuccessfully.wav

    Description:
    When price crosses one trend line (a line, extended line, or ray), trigger an alert with the alertsound. Then, it is disabled until you move, change, or delete the trend line. If you delete the trend line, it will wait until another trend line with the same tag is created and then it will use that.

    If the trend line is below the bid price, it will trigger when the bid price is <= the trend line. If the trend line is above the bid price, it will trigger when the bid price is >= the trend line.


    Let me know if it works, I just tested it shortly with all 3 trend line types and directions.
    Attached Files
    Last edited by Starry; 08-08-2013, 05:39 AM.

    #2
    Thanks a lot Starry, I've been looking for a Trend line alert for awhile. I have two questions.

    1) Is there a problem with loading two of your TL alerts under Indicators with different tags for two different TL's?
    2) Under Plot in parameters, you have a color for the line, is the line suppose to change to that color when it is hit?

    Thanks again... great indicator.

    Rockford

    Comment


      #3
      hey Rockford,

      1) No, there should be no problem, though i havent tested it. The program searches for the object with the specified tag.
      2) Download the same indicator below, the plot0 is never used, so the answer is no , the color under plot0 does nothing . I have gotten rid of it below.
      Last edited by Starry; 08-15-2013, 11:37 AM.

      Comment


        #4
        Hi Starry,

        Thanks a lot. Btw, it works great. Just curious, is this indicator any different from the first one, I noticed it's 3 times larger?

        Rockford

        Comment


          #5
          I accidently hit 'compile into dll', so it includes a dll of the indicator. reuploaded to just include source!

          The only difference is that I changed the position of the parameters so that they are under 'parameters' instead of 'misc'. I tried to get rid of the 'plot0' field unsuccesfully, just ignore that.

          Reuploaded so that i compiled without forming a dll.

          Comment


            #6
            Hey Rockford,
            by the way, i dont think it works when equidistant_bars = false, though i am not 100% sure, maybe only 90% sure. I will update that sometime soon when i have time, since i now know how to make it work on both sorts of charts.

            equidistant_bars = true is default though, so it should work great.

            Comment


              #7
              Thanks Starry, if you make any changes in the future please let me know. This indicator is really helping me out with a particular manual strategy I use.

              Rockford

              Comment


                #8
                Hey Starry,
                Thanks for releasing the alert for us to use-
                now I'm new to Ninjatrader and seem to be missing one very vital step- how does one draw an alert line on the chart?
                I can add the indicator to my chart, and the text shows up at the top of the screen.. but I can't figure out how to set the alert.

                cheers,
                Jordan

                Comment


                  #9
                  Hey Jordan!
                  Just draw a line, extended line, or ray and change the tag to trigger (by double clicking and going to the second tag), or whatever u put in the 'tag' parameter of the indicator

                  Comment


                    #10
                    Hello Starry,This is exactly what I wanted. I copied the *.cs file and renamed it and changed the default "target" to "target1", so that I could have two lines, one above a side channel and one below the side channel, and it worked. Similarily for a "exit target"
                    for an open trade and a "Trailing stop loss".

                    Thank you VERY much for sharing this with fellow members.

                    The next item that I wanted was for the alert to generate an e-mail message, so I pasted my usual SendMail code into the line below the Alert line, but it does not work. It would be appreciated if you could tell how to add to your code, to achieve the e-mail message.
                    Also, where can I change your code, so as to identify which line (above/below) actually fired in the Alert Window.

                    Comment


                      #11
                      Hello Starry,
                      Thank you VERY much for the code, it is exactly what I wanted.

                      I copied the file and renamed it and changed the line tag to "target1" so that I could have two lines on the chart, one above and one below a side channel, waiting for a breakout, and it worked as expected.

                      I tried to add my usual "SendMail" code to just under the "Alert" line of code, but it did not work. It would be greatly apperciated if you could show how this can be accomplished.
                      Many thanks in anticipation.

                      Comment


                        #12
                        In order to determine which line was hit, you can change the alert code to include the tag of the line, and you can set the tag of the line in the 'parameters' of the indicator (you dont need to change the code).

                        About the email, Im not sure why it doesnt work. Of course make sure you compiled the new code and then reapply the indicator, but then you should also check the 'control center log' tag for any error in sending the email.

                        Also make sure to include the new code in both Alert if/else branches. There is one if branch for when price crosses up above a line, and there is one if branch ffor when price crosses below a line.

                        I guess you could also add to the alert string to say 'price has crossed ABOVE' or below the line.

                        Hope that helps and ask anything else if needed!

                        Comment


                          #13
                          Hi, I'm new with NinjaTrader and it's very surprising I'm not able to get simple Trend Line alerts like in ProRealTime or Multi Charts for prices or indicators with a bell button. MarketAnalyzer is not very useful when I'm studying charts? Thanks to Starry but we need to duplicate the editor to get more than one single line. I hope the new V8 can bring to us a pro answer

                          Comment


                            #14
                            Will this work for a trend line placed on an indicator that is in a separate panel than the price bars?

                            Comment


                              #15
                              T.L. Alert not working ??

                              Hi

                              I'm a new NT user, I installed NT free edition only for the Trend line alerts.
                              I downloaded the script and add the indicator to my chart, I see Trendlinealert(AAPL(1min)CompiledSuccessfully.wav, trigger) on the top of the chart.
                              I use the line tool to draw trend lines on a 1 min line chart.
                              I watch the price line break through the trend lines I draw and nothing happens, no audio alarm no visual indicator.
                              Am I doing something wrong?
                              Thanks

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by DayTradingDEMON, 09-08-2024, 11:25 PM
                              12 responses
                              357 views
                              0 likes
                              Last Post defa0009  
                              Started by thedude, 11-14-2021, 08:44 AM
                              5 responses
                              532 views
                              0 likes
                              Last Post jmschmidt357  
                              Started by lorien, 08-08-2021, 07:33 AM
                              10 responses
                              711 views
                              0 likes
                              Last Post AndyM871  
                              Started by henann, Today, 04:47 PM
                              0 responses
                              2 views
                              0 likes
                              Last Post henann
                              by henann
                               
                              Started by zstheorist, 11-23-2024, 09:06 AM
                              3 responses
                              19 views
                              0 likes
                              Last Post NinjaTrader_LuisH  
                              Working...
                              X