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

Strategy name disappeared

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

    Strategy name disappeared

    Hello

    I have been trying to make some very frequent changes in my script last night and at some point, the script name disappeared from the list of available strategies to apply to the chart, despite it being available in the Script Editor window.

    I've saved it with a different name, but I still can't see it in the list of available strategies to add to chart.

    As you see from attachment, I have in the following scripts in the editor: Divergence, Divergence5min, DivergenceArray, DivergenceList, DivergenceList5m, DivergenceSystem, but Divergence5min and DivergenceList5m are missing from the smaller window of scripts available to load on the chart.

    The script I modified a lot last night was DivergenceList5m, then after it vanished from the list of available strategies, I saved it as Divergence5min, but it is still missing.

    Restarting the platform did nothing to solve it.
    Attached Files
    Last edited by itrader46; 01-17-2020, 03:30 PM.

    #2
    Hello itrader46,

    Thank you for your note.

    First thing to do would be to check your log tab of the control center for any errors - do you see any errors being thrown by the missing indicators? If so, what is the text of the error(s)?

    The next thing to check would be the Name = "your strategy name"; line that should be at the top of State == State.Set Defaults in OnStateChange. Is this the same as the file name for each strategy? If not, modify it to be the same as the file name and recompile, then check the indicators list again.

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      The name is fine - that's the first thing I checked.

      The Log shows the error: " Stratey 'DivergenceList5m': Error on calling 'OnStateChange' method: owner " and same error on Divergence5min

      There are no compiling errors, though.

      Comment


        #4
        Hello itrader46,

        Thank you for your reply.

        This would indicate you have an issue somewhere in OnStateChange that isn't allowing the strategies to even load fully in the Strategies window. Could you provide the full code you have for OnStateChange()?

        Thanks in advance; I look forward to assisting you further.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Please see the attachment
          Attached Files

          Comment


            #6
            Hello itrader46,

            Thank you for your reply.

            Looks like there's a lot going on in your OnStateChange code.

            From the error message, we know the error has to do with "owner". In looking at your code, it looks like you're trying to use Draw.VerticalLine() in State==State.SetDefaults.

            SetDefaults is always called when displaying objects in a UI list such as the Indicators dialogue window since temporary objects are created for the purpose of UI display. When you're in State.SetDefaults, there's no owner available for the Draw.VerticalLine() so you get an error and the Strategy fails to appear in the list. Remove that Draw.VerticalLine and recompile, then try again to see if it's in the list for you.

            I'd recommend keeping SetDefaults as lean as possible - you really just want to be setting default values for the strategy in there.

            Here's a link to our help guide on OnStateChange() that has information on what you should be focusing on in each state:


            Please let us know if we may be of further assistance to you.
            Kate W.NinjaTrader Customer Service

            Comment


              #7
              Yes, I've got it in the meantime. I was trying to draw the line there out of despair, due to a bug in NT8 not allowing lines to be drawn on indicator panels generated by strategy script.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Stanfillirenfro, Yesterday, 09:19 AM
              7 responses
              51 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by TraderCro, 04-12-2024, 11:36 AM
              4 responses
              69 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Mindset, Yesterday, 02:04 AM
              1 response
              15 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by agclub, 04-21-2024, 08:57 PM
              4 responses
              18 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by Irukandji, Today, 04:58 AM
              0 responses
              6 views
              0 likes
              Last Post Irukandji  
              Working...
              X