Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

List Add not working

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

    List Add not working

    I have a weird situation. after renaming an indicator I cannot get my indicator to store a value in a List when using List.Add. I have reinstalled Ninjatrader and tried making a new indicator and but neither resolves this issue. Here is a sample test case of the problem.

    My onBarUpdate looks like this snippet: Note the barPropertiesList.Add(newBar); and the print statement following it to show the count of the list. I get no errors from my try catch but nothing is added to the list. see below for the print output showing this.Any ideas how to get this working again? the problem started after I renamed an indicator.
    thanks

    protected override void OnBarUpdate()
    {
    if (CurrentBar == 0)
    ClearOutputWindow();
    try
    {
    if (BarsInProgress == 0)
    {
    BarProperties newBar = new BarProperties(
    barIndex: CurrentBar,
    open: Open[0],
    high: High[0],
    low: Low[0],
    close: Close[0],
    volume: Volume[0],
    time: Time[0].TimeOfDay,
    date: Time[0].Date,
    dateTime: Time[0]
    );
    barPropertiesList.Add(newBar);
    Print($"{CurrentBar} count: {barPropertiesList.Count} ");​
    }


    Print output:
    0 count: 0
    1 count: 0
    2 count: 0
    3 count: 0
    4 count: 0
    5 count: 0
    6 count: 0
    7 count: 0​

    #2
    this was resolved

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    556 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X