Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

High/Low of custom time period

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

    High/Low of custom time period

    Dear support,

    I have an indicator that calculates and plots high/low starting at time A all the way until time B. It works great as long as both time points are in the same day. Once A is 11 PM and B is 1 AM of the other day, Ninja thinks that I'm traveling backwards and that 1 AM is meant to be at the very same day as the first point and plots nothing. Would you please assist? How to tell Ninja that point B is actually the day after?

    Code:
    if((ToTime(Time[0]) >= time_from) && (ToTime(Time[0]) <= time_to)) {
                    if(High[0] > new_high)     new_high = High[0];
                    if(Low[0] < new_low)    new_low = Low[0];
                    }
    Thanks!

    #2
    Originally posted by pepino31 View Post
    Dear support,

    I have an indicator that calculates and plots high/low starting at time A all the way until time B. It works great as long as both time points are in the same day. Once A is 11 PM and B is 1 AM of the other day, Ninja thinks that I'm traveling backwards and that 1 AM is meant to be at the very same day as the first point and plots nothing. Would you please assist? How to tell Ninja that point B is actually the day after?

    Code:
    if((ToTime(Time[0]) >= time_from) && (ToTime(Time[0]) <= time_to)) {
                    if(High[0] > new_high)     new_high = High[0];
                    if(Low[0] < new_low)    new_low = Low[0];
                    }
    Thanks!
    Use the c# Time class itself, and instead of start and end time, use start time and interval length, so that end time is start time plus interval length. That way you get the correct date and time.

    Comment


      #3
      Hello pepino31,
      If you try the below code then are you able to get the correct values.

      Code:
      if ((ToTime(Time[0]) >= 110000 && ToTime(Time[0]) <= 24000) || (ToTime(Time[0]) >= 0 && ToTime(Time[0]) <= 10000))
      {
         //do something
      }
      JoydeepNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      599 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      344 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      103 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      558 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      557 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X