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 Jimmyk, 01-26-2018, 05:19 AM
          6 responses
          835 views
          0 likes
          Last Post emuns
          by emuns
           
          Started by jxs_xrj, 01-12-2020, 09:49 AM
          6 responses
          3,291 views
          1 like
          Last Post jgualdronc  
          Started by Touch-Ups, Today, 10:36 AM
          0 responses
          10 views
          0 likes
          Last Post Touch-Ups  
          Started by geddyisodin, 04-25-2024, 05:20 AM
          11 responses
          62 views
          0 likes
          Last Post halgo_boulder  
          Started by Option Whisperer, Today, 09:55 AM
          0 responses
          9 views
          0 likes
          Last Post Option Whisperer  
          Working...
          X