Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AddDataSeries - Time order of series

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

    AddDataSeries - Time order of series

    When adding additional data series to a strategy should they be in order of time another words the shorter time frame added first?

    I am having some syncing issues. I currently have the code below which has the longer time frame added first, excluding BIP 1 tick series which is first.

    My strategy is OnEachTick if that matters

    else if (State == State.Configure)
    {
    AddDataSeries(Data.BarsPeriodType.Tick, 1); //BIP 1
    AddDataSeries(Data.BarsPeriodType.Second, 450); //BIP 2
    AddDataSeries(Data.BarsPeriodType.Second, 120); //BIP 3
    AddDataSeries(Data.BarsPeriodType.Second, 60); //BIP 4
    AddDataSeries(Data.BarsPeriodType.Second, 30); //BIP 4


    Instead should it be

    else if (State == State.Configure)
    {
    AddDataSeries(Data.BarsPeriodType.Tick, 1); //BIP 1
    AddDataSeries(Data.BarsPeriodType.Second, 30); //BIP 2
    AddDataSeries(Data.BarsPeriodType.Second, 60); //BIP 3
    AddDataSeries(Data.BarsPeriodType.Second, 120); //BIP 4
    AddDataSeries(Data.BarsPeriodType.Second, 450); //BIP 4
    Last edited by sdauteuil; 08-28-2021, 07:21 AM.

    #2
    Hello sdauteuil,

    The series do not have to be added in any specific order. The order they are added will be the BarsInProgress (and BarsArray) index.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Can the Unirenko bars cause syncing issues?

      My strategy is using the Unirenko bars.

      It works fine and then will stop trading or take random trades. If I disable and re-enable it will work and then start having the same issue.
      Also when I re-enable the strategy historical trades appear on the chart that were not taken in real time. These are trades that should have been taken in real time.

      If I change the primary chart to a time series or even a regular renko chart I do not have the same issues.

      I thought it might have to do with syncing the data series.

      The strategy is using a SMA of the OrderFlowCumulativeDelta. I do have the code below so that it syncs.

      cumulativeDelta.Update(cumulativeDelta.BarsArray[1].Count - 1, 1);


      I did a print out to the output window of the bars in progress using the code below

      Print("BIP: "+BarsInProgress
      +" | CurrentBars[BarsInProgress]: " + CurrentBars[BarsInProgress]
      +" | Time: " + Times[BarsInProgress][0]);


      The time series data looked like it was correct but the primary Unirenko series looked random sometimes as much as several minutes apart.

      I am not 100% sure syncing is the problem but it is the only idea that I have been able to come up with at this point.

      Thank you for your time.





      Comment


        #4
        Hello sdauteuil,

        When you say syncing issues are you referring to the start behavior?

        By sync issues, are you seeing the close time of different bars in progress appearing to be out of order (this can get confusing if the Calculate setting is not set to OnBarClose).

        Is TickReplay on? Is Calculate set to OnBarClose?

        If the script is being disabled then there either was a run-time error hit or CloseStrategy() or SetState() is being called in the script.
        Are you seeing errors appearing on the Log tab of the Control Center when the strategy is disabled?


        Where you have stated:
        "the primary Unirenko series looked random sometimes as much as several minutes apart."

        There would be no expected time that bars would close. Renko type bars are based on movement and not on time. These could be seconds, minutes, hours apart, depending on how the price moves.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        64 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        139 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        75 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        50 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X