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 CarlTrading, 03-31-2026, 09:41 PM
                1 response
                68 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by CarlTrading, 04-01-2026, 02:41 AM
                0 responses
                36 views
                0 likes
                Last Post CarlTrading  
                Started by CaptainJack, 03-31-2026, 11:44 PM
                0 responses
                61 views
                1 like
                Last Post CaptainJack  
                Started by CarlTrading, 03-30-2026, 11:51 AM
                0 responses
                62 views
                0 likes
                Last Post CarlTrading  
                Started by CarlTrading, 03-30-2026, 11:48 AM
                0 responses
                53 views
                0 likes
                Last Post CarlTrading  
                Working...
                X