Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnBarUpdate using Bar interval from Added dataseries not the interval set on chart

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

    OnBarUpdate using Bar interval from Added dataseries not the interval set on chart

    Hi
    I have just disvovered that if I add a DataSeries thgrough code to my Indicator like this
    Code:
    AddDataSeries(Data.BarsPeriodType.Minute, 1);
    eventhough my chart is set to 5 minutes
    the OnBarUpdate method uses the 1 minute interval instead of the 5 minutes set on the chart.

    Is this the way it should work ?

    Best Regards,
    Sune

    #2
    Hi Sune, thanks for your post.

    The 1-minute series is simply being called 4 more times for each 5-minute bar. If you print out the bar and time this will be clearer.


    Code:
    OnBarUpdate()
    {
        if(BarsInProgress == 0)
        {
            Print(Time[0] + " Primary series")
        }
    
        if(BarsInProgress == 1)
        {
            Print(Time[0] + " Secondary series")
        }
    }
    We have a multi time frame script guide here as well:



    Please let me know if you have any further questions.

    Comment


      #3
      Hi Chris

      Thanks that helped my understanding.

      Best Regards,
      Sune

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      41 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      20 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      28 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      45 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      37 views
      0 likes
      Last Post CarlTrading  
      Working...
      X