Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator going crazy

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

    Indicator going crazy

    Hello, dear support

    I've implemented simple indicator based on different types of moving averages with different formulas.

    And when I add the indicator to the chart, the indicator starts going crazy. Looks like no calculations etc.

    But when I suddenly, press F5 to refresh the chart , all curves back to normal. What can be a problem to this?

    You can see the issue in attached two pictures.

    --
    Andriy
    Attached Files

    #2
    Hello,

    Thank you for the question.

    Based on the Image and description of how to correct the indicator, it sounds like the Historical calculation you are doing is working as expected but not the Realtime portion.

    If the first image where the data begins to look abnormal is all realtime, this would be a good clue on where to start looking. I am not certain on the logic you are using in the script but this would likely be caused by whatever logic is executed after the historical data has been processed.

    When you press F5, the data that did look incorrect is now historical data and is re processed under the Historical portion of the logic which seems to be working. Because of this action, this could help confirm this is specifically to do with the logic being executed in realtime.

    To further determine why this is occurring, you would likely need to further debug the script to see if conditions are becoming true at incorrect times, additionally the values being used and plotted would need to be Printed to verify the calculation is happening as expected in realtime.


    I look forward to being of further assistance.

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello,

      Thank you for the question.

      Based on the Image and description of how to correct the indicator, it sounds like the Historical calculation you are doing is working as expected but not the Realtime portion.

      If the first image where the data begins to look abnormal is all realtime, this would be a good clue on where to start looking. I am not certain on the logic you are using in the script but this would likely be caused by whatever logic is executed after the historical data has been processed.

      When you press F5, the data that did look incorrect is now historical data and is re processed under the Historical portion of the logic which seems to be working. Because of this action, this could help confirm this is specifically to do with the logic being executed in realtime.

      To further determine why this is occurring, you would likely need to further debug the script to see if conditions are becoming true at incorrect times, additionally the values being used and plotted would need to be Printed to verify the calculation is happening as expected in realtime.


      I look forward to being of further assistance.
      Hello and thank you for the answer. I didn't fully understand what you mean.
      The logic very simple, could you please look inside to figure out what can be wrong ?

      the .cs file attached to the message.
      Thank you.
      Attached Files
      Last edited by akushyn; 04-26-2016, 01:18 PM.

      Comment


        #4
        Hello,

        Thank you for the reply.

        I looked over the indicator, the only item I see that sticks out would be that you are using CalculateOnBarClose = false;. This would entail that in Historical data you are using CalculateOnBarClose = true because historical data can not be processed as CalculateOnBarClose false, in realtime you are using CalculateOnBarClose = false; which do not match. If the item is working correctly historically, likely changing the CalculateOnBarClose setting to true would assist in it being closer to the historical calculation.

        Generally for this type of question you would need to debug the code to find why the values or conditions are not what is expected and to see how the logic is being executed. I would suggest changing the CalculateOnBarClose setting to true as a starting point, if that does not correct the outcome you will likely need to debug the logic to find the cause. If this is the case, one way to see what is happening is to Print the values being used such as the indicator values, or other variables you use to see how frequently the value is set and the values being passed.

        I look forward to being of further assistance.

        Comment


          #5
          Originally posted by NinjaTrader_Jesse View Post
          Hello,

          Thank you for the reply.

          I looked over the indicator, the only item I see that sticks out would be that you are using CalculateOnBarClose = false;. This would entail that in Historical data you are using CalculateOnBarClose = true because historical data can not be processed as CalculateOnBarClose false, in realtime you are using CalculateOnBarClose = false; which do not match. If the item is working correctly historically, likely changing the CalculateOnBarClose setting to true would assist in it being closer to the historical calculation.

          Generally for this type of question you would need to debug the code to find why the values or conditions are not what is expected and to see how the logic is being executed. I would suggest changing the CalculateOnBarClose setting to true as a starting point, if that does not correct the outcome you will likely need to debug the logic to find the cause. If this is the case, one way to see what is happening is to Print the values being used such as the indicator values, or other variables you use to see how frequently the value is set and the values being passed.

          I look forward to being of further assistance.
          Hello, Jeese!

          I've tried everything what you advise, still not working.
          After few tries, I've created another new indicator
          * without any functions
          * without any logic

          Just like in samples from help. And the same problem (see attached pics)
          I just draw difference between two moving averages, can't be more easier.

          I've attached the source file to the message (only one line of code)
          Looks like its a Ninjatrader BUG.
          Could you, please, run the same file on your machine?

          Thank you.
          Attached Files

          Comment


            #6
            Hello akushyn,

            Thank you for your response.

            I am not seeing drastic differences like you are, however I do not have the SMMA. Can you attach your SMMA indicator to your response?
            You can attach your indicator to your response by going to File > Utilities > Export NinjaScript > Export selected source files > select your Indicator > select the right arrow > Export. The file will be located under (My) Documents\NinjaTrader 7\bin\Custom\ExportNinjaScript.

            Comment


              #7
              Originally posted by NinjaTrader_PatrickH View Post
              Hello akushyn,

              Thank you for your response.

              I am not seeing drastic differences like you are, however I do not have the SMMA. Can you attach your SMMA indicator to your response?
              You can attach your indicator to your response by going to File > Utilities > Export NinjaScript > Export selected source files > select your Indicator > select the right arrow > Export. The file will be located under (My) Documents\NinjaTrader 7\bin\Custom\ExportNinjaScript.
              Thank you for the reply
              I've attached to the end of the message
              Attached Files

              Comment


                #8
                Hello akushyn,

                Thank you for your patience.

                In my testing I can reproduce the same behavior using the SMMA indicator. If I replace the SMMA with the SMA this does not occur. I would recommend contacting the developer of the SMMA for assistance with their indicator.

                If you have any questions please let us know.

                Comment


                  #9
                  Originally posted by NinjaTrader_PatrickH View Post
                  Hello akushyn,

                  Thank you for your patience.

                  In my testing I can reproduce the same behavior using the SMMA indicator. If I replace the SMMA with the SMA this does not occur. I would recommend contacting the developer of the SMMA for assistance with their indicator.

                  If you have any questions please let us know.
                  Hello, Patrick.

                  Thank you for the reply.
                  I thought, it was NT implementation of the SMMA. Now I've implemented custom SMMA indicator and problem solved.

                  Have another question: when I run indicator, in output window I've got message:

                  Code:
                  Error on calling 'OnBarUpdate' method for indicator 'WMA' on bar 256: barsAgo needed to be between 0 and 255 but was 256
                  What does it mean and what you advise to fix it ?

                  Comment


                    #10
                    Originally posted by akushyn View Post
                    Code:
                    Error on calling 'OnBarUpdate' method for indicator 'WMA' on bar 256: barsAgo needed to be between 0 and 255 but was 256
                    What does it mean and what you advise to fix it ?
                    This would indicator the period is larger than 256, although it could indicate something else. I would start by setting the 'MaximumBarsLookBack' to 'Infinite' in the Indicators menu when applying your indicator to the chart.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    571 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    331 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    101 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    549 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    549 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X