Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi Timeframe with Series<double>

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

    Multi Timeframe with Series<double>

    Hey guys,

    Okay as Mathew advised me I'm trying to build an indicator showing results on the 1 minut timeframe from the tick timeframe. So I added a DataSeries with 1 tick data, I got then a Series<Double> variable which get updated every tick and it works well on a tick chart. But, if I load the indicator on a 1 minut chart, I don't have the same results as the tick chart, it's getting updated each minut.

    Why ? Because the Series<double> I use is : Variable[0] = Variable[1] + X, so it uses data from the primary chart ! And I can't program Variable[0][1] = Variable[1][1] + X

    How can I do to "import" my Series<double> calculated from the tick chart to the 1 minut chart ?



    Thanks !

    #2
    I wasn’t sure I followed your meaning correctly, but I think that you have an indicator with an extra data series (tick) and it is working fine when it is applied to a tick chart, but not a minute chart, is that correct?

    If I’ve understood correctly, it could be because on the tick chart it is using the timeframe from that chart [tick]. But when you add the indicator to a 1 minute chart, the indicator is using the primary dataseries (1 minute) for its calculations.

    If you always want the indicator to calculate from tick regardless of what chart it is applied to, I think will have to add the tick data as an extra dataseries in your indicator code, and then make sure that you access this data series during OnBarUpdate with “if (BarsInProgress == 1)”

    So any updates you need done on each tick would be on that dataseries within the that BarsInProress, and if you need any calculations done on the update of the primary chart dataseries (i.e. your 1 minute chart) then you would use “if (BarsInProgress == 0)”

    By the sounds of it, you will need to set the variable that's updating each tick using BIP=1 and then access that variable on the minute data using BIP=0 (assuming it is a minute chart).

    Hope that helps, the NT info on multi time frame stuff is pretty good, here is the bit about bars in progress: http://ninjatrader.com/support/helpG...inprogress.htm
    Last edited by ShaneAU; 10-29-2015, 08:44 PM.

    Comment


      #3
      You understood everything Shane, thanks it helps !

      Well, what do you mean here ?
      "By the sounds of it, you will need to set the variable that's updating each tick using BIP=1 and then access that variable on the minute data using BIP=0 (assuming it is a minute chart)."

      I tried another thing this morning thanks to your advise :

      Code:
      if (BarsInProgress == 1)
      
                  {
                      Data1 = Closes[1][0];
      		Data2 = Closes[2][0];
      		
      				
      				if (Data1>=Data2) {
      					IndicatorNinja[0] = IndicatorNinja[1] + 1;
      				}
      				
                  }
      			
      
      			
      Values[0][0] = IndicatorNinja;
      When I plot this on a X minut chart, Data1 and Data2 are well plotted (it's getting updated each tick) but not IndicatorNinja, I don't understand why.

      Comment


        #4
        What I am meaning is that anything that you want to be run whenever the tick dataseries is updated will need to be in the "if (BarsInProgress == 1)" and everything you want to be run when the bars on the default chart timeframe are updated, which is your minute timeframe, will need to be in "if (BarsInProgress == 0)".

        So in the BarsInPogress 0 you could set the variable to the Close[0] there, and in the BarsInProgress1 you could set that Close[0] in there. Then you could compare them using your equation in either BarsInProgress 1 or 0 - it just depends what you ware wanting it to do.

        Also it will depend on whether you have the indicator set to Calculate On Bar Close or not.

        Hope that helps... If any NT people are reading this they may have better or clearer advice

        Comment


          #5
          Okay thanks so I understood everything,

          Well, the code is getting updated every tick and "IndicatorNinja" is a variable which get updated every tick. The issue remains : it's getting updated every minut in the code below, and I don't understand why because it's calculated in the "BarsInProgress==1" part and "Data1"/"Data2" which are in this part too are well updated.

          Comment


            #6
            Since your script is running on a Minute interval for the primary instrument, have you set Calculate = Calculate.OnEachTick? It sounds to me like you are properly updating the value of IndicatorNinja each tick, but your plot is only updating each minute -- am I interpreting that correctly? If that is the case, then setting Calculate.OnEachTick should cause your plot to update on each tick.
            Dave I.NinjaTrader Product Management

            Comment


              #7
              Hey Dave, yes I set set Calculate = Calculate.OnEachTick

              "It sounds to me like you are properly updating the value of IndicatorNinja each tick, but your plot is only updating each minute -- am I interpreting that correctly?"

              Well, IndicatorNinja should get updated when Data1>Data2 each tick.
              Data1 and Data2 too are correctly updated and plotted because on a one minute chart I see them move each tick.
              IndicatorNinja isn't correctly plotted on a minut chart, it doesn't get updated each tick.
              Last edited by After; 10-30-2015, 10:06 AM.

              Comment


                #8
                Just so that I fully understand the script, can you tell me what the third data series is? The first is a 1-Minute, and the second is a 1-Tick, but what is being referenced here?

                Code:
                Data2 = Closes[2][0];
                Dave I.NinjaTrader Product Management

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by frankthearm, Yesterday, 09:08 AM
                12 responses
                43 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Started by junkone, Today, 11:37 AM
                1 response
                12 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by quantismo, 04-17-2024, 05:13 PM
                5 responses
                35 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by proptrade13, Today, 11:06 AM
                1 response
                6 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Started by love2code2trade, 04-17-2024, 01:45 PM
                4 responses
                35 views
                0 likes
                Last Post love2code2trade  
                Working...
                X