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