Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Time parameters to alert

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

    Time parameters to alert

    I'm trying to be able to have my alerts go off only between certain hours so I can keep from being distracted when i dont want to be trading.

    if (CrossAbove(DiMinus, 20, 1) && DiMinus[0]>=DiPlus[0] && (ToTime(Time[0]) >= time1 )) Alert.......

    This is what I have done.
    time1 is defined in variables as privateint time1 = 1159; (so I can test it since its just after 1130 now)

    and in properties as:
    [Description("time threshhold")]
    [Category(
    "Parameters")]
    publicint Time1
    {
    get { return time1; }
    set { time1 = Math.Max(1, value); }
    }

    but the alerts go off anyhow. why? Does totime need to be defined somehow somewhere?

    #2
    Hello Simpletrades,

    Thank you for your post

    You should be able to do this by adding seconds to your time1 variable. So 11:59 should be 115900
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by simpletrades View Post
      I'm trying to be able to have my alerts go off only between certain hours so I can keep from being distracted when i dont want to be trading.

      if (CrossAbove(DiMinus, 20, 1) && DiMinus[0]>=DiPlus[0] && (ToTime(Time[0]) >= time1 )) Alert.......

      This is what I have done.
      time1 is defined in variables as privateint time1 = 1159; (so I can test it since its just after 1130 now)

      and in properties as:
      [Description("time threshhold")]
      [Category(
      "Parameters")]
      publicint Time1
      {
      get { return time1; }
      set { time1 = Math.Max(1, value); }
      }

      but the alerts go off anyhow. why? Does totime need to be defined somehow somewhere?
      i read your post, changed it to 123000 and hit apply on the indicator on the chart just in time for an alert to trigger but this time it plotted silently. thanks.

      Comment


        #4
        Originally posted by NinjaTrader_RyanM View Post
        Hello Simpletrades,

        Thank you for your post

        You should be able to do this by adding seconds to your time1 variable. So 11:59 should be 115900
        is the proper way to set it to always trigger is use 000100 as 1 minute past midnite?

        Comment


          #5
          Yes, this is the correct way to represent 1 minute past midnight, but the leading zeroes aren't necessary. 100 will do the same thing.
          Ryan M.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by trilliantrader, 04-10-2024, 09:33 PM
          6 responses
          23 views
          0 likes
          Last Post trilliantrader  
          Started by traderqz, Today, 12:06 AM
          5 responses
          9 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by Mongo, Today, 11:05 AM
          2 responses
          9 views
          0 likes
          Last Post Mongo
          by Mongo
           
          Started by guillembm, Today, 11:25 AM
          0 responses
          3 views
          0 likes
          Last Post guillembm  
          Started by Tim-c, Today, 10:58 AM
          1 response
          3 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X