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 DJ888, 04-16-2024, 06:09 PM
          3 responses
          10 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by RookieTrader, Today, 07:41 AM
          0 responses
          2 views
          0 likes
          Last Post RookieTrader  
          Started by maybeimnotrader, Yesterday, 05:46 PM
          1 response
          18 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by Perr0Grande, Yesterday, 08:16 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by f.saeidi, Yesterday, 08:12 AM
          3 responses
          26 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X