Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Daily Data Series not getting run in OnBarUpdate while backtesting

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

    Daily Data Series not getting run in OnBarUpdate while backtesting

    Hello, I am trying to run a strategy that runs a one minute data series and a one day data series. I have the Calculate property set to OnBarClose. The one minute data series gets run in OnBarUpdate normally, but the one day data series never gets run in OnBarUpdate(I am back testing multiple days).

    Currently the one minute data series is the primary data series. I have tried making the one day data series the primary data series and the one minute the secondary data series. I got the same result.

    I also ensured that the historical data downloaded was both minute and day, and I ensured that the data type was 'last'.

    Here is my OnStateChanged method:

    Code:
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Strategy here.";
    Name = "T2V1S1V1FU";
    Calculate = Calculate.OnBarClose;
    EntriesPerDirection = 4;
    EntryHandling = EntryHandling.AllEntries;
    IsExitOnSessionCloseStrategy = true;
    ExitOnSessionCloseSeconds = 30;
    IsFillLimitOnTouch = false;
    MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
    OrderFillResolution = OrderFillResolution.Standard;
    Slippage = 0;
    StartBehavior = StartBehavior.WaitUntilFlat;
    TimeInForce = TimeInForce.Gtc;
    TraceOrders = false;
    RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
    StopTargetHandling = StopTargetHandling.PerEntryExecution;
    // Disable this property for performance gains in Strategy Analyzer optimizations
    // See the Help Guide for additional information
    IsInstantiatedOnEachOptimizationIteration = true;
    }
    else if (State == State.Configure)
    {
    BarsRequiredToTrade = 0;
    //AddChartIndicator(RSI(RSIPeriod, RSISmooth));
    AddDataSeries("MGC 04-22", BarsPeriodType.Day, 1, MarketDataType.Last);
    }
    else if (State == State.DataLoaded)
    {
    
    }
    }
    Any help would be appreciated!

    Thanks,

    -Parker

    #2
    Hello plwieseler,

    From the given code I don't see what may be the problem. Have you tried adding a Print to OnBarUpdate like the following:

    Code:
    Print(Time[0] + " BarsInProgress: " + BarsInProgress);
    Alternatively are you able to run a script on a daily series for this instrument?

    Comment


      #3
      Thank you for the response! After looking through the output window I realized I made a stupid mistake...I had created a trading hours filter at the top of OnBarUpdate, and I was running the logic for the daily data series after that filter, so it never got hit because the daily bar closed at the start of the day.

      Thanks,

      -Parker

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      571 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      331 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
      549 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      549 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X