Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time List

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

    Time List

    Hello

    I'm printing some values from my indicator and I run into something I don't get:
    In the code below, the Time print sometimes is not accurate, as it prints (in at least one occasion that I found) the time of the previous arrow that was actually removed by the script
    I found that replacing " RebUpBarTime[a-1] " with " Time.GetValueAt(RebUpBar[a-1]) " gives me the right Time print, but I don't understand why is that?

    Code:
    if (i == Scan || ToTime(Time[0]) == endTime)
    {        
         if (triggerUp)
            Print (RebUpBarTime[a-1] + "    |    Rebound Up    |    " + RebUpBar[a-1] + "    |    " + upRange + "    |    " + upStop + "    |    " + (UpHeatRb.Count != 0 ? UpHeatRb.Min() : upLoss) + "    |    " + upLoss + "    |    " + i + "    |    " + c);                    
    
      }
    ..............
    if ((a == 0 ? true : CurrentBar != (RebUpBar[a-1] + 1)) && (Math.Min((Close[0] - Low[0]), (Open[0] - Low[0])) / (High[0] - Low[0])) * 100 >= WickPct 
    
                        && Low[0].ApproxCompare(MIN(Low, 5)[1]) < 0 && Close[0] > Low[1] + CloseOffset * TickSize)
    {                    
         RebUpBar.Add(CurrentBar);                    
         RebUpBarTime.Add(Time[0]);
         Draw.ArrowUp(this, "Rebound Up = " + RebUpBar[a], true, 0, Low[0] - 2 * TickSize, Brushes.Lime);
        .............
         a++;
    }

    #2
    Hello itrader46,

    Thank you for your note.

    Within what method is this code? OnBarUpdate, or somewhere else?

    As you probably know, you can quickly look up the bar value on the chart by calling a PriceSeries<T> barsAgo indexer, e.g., Time[0].

    However, the internal indexer and pointers about the barsAgo value are only guaranteed to be correctly synced and updated during a market data event. As a result, you should favor using the absolute GetValueAt() methods during events which are not driven by price.

    So, basically, using Time[0] within OnBarUpdate should return the time of that bar close, but it's not guaranteed to be synced other places, so GetValueAt() will work instead in those cases.

    Please let us know if we may be of further assistance to you.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    637 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
    571 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X