Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator on a DataSeries

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

    Indicator on a DataSeries

    Hallo,

    Here is my question: I have sync a dataSeries with a the closes of secondary timeframe.
    dataSeries.Set(Closes[1][0]);

    Then, I manually change its first value by writing
    dataySeries[0]= 1000;

    When I apply an indicator like EMA or MACD on this dataSeries, I get very strange results...

    What am I missing here??

    Thanks for the help!!

    /Juan


    #2
    To set a value:

    DataSeries.Set(yourValue);
    RayNinjaTrader Customer Service

    Comment


      #3
      Ok, I tried that also: Now I have

      secondarySeries.Set(0,1000);

      I just want to manually change the last value, the rest are kept the same. (I can see that in the output)

      However, when I pass this dataseries into an indicator like EMA, it is not calculating right...

      /Juan

      Comment


        #4
        Try:

        secondarySeries.Set(1000);
        RayNinjaTrader Customer Service

        Comment


          #5
          Ok, but still

          My dataseries is changing with every minute bar (can see this in the output) but the EMA, or MACD or SMA I calculate with the dataseries stays the same....

          What am I missing?

          Comment


            #6
            Isn't that the issue you asked last week in a different thread?


            Please see my replies on this thread and in particular the hint on BarsRequired.

            Comment


              #7
              Yes, it is the same issue.

              I do not think it a matter of the bars required.

              My trouble is:

              With every minute bar, my dataseries changes but only the dataseries[0]. The dataseries[1], [2] and so on stays the same, until a new 30minute bars comes along. That is what I wanted.

              What i do not get is why the EMA of this dataseries is not changing every minute!!! It remains unchanged!!!!!

              Comment


                #8
                Not sure I follow. The dataseries will change will the series it's created on. I suggest starting with single series strategy to understand the concept of dataseries.

                Comment


                  #9
                  Ok, I see.

                  My dataseries is created on the close of 30min bars.
                  However, with every 1min bar, I manually assign the closing of the 1min bar to the last value of the dataseries. I look at the output and the "trick" seems to work: the dataseries[0] changes every minute but the dataseries[1] and all the others are kept with the 30min bar closing values.

                  However, when I pass this dataseries onto an indicator, it takes the 30min closing values for all the bars and does not take account for the changes I thought the dataseries was suffering every minute.

                  Does it exist another way (maybe some other sort of dataseries) flexible enough to allow me to do this?

                  Thanks for your help, I know I am insisting too much on this issue.

                  /Juan Rivera

                  Comment


                    #10
                    Sorry, I don't follow. Please provide a simple as possible strategy (e.g. with Print() statements) to demonstrate what you are observing.

                    Also: What are the exact settings you apply on running the strategy?

                    Comment


                      #11
                      Hallo,

                      What I want is: I trade with 30min bars and I am waiting for an EMA to cross some level. Let´s say it is 10.00am, one bar just closed and the EMA didn´t cross that level but it was really close. I do not want to wait 30min only to discover that now the EMA is well above my level.

                      In order to enter long earlier, I want to check a "temporary" EMA every minute, using the closing of the 10.01, then the closing of 10.02, waiting for my Temporary EMA to cross...

                      I attach here the txt file of my dataseries. You will notice that dataseries[0] changes every minute and differs from Closes[1][0] but dataseries[1] and [2] are equal to CLoses[1][1] and [2].
                      However, the EMA of the dataseries does not change...

                      Hope you can help me out here...
                      Attached Files

                      Comment


                        #12
                        I explained to you in the other thread that
                        EMA(Closes[1],3)[0]=6820,6 EMA(dataseries,3)[0]=6794,1
                        NEVER will be identical, since OnBarUpdate() will not be called for CurrentBar < BarsRequired, thus your custom "dataseries" and Closes[1] won't match, since "dataseries" won't have any data point for CurrentBar < BarsRequired.

                        In case it's still not clear: please proceed as per my previous post and post a simple as possible (!) variation of your strategy (holding Print() statements) to demonstrate what you are observing. Posting a Print() output is not sufficient. Thanks

                        Comment


                          #13
                          Well, I clearly do not understand the concept of BarRequired.
                          I wonder... How many bars are required to calculate an EMA of 3 bars??

                          Anyway, I attach here my code.
                          I am going to give this BarsRequired concept some more thought...

                          Thank you Dierk for your patience with me...

                          Regards,
                          Juan Rivera
                          Attached Files

                          Comment


                            #14
                            Try running with CalculateOnBarClose = false.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #15
                              Not sure I fully understand what you are trying to demonstrate by the sample strategy but e.g. this line:
                              Print("EMA(Closes[1],3)[0]=" + EMA(Closes[1],3)[0].ToString("0.0") + " EMA(dataseries,3)[0]=" + EMA(secondarySeries, 3)[0].ToString("0.0"));

                              NEVER will print, since your "filling" logic for secondarySeries is not triggered for
                              a) CurrentBar < 840 (see your code)
                              b) CurrentBar < BarsRequired (NT logic).

                              I stringly recommend to make yourself familiar with the BarsRequired concept before proceeding: http://www.ninjatrader-support.com/H...Required1.html

                              Unfortunately there is not further info I could provide.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              599 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              344 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              103 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              558 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              557 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X