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

Referenced MTF Indicator not Uppdated when Scrolling a Chart

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

    Referenced MTF Indicator not Uppdated when Scrolling a Chart

    Hello!

    I'v coded an MTF indicator that monitors intrabar pullbacks in the base bars series (30 min bars) on a lower time frame ( 1 min bars) when COBC = True. This indicator is referenced by another indicator. The indicator works fine except for the situation when I look at a historical chart and "add" new bars to the chart by scrolling to the right (after I have updated Ninja Script). The calling indicator then returns incorrect values. (But the referenced indicator is correctly uppdated when added directly to the chart in this situation.) I can see from my print statments that the lower time frame bars series is not called at all when new bars are added to the chart this way. The indicator is correctly uppdated when called in RT with COBC = true and also when I do "Reload Ninja Script" on a historical chart.

    How can I make the calling indicator update correctly in the situation when i scroll the chart bar by bar?

    Best Regards
    poseidon_Sthlm

    #2
    Hello,

    Does the issue persist when you set Maximum bars look back to infinite?
    Code:
    protected override void Initialize() 
    {
          // Store all series values instead of only the last 256 values
         MaximumBarsLookBack = MaximumBarsLookBack.Infinite;
    }


    This can also be set from the indicators' properties menu.

    Please let me know if I can be of further assistance.
    LanceNinjaTrader Customer Service

    Comment


      #3
      No, I'v tested with MaximumBarsLookBack = MaximumBarsLookBack.Infinite, but still the same issue.

      The issue seems to be a problem with the update of the lower time frame bars series when referenced by another indicator. Both the lower tf and the calling indicator have to be uppdated before returning values to the calling indicator. No print statments at all from the referenced indicator appear in the output window in the described situation.

      Since the secondary bars series is a lower time frame object I had to code a work around so that the last 1 min bar within the concurrent 30 min bar with the same time stamp is updated before the 30 min bar closes, since NT calls the bars objects in the order they are indexed in BarsArray[i]. (So for a MTF indicator with an added lower TF bars series, NT does update the 30 min bars BarsArray[0] before the 1 min bars BarsArray[1] ). But I can't see that this is the reason for the issue.

      Any suggestions or thoughts on how to solve this?

      Best Regards,
      poseidon_sthlm
      Last edited by poseidon_sthlm; 11-26-2012, 12:24 PM.

      Comment


        #4
        Hello,

        It may be that not enough bars are available when scrolling back.
        Please ensure that enough bars have been loaded such that it will not run if insufficient chart data is available.

        When dealing with MTF indicators you will not be able to use BarsRequired, instead use CurrentBars()

        http://www.ninjatrader.com/support/h...urrentbars.htm

        If this does not resolve the issue, could you please attach your code (or simplified version of the code) so that I may test on my end?

        Let me know if I can be of further assistance.
        LanceNinjaTrader Customer Service

        Comment


          #5
          Hello again!

          I'v attached a simplified example that demonstrates the same issue as described below.

          The indicator named "TestIntrabarBoMtfCobc" monitors a lower 1 min tf to catch a breakout of the base series. ( I used 5 min ES as base.) This indicator plots bull and bear BO:s as expected.

          But when I reference this indicator in the second indicator in the attachment, named "TestIntrabarBoMtfCobcReferencing", it displays a very different output when you add new bars by scrolling the chart to the right. You can easily see this when you attach both indicators to the same 5 min chart. The plots should be identical, but they differ after you have scrolled the chart for more than 2 bars to the right.

          Since the referenced indicator doesn't generate print statments from the lower timeframe, I'm stuck and would appreciate your help.

          Best Regards,
          poseidon_sthlm
          Attached Files

          Comment


            #6
            Hello,

            I've applied both indicators to my chart and I appear to be having mirrored results between the two.

            I've attached 2 screen shots of my chart and 3 screen shots of my different settings.

            Please let me know if yours are different.

            Additionally, please provide me with an image of your chart.
            To send a screenshot press Alt + PRINT SCREEN to take a screen shot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.
            For detailed instructions please visit the following link

            * http://take-a-screenshot.org/

            I look forward to assisting you further.
            Attached Files
            LanceNinjaTrader Customer Service

            Comment


              #7
              Hello!

              I can now see that the issue diappears when I set the "Maximum bars look back" property to infinite for the referenced indicator as well as for the calling indicator. I thought I only had to adjust this property for the referenced indicator. Why do I have to set this property for the calling indicator? This is undesirable since it affects all bars series of the calling indicator. Is there an alternative to this?

              Best Regards,
              poseidon_sthlm
              Attached Files
              Last edited by poseidon_sthlm; 11-28-2012, 07:22 AM.

              Comment


                #8
                Hello,

                When you are using and indicator that makes a call to an indicator it is NOT referencing the other indicator you see on your chart. Instead it will create its own instance of that indicator which will run in the background unless otherwise specified.

                Because of this, the look back period is set by the primary indicator being run and not the other indicators you have on your chart even if you make calls to the same type of indicator within your code.

                Please let me know if I can be of further assistance.
                LanceNinjaTrader Customer Service

                Comment


                  #9
                  I found that when I add the property MaimumBarsLookBack to the StringSeries of the called indicator the issue disapears, withot adding MaximumBarsLookBack.Infinite to the calling indicator.

                  Code:
                  bo     = new StringSeries(this, MaximumBarsLookBack.Infinite);
                  Thanks for your help.

                  Best Regards,
                  poseidon_sthlm

                  Comment


                    #10
                    Glad to hear it's working for you.

                    Please let me know if I can be of further assistance.
                    LanceNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by cre8able, Today, 03:20 PM
                    0 responses
                    5 views
                    0 likes
                    Last Post cre8able  
                    Started by Fran888, 02-16-2024, 10:48 AM
                    3 responses
                    47 views
                    0 likes
                    Last Post Sam2515
                    by Sam2515
                     
                    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  
                    Working...
                    X