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 CarlTrading, 03-31-2026, 09:41 PM
            1 response
            67 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            36 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            59 views
            1 like
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            62 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            53 views
            0 likes
            Last Post CarlTrading  
            Working...
            X