Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawingTools w/PriceLevels Issue

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

    DrawingTools w/PriceLevels Issue

    Effects all fibs, trendlines, pitchforks, any DrawingTool that utilizes PriceLevels, and can be duplicated in 8.11.1 and 8.12.0

    1.) Manually Draw a FibonacciRetracements on any Chart Tab
    2.) Modify Price Levels to Something Completely Different than default
    3.) Now Apply those changes, and Save them as the Default Template..
    4.) Open NS editor and compile anything
    5.) Reload NinjaScript on Chart Tab with Manual DrawObect
    6.) Move Original FibonacciRetracements

    All PriceLevel's Lost..

    Video Demonstration can be found here...

    Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.



    -=Edge=-
    NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

    #2
    Hello -=Edge=-,

    Thank you for the report!

    I have been able to reproduce and will write back with more information as it becomes available.

    Thanks again for bringing this to our attention.
    JimNinjaTrader Customer Service

    Comment


      #3
      Since we are talking about pricelevels here.. I have couple more questions??

      Not sure it should matter, but all my testing was done not connected to data...

      1.) Open OutPut Window
      2.) Open New Chart
      3.) Draw FibonacciRetracement
      4.) Apply the test indy attatched below

      It should work fine, and you'll see 3 print statements in output window..

      1.) Now Reload NinjaScript

      Why is DrawObjects.Count always 0 on any subsequent NinjaScript Reload???


      1.) Now remove all drawobjects
      2.) Remove the indy...
      3.) Draw another FibonacciRetracement
      4.) Apply the test indy again

      Works fine on initial apply, but never seeing any drawobjects on ninjascript reload????


      1.) Now Compile indy to dll assembly and repeat above steps..

      I've tried numerous ways of declaring dynamics and such, but I can't seem to make this work in compiled assembly???



      Attached Files
      -=Edge=-
      NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

      Comment


        #4
        Hello -=Edge=-,

        Thanks for your patience.

        The issue boils down to the NinjaScript being cloned upon recompile and the class level properties not being copied over to the new instance. This is more of an issue with the NinjaScript not handling this with the Clone() override. There would not be an ideal solution for the Development team to handle this internally for all NinjaScripts.

        Since the issue has to do with the NinjaScript and not the platform, the task falls on our NinjaScript team and won't be marked with a ticket ID to feature request the additional functionality. We will take on this task as resources allow.

        This particular matter can be understood more in the LifeCycle page of the help guide.

        Note: If you plan to utilize complex class properties on NinjaScript, you can specify your own clone method. However when NinjaScript is compiled in NinjaTrader a new DLL holding the compiled IL code is 'hot-loaded' into NinjaTrader. As a user or developer would try to reload NinjaScript or configure an existing NinjaScript object, any complex class will not resolve since the class will be residing in two different assemblies. This problem cannot be solved with custom clone method and workarounds for this are setting Browsable(false) attribute on that property so it is not cloned or putting the property it its own dedicated assembly.
        NinjaScript LifeCycle - https://ninjatrader.com/support/help...fecycle_of.htm

        Clone() - https://ninjatrader.com/support/help...n-us/clone.htm

        If there is anything else I can do to assist, please let me know.
        JimNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Jim View Post
          The issue boils down to...
          OK.. I've worked with drawobjects quite a bit and guess I'm a bit confused here...



          which issue, of the 3 total, are you referring too?


          I have one issue in post #1
          1.) Lost Price Levels

          and we will call it two and three in post #3...
          2.) DrawObjects.Count = 0 on ninjascript reload
          3.) add pricelevel to drawingtool in dll assembly



          -=Edge=-
          NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

          Comment


            #6
            Hello -=Edge=-,

            I had missed the last part of your reply, sorry about that. It looks like item 3 is an issue with writing to dynamic types. I don't have a problem reading from the dynamic type but I have not been able to successfully write to the dynamic type. I'm still working on this and I will get back to you.

            Items 1 and 2 boil down to the same matter where the values are not guaranteed after recompile.

            We have KB'd the matter for the DrawObjects collection:
            When pressing F5 indicator and strategies are created again before the draw objects -> the DrawObjects collection does no longer hold the old instances, but neither does it hold the new instances yet.

            This is an expected behavior currently.
            I'll reach back again on item 3.
            JimNinjaTrader Customer Service

            Comment


              #7
              Hello Edge,

              Reaching to Michael on our QA team, he provided a solution using System.Reflection:

              Code:
              if(dt.ToString().Equals("NinjaTrader.NinjaScript.DrawingTools.FibonacciRetracements"))
              {
              	Print("Found Fib");
              	Print(dt.PriceLevels.Count);
              	
              	Type type 			= dt.PriceLevels.GetType().GetGenericArguments()[0];
              	Assembly assembly 	= type.Assembly;
              	var pl 				= assembly.CreateInstance(type.FullName, false, BindingFlags.CreateInstance, null, new object[] { 55.5, Brushes.Red, 2 }, new System.Globalization.CultureInfo("en-US"), new object[] {});
              	dt.PriceLevels.GetType().GetMethod("Add").Invoke(dt.PriceLevels, new object[] { pl } );
              	
              	Print(dt.PriceLevels.Count);
              	plSet = true;
              	Print("All Good");
              	this.ForceRefresh();
              }
              I've requested that we include information to suggest using System.Reflection for these cases in the Considerations For Compiled Assemblies page of the help guide.

              Please let us know if we can be of further assistance.
              Last edited by NinjaTrader_Jim; 02-16-2018, 04:06 PM.
              JimNinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_Jim View Post
                Please let us know if we can be of further assistance.
                Thank You Jim!!!.. Works just fine.. Yes, you can do one more thing for me..

                An Easy to Implement, No Brainer, Request...

                In the DrawingTools PriceLevels.cs file, add this constructor just under line 131 in next release!
                Code:
                 
                public PriceLevel(double value, Brush brush, DashStyleHelper dashStyle, float strokeWidth, int opacity)
                {
                     ValueFormatFunc = v => (v / 100).ToString("P", Core.Globals.GeneralOptions.CurrentCulture);
                     Value = value;
                     IsVisible = true;
                     Stroke = new Stroke(brush, dashStyle, strokeWidth, opacity);
                     IsValueVisible = true;
                }
                This will provide the easiest solution to control each pricelevel's DashStyle and Opacity as well...


                Thanks Again!!


                -=Edge=-
                NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

                Comment


                  #9
                  Hello Edge,

                  I've submitted your request and will update this thread with a ticket ID when available.

                  Ticket ID: SFT-3050

                  I also wanted to note that discussions with Product Management are leaning against supporting using Reflection and there may be a better solution advised to avoiding using "new" with dynamic types and compiled assemblies at a later point.

                  We hope you are enjoying your holiday!
                  Last edited by NinjaTrader_Jim; 02-20-2018, 03:24 PM.
                  JimNinjaTrader Customer Service

                  Comment


                    #10
                    I'm also getting this error: NinjaTrader.NinjaScript.DrawingTools.PriceLevel" is not of type "NinjaTrader.NinjaScript.DrawingTools.PriceLev el", but I haven't quite figured out how to apply the solution outlined above. Is there a fix? on one of my machines it works just fine. just the 2nd computer where I did a complete re-install recently is acting up and giving me this issue

                    Comment


                      #11
                      Hello abctrader,

                      Thank you for your post.

                      Please note that the issue described in this thread is specific for NinjaScript developers, could you confirm the following?
                      • Is this message occurring with using custom scripts or without any custom scripts?
                      • If with a custom script, was this developed by you or a 3rd party developer?
                      You may test without custom scripts by using Safe Mode.

                      Safe Mode will prevent NinjaTrader from:
                      • Loading workspaces.
                      • Connecting on start-up.
                      • Loading custom assemblies.
                      • Getting instrument updates from the server.

                      To enable safe mode, please use the following steps:
                      • Exit NinjaTrader.
                      • Hold the CONTROL key and double click the NinjaTrader icon.
                      • Keep the CONTROL key held down until you see the Control Center.
                      • You can verify you are in safe mode by going to Help -> About.
                      Once in Safe Mode please connect, and then close your workspace under the Control Center > Workspaces > hover your mouse over your workspace and select 'close'. Do Not Save

                      Then please reopen your workspace to populate your windows without any custom add-ons.

                      Are you able to replicate this message?
                      Spencer F.NinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_Spencer View Post
                        Hello abctrader,

                        Thank you for your post.

                        Please note that the issue described in this thread is specific for NinjaScript developers, could you confirm the following?
                        • Is this message occurring with using custom scripts or without any custom scripts?
                        • If with a custom script, was this developed by you or a 3rd party developer?
                        You may test without custom scripts by using Safe Mode.

                        Safe Mode will prevent NinjaTrader from:
                        • Loading workspaces.
                        • Connecting on start-up.
                        • Loading custom assemblies.
                        • Getting instrument updates from the server.

                        To enable safe mode, please use the following steps:
                        • Exit NinjaTrader.
                        • Hold the CONTROL key and double click the NinjaTrader icon.
                        • Keep the CONTROL key held down until you see the Control Center.
                        • You can verify you are in safe mode by going to Help -> About.
                        Once in Safe Mode please connect, and then close your workspace under the Control Center > Workspaces > hover your mouse over your workspace and select 'close'. Do Not Save

                        Then please reopen your workspace to populate your windows without any custom add-ons.

                        Are you able to replicate this message?
                        Happens on a blank chart without any indicators on it ...

                        Comment


                          #13
                          Hello abctrader,

                          Please send me your log and trace files so that I may investigate further.

                          You can do this by going to the Control Center-> Help-> Email Support

                          Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.

                          Please reference the following ticket number in the body of the email: 3363128 ATTN Spencer F.
                          Spencer F.NinjaTrader Customer Service

                          Comment


                            #14
                            I am receiving the same error: NinjaTrader.NinjaScript.DrawingTools.PriceLevel" is not of type "NinjaTrader.NinjaScript.DrawingTools.PriceLev el"
                            when I try to modify a manual drawing. Eg: a line, channel.

                            In the same chart I do have a script running that draw lines in this chart.

                            Thanks for any help.

                            Comment


                              #15
                              Hello Danilod,

                              Thank you for your post.

                              Please note that the issue described in this thread is specific for NinjaScript developers, could you confirm the following?
                              • If with a custom script, was this developed by you or a 3rd party developer?
                              • Does the same occur after reinstalling NinjaTrader?
                              I have included instructions on how to reinstall the NinjaTrader platform below. With this procedure you will not lose any Workspaces, Charts, custom items etc. You'll need a license key for this procedure, which I've included below. These steps wont affect your current license key (if different):
                              • @SIM-A82F-D583-40B1-AE74-B79F-705D-1952
                              Please follow these steps:
                              • Close all running applications.
                              • Make sure NinjaTrader is closed from the Windows Task Manager:
                              • Press CTRL + ALT + DEL on your keyboard > Start Task Manager...
                              • Then from the Start menu select --> Control Panel --> Add and Remove Programs or Programs and Features
                              • From Add and Remove Programs select NinjaTrader 8 and click Remove.
                              • Restart your PC.
                              • After NinjaTrader is uninstalled, navigate to the following folders and delete any "NinjaTrader 8" folders located here if any: C:\Program Files (x86)\
                              • or
                              • C:\Program Files\
                              • Once these steps are completed, download and install NinjaTrader from the link below:
                              • https://ninjatrader.com/PlatformDirect (* This is where you will need to input your license key to download)
                              Spencer F.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by alifarahani, Today, 09:40 AM
                              2 responses
                              12 views
                              0 likes
                              Last Post alifarahani  
                              Started by junkone, Today, 11:37 AM
                              3 responses
                              15 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by pickmyonlineclass, Today, 12:23 PM
                              0 responses
                              1 view
                              0 likes
                              Last Post pickmyonlineclass  
                              Started by frankthearm, Yesterday, 09:08 AM
                              12 responses
                              44 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by quantismo, 04-17-2024, 05:13 PM
                              5 responses
                              35 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Working...
                              X