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

Transmittion of data from DataSeries with different time frames

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

    Transmittion of data from DataSeries with different time frames

    Dear all,

    I am facing an issue with moving a value computed (and stored in a dataseries) at a lower time frequency (TF2) to a dataseries of a higher time frequency (TF1).
    The code is as per below.

    1. Define the dataseries with different data timeframes:

    if (myAbsOpenCloseSeries == null)
    {
    myAbsOpenCloseSeries =
    new DataSeries(SMA(BarsArray[1],5));
    myAbsMedianSeries =
    new DataSeries(SMA(BarsArray[1],5));
    }

    myUpBreakoutSeries = new DataSeries(this);

    2. On the lower timeframe, run a statistic computation (working correctly)


    3. Calling the statistic to the higher time frame dataseries when they are in sync else copying/paste the previous data (where my issue is)

    if (BarsInProgress == 0)
    {
    // NOT WORKING: EMTPY DATA IN THE TWO DATASERIES //
    myUpBreakoutSeries.Set(myUpBreakoutSeries[1]);

    if (Times[0][0].Ticks == Times[1][0].Ticks)
    // WORKING //
    {
    maUpOpenBreak = Opens[
    0][0] + myAbsMedianSeries[1];
    myUpBreakoutSeries.Set(maUpOpenBreak);

    }

    Thank you very much,
    Best

    Nicolas

    #2
    Hi Nicolas, when you add in debug prints to your script, do you really see a zero value for the custom series synched to the primary series or would it be the 'dummy' Close value, which is used if no value has been specifically .Set for this bar?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hello Bertrand,

      Yes it does. I attach a txt version of the code.
      Thanks for looking at my issue. Appreciated.
      Best

      Nicolas
      Attached Files

      Comment


        #4
        Hello Nicolas,
        To assist you further may I know what is the primary data series you are testing the indicator.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Hi Joydeep,

          If I understood correctly your question, I have tested the script with USDEUR, 1h. My secondary time-frame is 3h.
          Thanks a lot,
          Best

          Nicolas

          Comment


            #6
            Hello Nicolas,
            Thanks for the information.

            The secondary series in your code refers to a daily bar series
            Code:
            Add(PeriodType.Day, TF2);
            To clarify further is it the same code or I need to change the timeframe.
            JoydeepNinjaTrader Customer Service

            Comment


              #7
              JoyDeep,
              It is the same code, and indeed variables are confusing.
              "Add(PeriodType.Day, TF2);" with TF2 refers to "private int TF2 = 3;"
              Hope I am understanding correctly your question.
              Thanks,
              Best

              Nicolas

              Comment


                #8
                Hello nlaporte,
                If you are trying to add a 3 hours bar series then the code will be:
                Code:
                private int TF2	= [COLOR="blue"][B]180[/B][/COLOR];
                Add(PeriodType.[COLOR="Blue"][B]Minute[/B][/COLOR], TF2);
                In your code you have referenced to a daily bar series.
                Code:
                [COLOR="Red"]Add(PeriodType.Day, TF2);[/COLOR]
                JoydeepNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by martin70, 03-24-2023, 04:58 AM
                15 responses
                114 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by The_Sec, Today, 02:29 PM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by jeronymite, 04-12-2024, 04:26 PM
                2 responses
                31 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by Mindset, 05-06-2023, 09:03 PM
                10 responses
                265 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by michi08, 10-05-2018, 09:31 AM
                5 responses
                743 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Working...
                X