Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

only check the last 3 day's data

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

    only check the last 3 day's data

    Hi
    I am new for Ninjascript, I want to build a indicator work in 1 minute time frame, but I want to add a rule : just check the last 3 days' chart data.
    How can I add this rule on the indicator? Thanks a lot

    #2
    Hello,

    You will see how to do it here:


    Note: you must have daily data if you add a daily bar.
    DenNinjaTrader Customer Service

    Comment


      #3
      Thanks Ben
      I understand to add:

      Add(PeriodType.Day,1)

      and set:
      if (BarsInProgress == 1)

      after that I don't know how to filter out the other days,
      I only want the data of last recent 3 days.

      Comment


        #4
        Hello,

        You will need to sort out the logic yourself, but you likely can use the GetBar() method to get the bar reference or you could use some sort of looping structure:
        for (int i = 0; i < my_barsback; i++)
        {
        if
        (my_time == ToTime(Time[i]))
        {
        my_vol = Volume[i];
        break
        ;
        }
        }
        Or maybe this link will help:

        DenNinjaTrader Customer Service

        Comment


          #5
          Thank you Ben , to point me the direction,
          I will like into them. cheers

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CaptainJack, 05-29-2026, 05:09 AM
          0 responses
          245 views
          0 likes
          Last Post CaptainJack  
          Started by CaptainJack, 05-29-2026, 12:02 AM
          0 responses
          157 views
          0 likes
          Last Post CaptainJack  
          Started by charlesugo_1, 05-26-2026, 05:03 PM
          0 responses
          165 views
          1 like
          Last Post charlesugo_1  
          Started by DannyP96, 05-18-2026, 02:38 PM
          1 response
          250 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 05-11-2026, 05:56 AM
          0 responses
          201 views
          0 likes
          Last Post CarlTrading  
          Working...
          X