Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 ETFVoyageur, 05-07-2024, 07:05 PM
                10 responses
                71 views
                0 likes
                Last Post ETFVoyageur  
                Started by Zeezee, Today, 12:45 PM
                3 responses
                14 views
                0 likes
                Last Post NinjaTrader_ChristopherJ  
                Started by ldanenberg, Today, 03:19 PM
                0 responses
                2 views
                0 likes
                Last Post ldanenberg  
                Started by TheTradingMantis, 01-19-2023, 02:05 AM
                42 responses
                914 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by _Zero_, 04-10-2020, 03:21 PM
                144 responses
                7,896 views
                6 likes
                Last Post NinjaTrader_ChelseaB  
                Working...
                X