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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    46 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    67 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    35 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    95 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    59 views
    0 likes
    Last Post PaulMohn  
    Working...
    X