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 sjsj2732, Today, 04:31 AM
    0 responses
    20 views
    0 likes
    Last Post sjsj2732  
    Started by NullPointStrategies, 03-13-2026, 05:17 AM
    0 responses
    280 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    279 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    130 views
    1 like
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    90 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Working...
    X