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

Multiple time frame indicators behavior NT 7

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

    Multiple time frame indicators behavior NT 7

    Hi,

    Can you please help me understanding how the data is calculated on multiple time frame indicators with below example?

    I have created simple indicator with only print statement in OnBarUpdate()

    Step 1:

    protected override void Initialize()
    {
    CalculateOnBarClose = false;
    }

    protected override void OnBarUpdate()
    {
    if (BarsInProgress == 0)
    {
    Print("Test "+BarsInProgress+" "+CurrentBar+" "+Time[0]);
    }
    }

    When I apply this indicator to 5 min chart with Load Data as custom range between dates and scroll back to first day of data in the chart, clear the output and hit F5.

    Out put window is displaying bar numbers that are visible in the chart and when i press right arrow it is printing bar by bar as expected as soon as hit right arrow one bar at a time.

    Adding secondary bars to indicator:
    protected override void Initialize()
    {
    CalculateOnBarClose = false;
    Add(PeriodType.Tick, 1);
    }

    No changes to OnBarUpdate

    When I hit F5, it is printing all the bars in custom range between dates that was chosen while creating the chart rather than just printing bars on the chart.

    Is this the expected behavior? Is there a way to execute code only for the bars on the chart and calculate rest of the bars only when they are visible on the chart(after pressing right arrow key)?

    thanks,

    #2
    Hello gsreddy,

    Thanks for your post.

    The charted data series allows for that behavior (bar by bar) based on the visual bars but any virtual bars (not plotted) would not see the same behavior. If you added the 1 tick series to the chart you will see the behavior you first experienced although I doubt this will be a satisfactory method given the potential for so many 1 tick bars in a 5 minute range.

    Alternatively you would be able to accomplish this (5 minute chart bars and 1 tick virtual bars) using Market Replay.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      thanks Paul,

      i have indicator_1 using the results from indicator 2. indicator 2 has 1 tick data series added for calculations.

      if i don't add 1 tick series to indicator 1, i am getting wrong results from indicator 2. indicator 2 is always returning last bar values in the data range the chart is using.

      when i add 1 tick series to indicator 1, i am getting results as expected from indicator 2. (indicator 1 and 2 has added 1 tick series).

      is this the expected behavior?

      thanks
      gsreddy

      Comment


        #4
        Hello gsreddy,

        Thanks for your reply.

        Can you clarify if these observations are under the same process as your original post or does this occur during live data processing? Asking another way, does this only occur with historical data?
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          only with historical data.

          we can easily create this test case, by just returning current bar number from indicator 2 to indicator 1 and having print statement in indicator one.

          thanks
          Last edited by gsreddy; 02-03-2016, 12:16 PM.

          Comment


            #6
            Hello gsreddy,

            Thanks for your reply.

            With historical data your processing will be based on CalculateOnbarClose = true which means that you would be looking at the last completed bar in a series and not a forming bar. Please see the helpguide here: http://ninjatrader.com/support/helpG...nstruments.htm and in particular the illustrations in the section: " How Bar Data is Referenced"
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Hi Paul,

              sorry for late reply.

              today i have tested my indicator live. as soon as i connect to live data all the old plots or values are not available for referencing back. but the calculations are working exasperated for in coming data after data refresh. as soon as i connect to live data chart is refreshing.

              do i need to set any properties to keep all the indicator values for historical data?

              thanks,

              Comment


                #8
                Hello gsreddy,

                If you set CalculateOnBarClose = true, your indicator will process live in the same manner as historical.
                Paul H.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by f.saeidi, Today, 05:56 AM
                1 response
                3 views
                0 likes
                Last Post Jltarrau  
                Started by Jltarrau, Today, 05:57 AM
                0 responses
                4 views
                0 likes
                Last Post Jltarrau  
                Started by Stanfillirenfro, Yesterday, 09:19 AM
                7 responses
                51 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by TraderCro, 04-12-2024, 11:36 AM
                4 responses
                70 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Mindset, Yesterday, 02:04 AM
                1 response
                15 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Working...
                X