Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CCI indicator broken

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

    CCI indicator broken

    Hi,
    I have trivial strategy, that just outputs CCI(50) value.
    It is Unmanaged + Multi-timeframe strategy.

    It is failing on this line in @CCI.cs
    Code:
    mean += Math.Abs(Typical[idx] - sma0);

    Cause of the exception is, that Typical cannot return value with provided index:
    This is quick fix:
    Code:
    mean += Math.Abs( (High[idx] + Low[idx] + Close[idx])/3  -  sma0);
    but to really solve the problem, Typical has to investigated, why it cannot return value.

    DOWNLOAD THIS STRATEGY TO REPRODUCE

    Tested on:
    • NT8 v8.0.1.0
    • Windows 10
    Attached Files

    #2
    Hello misova,

    You have stated that the Typical cannot return a value.

    I have tested this with a script that only prints the Typical and this prints without error when using value indexes.
    This demonstrates that when used with a valid index, the Typical does return a value.

    May I have you run this script on your end?
    Are you receiving an error when running this script?
    Are you seeing the prints appear in the output window?


    Also, I have added the CCI included with NinjaTrader 8 to a chart and this produced plots without error; I have also called the CCI from a test strategy and this is returning a value without error.
    Attached Files
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi ChelseaB

      I tested your TypicalTest.cs and here is the result:
      • I see all prints and there isn't any error.
      • When I plotted the CCI indicator - it also works fine. It is plotted successfully and looks OK. So no problems with your strategy.


      It can be, that that simplicity of the strategy does not exploit
      the problem and failure happens in more complex scenario with multiple timeframes.
      With one timeframe, it works fine. With multiple timeframes if fails.
      -----

      So I updated your file, to achieve reproducible scenario, where it fails everytime.
      Here are the steps:
      1. Download TypicalTest.cs - I updated your strategy slightly, to achieve failure.
      2. Apply my settings - see the screenshot at the bottom. Important is to use 60min timeframe.
      3. Expected results is the exception below printed in the Output window


      Expected exception - CCI indicator fails
      Code:
      Indicator 'CCI': Error on calling 'OnBarUpdate' method on bar 4: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
      BIP: 1 | Time: 2016-01-04 04:15:00 | Typical[0]: 1.09996666666667 | Typical[50]: 1.09886666666667 | CCI: 0
      Strategy 'TypicalTest': Error on calling 'OnBarUpdate' method on bar 3: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
      End.
      Here is also the screenshot - to see, it really happens.



      Quick fix for the exception
      Replace line 69 in @CCI.cs:
      Old line, that causes bug:
      Code:
      mean += Math.Abs(Typical[idx] - sma0);
      New line, that works:
      Code:
      mean += Math.Abs((High[idx] + Low[idx] + Close[idx]) / 3 - sma0);
      I can't explain, why the Typical[idx] fails. I just know, it throws exception.


      Settings for strategy - to reproduce exception


      Let me know, if you could reproduce it and confirm the problem please.
      Best regards
      misova
      Attached Files
      Last edited by misova; 12-28-2016, 07:51 AM.

      Comment


        #4
        Hello misova, and thank you for your report.


        This behavior was confirmed on our end. We will be investigating this further. Please keep an eye on the NinjaTrader 8 Release Notes page for updates and bugfixes.


        http://ninjatrader.com/support/helpG...ease_notes.htm


        Tracking ID: NTEIGHT-10974
        Jessica P.NinjaTrader Customer Service

        Comment


          #5
          Hello misova,

          This should be repaired in the next release of NinjaTrader. Please let us know if this behavior persists.
          Jessica P.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by pilotfo, Today, 12:50 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by DTSSTS, Today, 11:35 AM
          2 responses
          11 views
          0 likes
          Last Post DTSSTS
          by DTSSTS
           
          Started by sinpeople, Today, 07:20 AM
          2 responses
          9 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by Frank1000, Today, 03:05 AM
          5 responses
          16 views
          0 likes
          Last Post Frank1000  
          Started by fscabrera03, Yesterday, 01:18 PM
          2 responses
          26 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X