Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator Data N/A for last day

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

    Indicator Data N/A for last day

    I am trying to understand why sometime the indicator will not calculate the data at the EOD.

    One example is attached. This is also happening with some of my custom indicators.

    Since we are looking at the chart after the closing I would assume that all required data for the ADX calculation is available in the chart.

    Why is this happening?

    Thanks
    Attached Files

    #2
    Which CalculateOnBarClose setting are you working with here? If you worked with it set to 'true' the candle would be only considered closed if the open tick of the new candle had arrived - until then you won't see OnBarUpdate() called for your last bar as it's technically not considered closed.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      OK. I thought the candle would be closed at the close of market day.

      In any case I can certainly add the following statement to my indicators
      CalculateOnBarClose = false;

      The problem is that some of the regular indicators I use don't have this statement.

      The example I reported above is ADX. So what happens if I call the ADX indicator within mine? How will the calculation work on the last bar? Will it use the wrong ADX value?

      Thanks

      Comment


        #4
        agosinv, that's fine - no called study should have this statement hard-coded in, so it could be set as needed from the calling study. For your Market Analyzer this would be determined by whichever choice you've used in the UI for the indicator added.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          OK that will work when I call a new Chart or run the MA as I can set my option in the setup window.

          What do I need to do when I call an indicator from my startegy or another indicator? How do I make sure that I am getting the correct value for the last day bar?

          Thanks

          Comment


            #6
            Originally posted by agosinv View Post
            OK that will work when I call a new Chart or run the MA as I can set my option in the setup window.

            What do I need to do when I call an indicator from my startegy or another indicator? How do I make sure that I am getting the correct value for the last day bar?

            Thanks
            Hello,

            When calling the indicator from another script the following link and related links will provide examples based on the indicator you're running.



            For example:
            Code:
            //do something if 20 period SMA is below the current price
            if(SMA(20)[0] < Close[0])
            {
              //do something
            }
            LanceNinjaTrader Customer Service

            Comment


              #7
              I was trying to find out how I can ensure that the last bar is always included when the indicator is called from within a strategy or another indicator
              If I set the following condition in my strategy will that ensure that all indicators I call in the strategy will use the last bar even if the indicator itself does not contain this condition?
              CalculateOnBarClose = false;

              In other words what do I need to do to make sure all calculations are using the data included in the last bar?

              When I call a chart or the MA I can set this condition in the property but I am not sure if I have to do the same in an indicator or a strategy

              Thanks

              Comment


                #8
                Hello agosinv,

                When calling a script from script, the script calling will supply a data series to the callee. If no data series is specified the primary data series being used by the calling script (strategy) is automatically used.

                The primary data series added to the strategy (the exact data series that will be used with any callee script) will include the currently forming bar if CalculateOnBarClose is False. You must not add a CalculateOnBarClose to the callee indicator to insure there are no issues with the timing of OnBarUpdate calls in the callee script.

                This means that any calculations made on the primary data series when CalculateOnBarClose is False, will include the currently building bar.


                Please let me know if this does not resolve your inquiry.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  YES.

                  Thanks a lot

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by sidlercom80, 10-28-2023, 08:49 AM
                  172 responses
                  2,279 views
                  0 likes
                  Last Post sidlercom80  
                  Started by Irukandji, Yesterday, 02:53 AM
                  2 responses
                  17 views
                  0 likes
                  Last Post Irukandji  
                  Started by adeelshahzad, Today, 03:54 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post adeelshahzad  
                  Started by CortexZenUSA, Today, 12:53 AM
                  0 responses
                  4 views
                  0 likes
                  Last Post CortexZenUSA  
                  Started by CortexZenUSA, Today, 12:46 AM
                  0 responses
                  2 views
                  0 likes
                  Last Post CortexZenUSA  
                  Working...
                  X