Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 inanazsocial, Today, 01:15 AM
        0 responses
        2 views
        0 likes
        Last Post inanazsocial  
        Started by trilliantrader, 04-18-2024, 08:16 AM
        5 responses
        22 views
        0 likes
        Last Post trilliantrader  
        Started by Davidtowleii, Today, 12:15 AM
        0 responses
        3 views
        0 likes
        Last Post Davidtowleii  
        Started by guillembm, Yesterday, 11:25 AM
        2 responses
        9 views
        0 likes
        Last Post guillembm  
        Started by junkone, 04-21-2024, 07:17 AM
        9 responses
        71 views
        0 likes
        Last Post jeronymite  
        Working...
        X