Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Load Days in Adddataseries

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

    Load Days in Adddataseries

    Hello everyone
    created a simple indicator for loading days regardless of how many days are loaded on the chart

    but for some reason it does not work, it still only shows prices from those days on the chart, instead of those that are loaded with a new dataset in the indicator

    Code:
    else if (State == State.Configure)
    {
    AddDataSeries(Instrument.FullName, new BarsPeriod { BarsPeriodType = BarsPeriodType.Day, Value = 1 }, [B]30[/B], "CME US Index Futures RTH", false); 
    }
    else if (State == State.Historical)
    {
    
    }
    if (State == State.DataLoaded)
    {
    
    }
    
    protected override void OnBarUpdate()
    {
    if (CurrentBars[0] < 1 || CurrentBars[1] < 1)
    return;
    
    if (BarsInProgress == 1)
    {
    double DayHigh = Highs[1][0];
    double DayLow = Lows[1][0];
    
    Print(DayHigh.ToString());
    }
    
    }

    #2
    Hello memonolog,

    One note here is that you are using variables with AddDataSeries which is documented that it can fail.
    Arguments supplied to AddDataSeries() should be hardcoded and NOT dependent on run-time variables which cannot be reliably obtained during State.Configure (e.g., Instrument, Bars, or user input).
    One other note is that you are using the same instrument which would bring up this note from the help guide, you may be running into this:

    •When adding multiple Data Series of the same instrument and the same Bar Type, the 'barsToLoad' property will only be effective on the first added series. Subsequent series with a different barsToLoad setting will not load a different number of bars then the first series.
    Your idea would likely work by hardcoding a second different instrument, otherwise you will need to switch to using BarsToLoad for the primary series when you configure the script.


    Please let me know if I may be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    656 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    371 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    109 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    574 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    579 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X