Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator FirstTickOfBar behaves different in Strategy

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

    Indicator FirstTickOfBar behaves different in Strategy

    Hello,

    This is on Replay data:

    I have an indicator that uses FirstTickOfBar and is producing the correct results when run stand alone as an indicator.

    When the indicator is linked into a Strategy and called from the strategy, the results are not correct. At times the FirstTickOfBar is testing true in the indicator when it should not be (i.e. intra bar).

    Both the indicator and strategy are set CalculateOnBarClose = false;

    One strange thing I noticed also, is that the Strategy CurrentBar is sometimes one behind the Indicator CurrentBar.

    Please advise.

    Thank you.

    #2
    more information

    also the Indicator CurrentBar is incrementing when it should not.

    Comment


      #3
      Please remove any CalculateOnBarClose reference in the called indicator(s) and then retry only setting this from the calling strategy.

      Comment


        #4
        Originally posted by NinjaTrader_Bertrand View Post
        Please remove any CalculateOnBarClose reference in the called indicator(s) and then retry only setting this from the calling strategy.
        Are you trying to isolate or is that the fix?, that sound a little like the Iphone issue.

        Comment


          #5
          reply

          Hi Bertrand,

          OK, I'll do that....however, I also want to run the indicator stand alone and will need the CalculateOnBarClose = false.

          Is there a way in Initialize() I can tell if the Indicator is being loaded stand alone or with the strategy?

          Then I could execute CalculateOnBarClose = false only when it was stand alone.

          Thanks

          Comment


            #6
            reply

            OK, I tried that...now the Indictor CurrentBar is not incrementing incorrectly like before...so that part seems to be better.

            However the FirstTickOfBar in the indicator is not functioning correctly. This is critical logic to the functioning of the strategy.

            (still have the issue below of running the indicator stand alone)

            Please advise,

            Thanks

            Comment


              #7
              If you remove the hardcoded CalculateOnBarClose references, you would still have the option to toggle this from the GUI if you're using the indicator standalone, there's a known issue with calling indicators that have hardcoded CalculateOnBarClose refereneces, hence my suggestion to remove and recheck.

              For the FirstTickOfBar issue - which NT version are you running this test on? I know there was a bug in a earlier NT 7 beta release, so please ensure if you're testing the beta, this is on the latest B18.

              Comment


                #8
                reply

                I'm running in 6.5 until 7 is ready for production.

                Looks like the default for CalculateOnBarClose , if it is not coded, is "false", and that it can be changed in the Indicator Parameters dialog in the General section. Thanks.

                Thanks

                Comment


                  #9
                  That's correct - could please provide a snippet of what you're doing so I can reproduce and check into here?

                  Thanks

                  Comment


                    #10
                    reply

                    before I go further with the snippet....I was studying the code in Ninja's default SWING indicator...and noticed something interesting....here is how it is coded to sense when a new bar is encountered...it does not use FirstTickOfBar

                    protected override void OnBarUpdate()
                    {
                    if (saveCurrentBar != CurrentBar)

                    body of code here


                    Is it possible that FirstTickOfBar is not intended to be used in an indicator that is linked to a strategy?

                    Thanks

                    Comment


                      #11
                      Turtle, I'm sure the developers didn't mean for there to be issues, but that work around you've found could definitely work.

                      If you post that code sample, we'll take a look and see what is going on.
                      AustinNinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

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