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

Old version of code executed ????

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

    Old version of code executed ????

    This is an odd(to me) one.

    I'm trying to develop an indicator.

    I'm making changes to a Properties set{} and get{}, but the old versions of the set{} get{} are being executed.

    So the workflow is something like:
    Remove Indicator from chart
    Change a Properties get{} (For example I can "see" the issue via Print() in the get{}. I'm changing the Print() text in this step).
    Rebuild, no errors.
    Add the indicator back to the chart, but I can tell its not the version I just compiled because the Print() in the get{} is showing the old version
    of the output text.

    Any reports of this ? Any idea howto resolve ?

    thanks






    #2
    Hello michelm,

    Thanks for your post.

    Scripts will go through a life cycle where new instances are created and terminated as a script is added to a chart or reloaded. You can expect to see prints from older versions of the indicator as the old version gets terminated and a new instance gets created.

    Below is a demo I have created showing how we can expect to see prints shown in the Output window after making changes and reloading the script.

    Demo - https://drive.google.com/file/d/1qq3...w?usp=drivesdk

    NinjaScript lifecycle - https://ninjatrader.com/support/help...fecycle_of.htm

    We look forward to assisting.
    JimNinjaTrader Customer Service

    Comment


      #3
      Thank you for the video, that was excellent.

      I was about to make a video to show the issue to you because it was so weird, and honestly, if I were to put myself in your support shoes, I would just want to see it.

      So, yes, I'm aware of the lifecycle, it could have been something in that mix., Thank you for the references. Every time I read that I find something new to grok.

      It's just the issue was surviving multiple f5 reloads and then even ninjatrader app shutdowns - restarts. Before the restart, I figured the reloads were just some kind of NT stale object cache.

      I do have debugging enabled. It sort of seemed like there were two versions of the code in the mix.

      Anyway, I eventually removed the property completely from my code, removed the indicator from my charts. Shut down NT. Deleted the custom.dll and pdb files. I slowly started adding the property back in, and it's working as expected now, so lets just drop it.

      I hope I never see it again...Thank you.

      I don't know if the matters, but I was trying to use a nullable double as a property:
      public double? PriveLevelLine.....

      On the second go-around I just made it regular double.

      Just want to say again that I like the idea of responding with a video, I think in this case a video was way easier for me to understand what you were talking about and I hope it was a faster way for you to respond
      Last edited by michelm; 05-12-2020, 04:25 PM.

      Comment


        #4
        I found this at the bottom of the lifecycle page:

        "when NinjaScript is compiled in NinjaTrader a new DLL holding the compiled IL code is 'hot-loaded' into NinjaTrader..........any complex class will not resolve since the class will be residing in two different assemblies"

        Wonder if I was hitting some form of that situation.

        Comment


          #5
          Hello michelm,

          That note would be more in regards to complex class properties where Clone() and CopyTo would be used. For example, the PriceLevel property used in PriceLevels DrawingTool (for GannFan and TrendChannel DrawingTools.)

          We look forward to assisting.
          JimNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by sastrades, 05-10-2024, 09:59 AM
          3 responses
          54 views
          0 likes
          Last Post rc5781
          by rc5781
           
          Started by guyonabuffalo, Yesterday, 10:01 PM
          2 responses
          18 views
          0 likes
          Last Post guyonabuffalo  
          Started by thumper57, Yesterday, 04:30 PM
          5 responses
          15 views
          0 likes
          Last Post thumper57  
          Started by reynoldsn, 05-10-2024, 07:04 PM
          5 responses
          27 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by llanqui, Today, 11:10 AM
          1 response
          16 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Working...
          X