Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator starting today

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

    Indicator starting today

    Hi,

    Can you point me in the direction of what code I would need to create an indicator, either in the Wizard or NinjaScript, where the Indicator only looks at data on the current date.

    Basically I have a Pivot Level, say 1.33 for example, that I want a Strategy to trade around. But I also want to use the BarsSinceEntry code so I don't get chopped up.

    The Pivot Level changes every day thus I want the BarsSinceEntry only to look at data from the current trading day and not the prior day, thus I want my Indicator to only include today's data.

    Thanks,

    #2
    Hello Scarlett09,
    You can use the C# routine DateTime.Now to check on the current PC time. A sample code will be like

    Code:
    if (DateTime.Now.Date == Time[0].Date)
    {
       //do something
    }
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Hi,

      Can you let me know what is wrong with the code below, thanks:



      protected override void OnBarUpdate()
      {
      if(DateTime.Now.Date==Time[0].Date)

      PTLine.Set = (1.3306);
      }

      Comment


        #4
        Hello Scarlett09,
        The code looks fine.

        To assist you further may I know what is your exact requirements.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Hi,

          As previously mentioned, I have a Pivot Level that changes every day. Say tomorrow it is 1.3310. Thus I only want to see a Line drawn at 1.3310 that begins at the start of the new trading session and ends when the market closes or 4pm cst.

          Comment


            #6
            Hello Scarlett09,
            Thanks for the information.

            The besides the current system time you may also like to compare the session start and end time. You can use the GetNextBeginEnd to find the sessions start and end time.

            Please refer to our help guide to know more about it.
            JoydeepNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            639 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            366 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            107 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            569 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            572 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X