Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Lost Chart Context Menu

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

    Lost Chart Context Menu

    Somehow I no longer have a context menu for chart windows.

    The context menu works fine in other windows, and if I have a selected drawing in a chart window the drawing menu comes up. However, I get nothing if I right click within a chart window with nothing selected. This includes when the chart trader is enabled, so there is no way to enter trades with the context menu.

    The same happens with a clean workspace and a clean chart.

    I have both repaired NT and uninstalled/reinstalled NT and no change.

    Been this way for a couple of days, not sure what triggered it. There are no errors in the log.

    #2
    When you did a reinstall, did you rename and/or delete the Documents > NinjaTrader 8 folder? Or did you just uninstall without removing anything manually?

    Comment


      #3
      I left the folder in place

      Comment


        #4
        Please follow the steps listed below to completely uninstall and reinstall NinjaTrader (these steps can be reversed to restore all of your files and settings):
        • Close all running applications.
        • Uninstall NinjaTrader within Windows Control Panel.
        • Navigate to your Documents folder > Right click on the 'NinjaTrader 8' folder > Rename > rename the folder to 'NinjaTrader 8 OLD'. DO NOT delete this folder.
        • Navigate to C:\ > Program File (x86) > Delete the 'NinjaTrader 8' folder if it exists
        • Reboot your machine.
        • Once these steps are completed, download and install NT8 from the link below.
        • http://ninjatrader.com/PlatformDirect

        NinjaTrader will now be completely 'clean'. At this point:
        • Start NinjaTrader
        • Choose 'skip' when the connection screen appears
        • Choose 'no' if prompted to migrate items from NinjaTrader 7
        • Create your connection and connect
        • Create a chart and test for the behavior

        Please let me know the results.

        Comment


          #5
          Yes, works great in clean form (did anyone expect anything else).

          Anyway, playing the elimination game I found the offending code. It is a custom drawing tool. I thought I was doing something clever to work around a different NT deficiency, but it is obviously having a conflict.

          The problem is when you attempt to open the context menu, NT is creating dummy drawings for some reason (to get some info?). In the drawing state change to active is where my code is, and yes it will interfere with a context menu, so it needs to be blocked.

          Is there a way to know that this is a dummy drawing? I had checked IsUserDrawn, but this is true (which perhaps is bug since a dummy drawing is clearly not user drawn). I scanned thru the Drawing members in the debugger, but did not see anything in the Drawing that would give me a clue that this is a dummy drawing. Is there something else that would indicate that a context menu is currently opening and hence creating dummy drawings? Any ideas?

          This could be important in other ways as well, as creating a drawing may have a side affect which would need to be blocked.

          Comment


            #6
            Hello,

            Thank you for the post.

            Yes, this would be expected in this case, all NinjaScript types that offer some form of a menu or way to see them in the platform would be instantiated every time you try to view them. In this case, opening the chart context menu should instantiate every drawing tool to get their name.

            You could potentially get around this in State.Active by checking the AttachedTo property that it is not null. If the object is attached to a chart, it would not be null.
            This would work in cases of opening the context menu specifically. You would likely need to check each case where your logic is being executed to know it works as you expect still.


            Code:
            if(State == State.Active)
            {
            	Print(State + " " + (AttachedTo == null));	
            }
            On the first mouse down of drawing the object, the AttachedTo would be not null to know it is now drawn or at least is being drawn and is valid.

            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              I had thought of that, but AttachedTo is always null when the state changes to Active. I do not believe it gets set until later when the first mouse click happens.

              So, still looking for a way to distinguish a dummy drawing. I could not find anything in the drawing properties.Perhaps there is something else at a higher level?

              Comment


                #8
                Hello,

                I am not certain why the prior suggestion would not work here. I had noted what you said in my post as well:

                AttachedTo is always null when the state changes to Active. I do not believe it gets set until later when the first mouse click happens
                Correct, the AttachedTo is null when the object is not valid such as when you right click and open the context menu, the "dummy" is not attached to anything it was just created to get a name. Once you click down on the chart and an actual object is created, its AttachedTo is set and is no longer null. This would equate to not null in State.Active when the object is drawn because State.Active will be called again for the new object.

                Is there a case where this would not work for what you are trying to do? If so can you provide an example of why that would not work for the use case?

                I look forward to being of further assistance.
                JesseNinjaTrader Customer Service

                Comment


                  #9
                  I understand, but if you try your code, it is always "Active true", both when called before context menu, and when real drawing is created (State == Active before the first mouse click). That is the issue. If the drawing was properly attached to the chart when a real drawing is created, all would be great.
                  Last edited by aslane; 01-22-2018, 03:31 PM.

                  Comment


                    #10
                    Hello,

                    Thank you for the reply.

                    I believe I see where the disconnect is here, I had noted the MouseDown event would be the first event where you would be able to see this value not null:

                    On the first mouse down of drawing the object, the AttachedTo would be not null to know it is now drawn or at least is being drawn and is valid.
                    Otherwise, only after the object has been drawn would State.Active be a valid location to check if this is not null such as a chart refresh, I am sorry if this was not more clear in my reply. The AttachedTo will be null up until you left click down to actually draw this object, but its OnStateChange will be called before that to set the tool to Active. The solution provided would work specifically for checking for the Context menu as noted because its AttachedTo would be null.

                    If your expectation is to use State.Active for your logic, I would likely suggest to instead review the existing drawing tools as this state is not used for logic in any existing tool.

                    To better understand the problem, what logic are you trying to execute that needs to be executed in State.Active?

                    The solution would likely involve forming your tool more closely to the existing tools in how they build and create the objects they use. Very likely you would instead need to form your tool to create its objects during its initial drawing process but without knowing what you are trying to do specifically I couldn't really say what all would need to be modified. Can you detail what you need to execute from State.Active and why?

                    I look forward to being of further assistance.
                    JesseNinjaTrader Customer Service

                    Comment


                      #11
                      I am very familiar with how your tools work. Because they do not provide anything beyond basic function, I had to write my own drawing tool set. Thankfully, the new NT8 arch does allow this. It just happens to have a few rough edges, that would be nice to fix.

                      I am not going to disclose what I am doing, as I have figured out how to convince Ninja to do the right thing. It would be better if the arch allowed you to do the right thing, instead of patching around it.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by PhillT, Today, 02:16 PM
                      2 responses
                      6 views
                      0 likes
                      Last Post PhillT
                      by PhillT
                       
                      Started by Kaledus, Today, 01:29 PM
                      3 responses
                      10 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Started by frankthearm, Yesterday, 09:08 AM
                      14 responses
                      47 views
                      0 likes
                      Last Post NinjaTrader_Clayton  
                      Started by gentlebenthebear, Today, 01:30 AM
                      2 responses
                      14 views
                      0 likes
                      Last Post gentlebenthebear  
                      Started by PaulMohn, Today, 12:36 PM
                      2 responses
                      17 views
                      0 likes
                      Last Post PaulMohn  
                      Working...
                      X