• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Simple Code

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

    Simple Code

    Hello

    I have a simple request if coders may. There is a plain ema color indicator in the following link http://www.ninjatrader.com/support/f...ad.php?t=43611 .

    attached by the name ColoredEmaNT7.zip


    Could someone graciously add a sound alert to the code so that it would get triggered when ema changes color.

    I would really appreciate it.

    Thank you

    #2
    Hello,

    You should be able to add this and customize it to your preferences very easily.

    In the OnBarUpdate() section of the code, please try replacing the following:

    Code:
            if (Rising(ColorEMA))
                {
                    PlotColors[0][0] = Color.Blue;
                    Alert("Rising", NinjaTrader.Cbi.Priority.High, "EMA Rising", "Alert1.wav", 10, Color.Black, Color.Yellow);
                }    
                else if (Falling(ColorEMA))
                {
                    PlotColors[0][0] = Color.Red;
                    Alert("Falling", NinjaTrader.Cbi.Priority.High, "EMA Faling", "Alert1.wav", 10, Color.Black, Color.Yellow);
                }
    More information on using the Alert() function can be found below:

    http://www.ninjatrader.com/support/h...html?alert.htm

    Please let me know if you have any questions and I'd be happy to help you get this working.
    Last edited by NinjaTrader_Matthew; 09-12-2011, 08:49 AM.
    MatthewNinjaTrader Product Management

    Comment


      #3
      thank you very much matthew..

      However, I have absolute no experience with coding.. I opened the indicator in edit script and copied what you posted over what what written but bunch of errors came up "statement expected"...

      Will the modification you posted fire an alert with each bar that closes or not.

      I am hoping for something that would trigger when ema changes color but if the next bar has the same color of the ema it wont fire..

      again thank you very much..

      Comment


        #4
        Hello,

        This would take some extra steps, but definitely possible.

        We do not normally do this, but we will have one of our NinjaScript trainees look into this as a practice exercise. You should be getting a response in this thread once it is completed or if more information is needed from you to finish.

        If you have limited time or programming capabilities, you can discuss your requirements with any of our NinjaScript consultants.
        MatthewNinjaTrader Product Management

        Comment


          #5
          I can't thank you enough. I really appreciate this matthew.!

          Comment


            #6
            ColoredEMAwAlerts

            Chrismayerinmarket,

            Please find attached the requested indicator. I have tested it out on Gold and some Forex pairs and it appears like it is working great.

            To see the Alerts, you will need to go to File > New > Alerts, though there should be a sound that plays when a new alert from this indicator is triggered.

            In the Alerts window, when the EMA goes from Blue to Red, it will alert you in Red "EMA Falling", and when the EMA goes from Red to Blue, it will alert you in Blue "EMA Rising".

            For future modifications, I would suggest visiting some of our NinjaScript certified consultants at the link below :

            http://www.ninjatrader.com/partners#...pt-Consultants
            Attached Files
            Adam P.NinjaTrader Customer Service

            Comment


              #7
              Hello

              Thank you very much for your help adam. I have just been able to test the indicator you have attached. I tried to compile it with the original ColoredEMA.cs present... it didn't allow me... So I compiled it alone and it compiled fine....

              However I don't see any alerts.. I open a chart, load coloredemawalerts indicator..there is no option in the indicators window to view or select alerts...

              I did as you suggested to open an alert window.. but there is no sign of the ema alerts there nor an option to load the indicator in the alert..

              I really appreciate your help,,

              Comment


                #8
                Chris,

                I am happy to help.

                If you go to File > New > Alerts, an Alert window should pop-up. One thing to remember is that these alerts will only work in real-time and ignored on historical data. So basically, it may take awhile for the alert to trigger until the market changes trend locally.

                Please let me know if I can assist further.
                Adam P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by siroya, Today, 06:32 AM
                0 responses
                2 views
                0 likes
                Last Post siroya
                by siroya
                 
                Started by fluffier, Yesterday, 11:49 PM
                1 response
                18 views
                0 likes
                Last Post NinjaTrader_Marco  
                Started by GARZONJ, Yesterday, 09:02 PM
                0 responses
                10 views
                0 likes
                Last Post GARZONJ
                by GARZONJ
                 
                Started by bouncetherubble, Yesterday, 08:42 PM
                0 responses
                7 views
                0 likes
                Last Post bouncetherubble  
                Started by connorgrant5, Yesterday, 01:33 PM
                1 response
                18 views
                0 likes
                Last Post NinjaTrader_ShawnB  
                Working...
                X