Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator within a Strategy

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

    Indicator within a Strategy

    Hello

    I developed a custom indicator and a custom strategy that, among other things, calls the indicator with the "Add" method. What's strange is that the indicator produces a certain output on a standalone basis, but a slightly different output when embedded in the strategy. Does anybody have an idea what could be the cause for the difference?

    Thanks

    #2
    laocoon,

    Please ensure your indicator does NOT have any CalculateOnBarClose line.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hi Josh

      Thanks for your fast reply. I was thinking along the same lines, but the CalculateOnBarClose function is set to false.

      Thanks

      Comment


        #4
        You need to completely remove the line. There is a known bug which causes problems when this line i present for an embedded indicator.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          I just removed it but when I compile the indicator the calculate on bar close function automatically reappears in the Ninja Script Generated Code.

          Comment


            #6
            Code inside the region that is marked "DO NOT CHANGE" should not be touched. You should simply not have any such line in Initialize() or OnBarUpdate().
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              OK, I did exactly what you told me but unfortunately the problem is still there.

              Thanks.

              Comment


                #8
                You need to actually be running a new instance of your strategy for these changes to take effect.

                Suggest you play with the very basic SMA indicator first to see how it works. Depending on how you program your indicator and what you are trying to access you may need to use Update() in your indicator to access the proper values.
                Josh P.NinjaTrader 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
                107 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