• 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

Alert Manager

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

    Alert Manager

    hello,

    Is there a way to record all alert tab to file without using export command.
    Just to have a log file with all alert every day.
    if no , using API to do it?

    thank you

    #2
    Hello oceanis400,

    Welcome to the NinjaTrader support forum.

    There is no way to do this from the user interface. There is also no documented or supported way to do this from code, but it looks like you can access the alert history by using the following syntax:


    Code:
    foreach (KeyValuePair<string, IEnumerable<AlertEventArgs>> alert in NinjaTrader.NinjaScript.Alert.AlertHistory)
    {
          Print(alert.Key);
          IEnumerable<AlertEventArgs> vals = alert.Value;
    
          foreach (AlertEventArgs alertEventArgse in vals)
          {
              Print(alertEventArgse.Message + " " + alertEventArgse.Instrument.FullName);
          }
    }

    Please let me know if I may be of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      hello,

      Thank you for this code.

      But I would like get alerts just one time in an indicator. (for example from last bar update)

      If I use "foreach" in OnBarUpdate() , I have all alerts several time on each bar.

      I test many time different code an I haven't a good result.

      thank you to help me

      Comment


        #4
        Hello oceanis400,

        Thank you for the reply.

        You could further refine the syntax provided to your needs such as outputting the information once. What have you tried so far that is not working?

        While I wouldn't be able to build an entire indicator that does this for you I could try to recommend corrections on what you are doing that is failing.

        You could possibly use the Count property logically to control when this happens or also the state system.


        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          hello Jesse,

          I try to explain better. (your code is working)
          If I call your code with foreach , I have all alerts on each bar.
          How you use property Count with Alerthistory. (This is no help on this)

          I would like just call your code once per bar (inside OnBarUpdate()).
          But I need to know how many alert are logged.

          Is it possible to print output in points and not in float ? (for example for future 10Years TBOND)

          sincerely,

          Comment


            #6
            Hello oceanis400,

            Thank you for the reply.

            Correct if you call this on each bar, it will complete the loop on each bar, you would need to use logic to further filter the alerts if you only want to see new alerts.

            It sounds like you are already calling this on each bar but want less alerts on each bar, is this correct? if so that is something you would have to add in logically. This collection simply shows all of the alerts when you loop over it.

            Regarding printing in points, are you asking how to convert a price into points and then print that? can you provide more detail on what you are trying to convert to points?



            Please let me know if I may be of additional assistance.

            JesseNinjaTrader Customer Service

            Comment


              #7
              Hello Jesse,

              I improve my code , but is it possible to read alert each second in 1min chart ? (I need to stay in 1min chart of course)
              I'm using OnBarUpdate() but I would like to log alert to file more quickly than 1 min.

              Comment


                #8
                Hello oceanis400,

                If you are using a 1 minute series, the most frequent your logic will be called is at the frequency of 1 minute. You would need to use a lesser series such as 1 second if you wanted specifically 1 second intervals. The alternative would be to execute the code OnEachTick. In that case, you could achieve 1 second intervals by checking the current ticks Time and doing math to see if that was more than 1 second since the last time you executed the loop.

                I look forward to being of further assistance.
                JesseNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by fredfred, Today, 03:41 AM
                2 responses
                8 views
                0 likes
                Last Post fredfred  
                Started by TraderYoda, Today, 03:33 AM
                0 responses
                1 view
                0 likes
                Last Post TraderYoda  
                Started by pjsmith, Today, 02:56 AM
                0 responses
                3 views
                0 likes
                Last Post pjsmith
                by pjsmith
                 
                Started by ntbone, Yesterday, 08:10 PM
                0 responses
                11 views
                0 likes
                Last Post ntbone
                by ntbone
                 
                Started by chrislou, 08-28-2015, 03:27 AM
                14 responses
                2,884 views
                0 likes
                Last Post nkhoi
                by nkhoi
                 
                Working...
                X