Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CalculateOnBarClose

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

    CalculateOnBarClose

    The indicators I created work fine with CalculateOnBarClose set to "true" in the property window. When I set to false it is supposed to update every tick as if it is the last tick of the bar. However, the indicators I created plot clunkily and at times plot goes in one direction endlessly. Pressing apply in the property window sets it right though.

    What is likely be the cause of this problem?? Thanks for your help.

    #2
    Is your indicator built using other indicators ... indicators that are not distributed with the NT install? My guess is that it is and you should check the status of the COBC in those indicators.

    Additionally, a screen shot and code would help the support staff.

    TJ

    Comment


      #3
      Originally posted by Rdsouza View Post
      The indicators I created work fine with CalculateOnBarClose set to "true" in the property window. When I set to false it is supposed to update every tick as if it is the last tick of the bar. However, the indicators I created plot clunkily and at times plot goes in one direction endlessly. Pressing apply in the property window sets it right though.

      What is likely be the cause of this problem?? Thanks for your help.
      Rdsouza, welcome to the forums here - can you please check out TJ's suggestion below and let me know if removing CalculateOnBarClose from the called indicators would resolve the issues seen?
      BertrandNinjaTrader Customer Service

      Comment


        #4
        Thank you for the replies. Trader.Jon was right! I created a new test indicator via the wizard and copied the logic of WMA that did not contain any indicator nestled in it. The test indicator worked correctly as did the WMA when COBC was false in the properties window.

        Now the question is if I absoluty need to use one indicator inside another, how do I go about checking the COBC status? In one of such cases that is misbehaving, I only used SUM that does not contain COBC command in the logic.

        thanks and best regards
        Rdsouza

        Comment


          #5
          Hello Rdsouza,

          You will want to check the Initialize() method for all called indicators. Delete any reference to CalculateOnBarClose here.

          You can define CalculateOnBarClose in the calling indicator, either through code or the GUI selection.

          Example:
          SMA(EMA(MACD(12, 26, 9).Avg, 14), 20)

          SMA is the calling indicator, and you can define COBC here - either in code or the gui. You will want to make sure that COBC is not defined in the code for EMA and MACD. (the called indicators)
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            CalculateOnBarClose

            Dear Sirs,

            I tested again the COBC problem. It is continuing to trouble me. This time I created a WMA by copying the logic from NT7 but added a adaptive twist to it. When the range of periods between which the periods (number of bars) should adapt was zero that is lower period = higher period, the indicator behaved just as NT7 WMA would when COBC is false (second image - "adaptive inactive" where the indicator is incerted twice once with COBC false and another with COBC true)

            However when the higher and the lower period parameters are different the one with COBC false traces diffeent path. See the first image called "adaptive active" where again the indicator is added twice with same paramenters but one with COBC false (colour green, pixel 1) and another COBC true (colour purple, pixel 2). Please see the last few bars (since 11.36) when the live data came in.

            The indicator (attached) does not contain any reference to COBC nor to any other indicators nor does it contain any math functions. I would however like to know if math functions impact COBC when false?

            Please tell me what is going wrong in my script that it does not trace a line as it should. If used in a strategy it can give uncontrolable results if COBC set to false.

            Thank and best regards
            Rdsouza
            Attached Files

            Comment


              #7
              Rdsouza, unfortunately we could not debug the script for you - you would need to print all calc'ed values and then monitor the adaptive vs nonadaptive version in COBC true / false environments to be able to see which values are not working out as you would expect.
              BertrandNinjaTrader Customer Service

              Comment


                #8
                Thank you NinjaTrader_Bertrand, Please tell me how to print the numbers generated by indicator calculations as I am new to NT as well as C#

                The two screen shots included in my last post, both of them contain the same indicator loaded twice in each screen. One of the loaded indicator is set to COBC true where everything is fine. ther other is set to COBC false in both screen shots. It does not trace the same line as COBC true and if the shorter length and longer length are different. Where as when shorter length and longer length are equal then both COBC false or COBC true trace same line. this shows that part of the script for adaptive twist must have some problem in it. However if you can tell me how to print the numbers as you indicated I will be much obliged. May be the developers can throw some light.

                much obliged for your help

                best regards
                Rdsouza

                Comment


                  #9
                  Hello Rdsouza,

                  Help for Print() statements and debugging is available here:
                  Debugging your NinjaScript Code

                  Once you setup your print statements, you verify values through tools > output window.
                  Ryan M.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by junkone, Today, 11:37 AM
                  2 responses
                  14 views
                  0 likes
                  Last Post junkone
                  by junkone
                   
                  Started by frankthearm, Yesterday, 09:08 AM
                  12 responses
                  44 views
                  0 likes
                  Last Post NinjaTrader_Clayton  
                  Started by quantismo, 04-17-2024, 05:13 PM
                  5 responses
                  35 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by proptrade13, Today, 11:06 AM
                  1 response
                  7 views
                  0 likes
                  Last Post NinjaTrader_Clayton  
                  Started by love2code2trade, 04-17-2024, 01:45 PM
                  4 responses
                  35 views
                  0 likes
                  Last Post love2code2trade  
                  Working...
                  X