Go Back   NinjaTrader Support Forum > NinjaTrader 8 > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

NinjaTrader
Reply
 
Thread Tools Display Modes
Old 07-10-2017, 09:57 AM   #1
soulfx
Senior Member
 
Join Date: Mar 2011
Posts: 340
Thanks: 39
Thanked 28 times in 27 posts
Default Close Multiple tabs option

Hello, i have a question about the

The Tools options - Confirm on window or tab close

As part of an indicator i have a window which i use for some settings etc and the class is derived from NTWindow.

When the above tools option is enable obviously it asks the following

You are about to close multiple open tabs - are you sure you want to continue

YES NO

Depending on user actions in the Dialog window eg OK APPLY CLOSE ... various actions are taken.

If the user says YES to above all is fine ..

If they select NO to the 'close multiple open tabs' - i would like to be able to handle this and reset some values and do some reference checking.

Is there a way for this indicator window derived from NTWindow to be able to override this global setting - as i would prefer this pop up window can be disabled for this indicator created window?

Or is the setting global and will apply to all windows and tabs in the Ninja session?

If i cannot overrider it can i handle when NO is selected?

thanks
soulfx is offline  
Reply With Quote
Old 07-10-2017, 10:46 AM   #2
NinjaTrader_Jim
NinjaTrader Customer Service
 
NinjaTrader_Jim's Avatar
 
Join Date: Nov 2016
Location: Denver, CO
Posts: 1,002
Thanks: 60
Thanked 237 times in 229 posts
Default

Hello soulfx,

Thanks for opening the thread.

I do not see an easy way you could override the No button in this message box to allow for the behavior you are looking for.

I have submitted a feature request on your behalf asking that the Close Multiple Tabs message box can attach a handler to the Yes/No buttons.

The Close Multiple Tabs option is also a global setting that gets applied to all NinjaTrader windows. I will submit another feature request asking for this behavior to be controlled from a property for NTWindows.

I will update this post with the ticket ID's for these feature requests. These can be noted in the Release Notes page of the version of NinjaTrader that includes the implementation. Keep in mind, feature requests are up to the development team and their priorities to consider implementing.

Both are being tracked with the ID SFT-2514.

Release Notes: https://ninjatrader.com/support/help...ease_notes.htm

Please let me know if I may be of further assistance.
Last edited by NinjaTrader_Jim; 07-11-2017 at 11:54 AM.
NinjaTrader_Jim is online now  
Reply With Quote
Old 07-10-2017, 03:50 PM   #3
soulfx
Senior Member
 
Join Date: Mar 2011
Posts: 340
Thanks: 39
Thanked 28 times in 27 posts
Default

Hello, thanks for the reply and submitting both these feature requests.

So to confirm - there is nothing i can do when this window pops up and i say NO.

Im trying to establish where control is returned to and what object references i need to reset when this dialog box comes up. It launches or shows a dialogue box/window - even if i dont have the ability to attach a handler to the No button at this time is there anything i can rely upon?

Or is it currently that i cannot rely on any context variables or references when No is selected and i remain in my own NTWindow - currently it is triggering object reference errors when NO is selected - given this dialog box is out of my control some guidance on how to workaround this whilst these features may or may not be implemented would be useful
thanks
soulfx is offline  
Reply With Quote
Old 07-11-2017, 09:10 AM   #4
NinjaTrader_Jim
NinjaTrader Customer Service
 
NinjaTrader_Jim's Avatar
 
Join Date: Nov 2016
Location: Denver, CO
Posts: 1,002
Thanks: 60
Thanked 237 times in 229 posts
Default

Hello soulfx,

Thanks for your reply.

The message box created does not appear to be specific to each window or AddOn. I don't think overriding it to perform a certain operation would be able to perform something in the context of the window that called it. Also, as this is not documented, I am not able provide any direction for using it.

That said, you might be able to come up with a solution using OnWindowDestroyed(). You can observe with a print in the NinjaScript output window that OnWindowDestroyed() will get called once before the dialog comes up after you click the close button and before you click yes on the dialog box. You could use that instance to drive logic if the AddOn window has not been destroyed, then you can perform your desired operations.

http://ninjatrader.com/support/helpG...wdestroyed.htm

Please let me know if I can be of further help.
Last edited by NinjaTrader_Jim; 07-11-2017 at 09:12 AM.
NinjaTrader_Jim is online now  
Reply With Quote
Old 07-13-2017, 11:24 AM   #5
soulfx
Senior Member
 
Join Date: Mar 2011
Posts: 340
Thanks: 39
Thanked 28 times in 27 posts
Default

Hello, i am looking into the OnWindowDestroyed() to see if i can work with this in anyway in the interim.

do you have a tracking ID for these feature requests? I noted someone asked if there was a way to access a list of requests and IDs and votes - it was replied there was not and each person would need to ask via the forum for an update. I alone with various requests and 'bugs' over time have about 20+ alleged feature requests and already i have lost track. There must be a better way to maintain this so customers can enquire as to status - with the emphasis on it is up to development to decide we have no way of knowing the vote count or status ; if similar requests have been made i presume ninjatrader tries to update or merge into a similar request if it functionally makes sense?
Whilst this may be viewed as an internal ninjatrader prerogative - as i said i'm sure people have lost track of their 'feature requests' / given up that they will ever be implemented etc or just dont know and drop their development if no creative alternative solution can be found. So some transparency on this i believe would be appreciated all round.
thoughts?
thanks
Last edited by soulfx; 07-13-2017 at 11:31 AM.
soulfx is offline  
Reply With Quote
Old 07-13-2017, 01:22 PM   #6
NinjaTrader_Jim
NinjaTrader Customer Service
 
NinjaTrader_Jim's Avatar
 
Join Date: Nov 2016
Location: Denver, CO
Posts: 1,002
Thanks: 60
Thanked 237 times in 229 posts
Default

Hello soulfx,

As the feature requests were related they were assigned with the single ticket ID SFT-2514.

While I agree it would be a great idea to group lists of feature requests for our clients, we currently do not have a simple means to aggregate information for any specific client. So we are left with informing our clients of the assigned ticket ID's.

I will submit your feedback to request a database for client feature requests.

Your input is being tracked in our feature tracking system with the ticket ID SFT-2530.

If there is anything else I can do to assist, please let me know.
Last edited by NinjaTrader_Jim; 07-13-2017 at 04:42 PM.
NinjaTrader_Jim is online now  
Reply With Quote
Old 07-14-2017, 07:38 AM   #7
soulfx
Senior Member
 
Join Date: Mar 2011
Posts: 340
Thanks: 39
Thanked 28 times in 27 posts
Default

Hello, thanks for reply.

In looking at your suggestion of using the OnWindowDestroyed() i am familiar with this in the addon package environment and already use this in a separate unrelated piece.

The context of where this applies is in a window derived from NTWindow and used within an indicator NOT an addon. I dont see OnWindowDestroyed being available as an override in this situation.

Additionally - for example the properties of a context menu for a drawing tool does not prompt for confirmation of closing window - and this is with the global setting still set to true. So there are working examples of this being managed already? Can you point to that area of offer some guidance on how that is handled as the same approach would likely apply with what i am trying to achieve
thanks
soulfx is offline  
Reply With Quote
Old 07-14-2017, 12:11 PM   #8
NinjaTrader_Jim
NinjaTrader Customer Service
 
NinjaTrader_Jim's Avatar
 
Join Date: Nov 2016
Location: Denver, CO
Posts: 1,002
Thanks: 60
Thanked 237 times in 229 posts
Default

Hello soulfx,

Yes, the OnWindowDestroyed() override will have to be added to a an AddOn outside of the indicator. You can observe the method gets called for every window close by creating a new blank AddOn with a Print() added to the OnWindowDestroyed() override. This includes the Drawing object and Indicator dialog windows that do not alert the user with a message box.

After thinking about this further, I don't think it would be possible to work around this by creating a condition in an AddOn that checks if a window still exists after OnWindowDestroyed() occurs. The issue I see is that closing a similar message box from another part of the platform when the window is open would create the same event that we would read as "OnWindowDestroyed() occurred, window still exists; User clicked No."

As for the drawing properties window not creating a prompt, you might be onto something that is handled like that internally. Unfortunately, I would not be able to provide further direction for usage on anything internal and undocumented. That said, I will add a note to the Feature Request ticket asking if this internal logic is something that could be used externally in the future.

I look forward to being of further assistance.
NinjaTrader_Jim is online now  
Reply With Quote
Old 07-17-2017, 11:03 AM   #9
soulfx
Senior Member
 
Join Date: Mar 2011
Posts: 340
Thanks: 39
Thanked 28 times in 27 posts
Default

Hello Jim, as per my last note this is NOT an addON situation but a window opened via an indicator button ; derived from NTWindow - so lets forget the OnWindowDestroyed aspect here.

I am trying to find a work around here ... and am now making additional null reference checks.

The _window handle which points to the NTWindow where i am displaying information - gets lost if the No is selected on the prompt - so even if i test for null where i cannot even close the window.

So in testing this further as i indicated if the global setting is to false/disabled i dont get these popups. If i leave this to true i get the pop up and it leaves the window in no mans land with no easy means to clean up and this propagates issues on closedown and workspace issues.

I am working to devise a better clean UX for other users of what i am working on. On this point i would like to clarify your submitting this as a 'feature request' when it is actually a bug and a shortcoming in the design/architecture? Can you clarify this?

You can easily reproduce this is you need to to then submit to development. Some of chelseas button examples of past could create and open an NTWindow with a button to close the window and see what happens.

thanks
soulfx is offline  
Reply With Quote
Old 07-17-2017, 02:08 PM   #10
NinjaTrader_Jim
NinjaTrader Customer Service
 
NinjaTrader_Jim's Avatar
 
Join Date: Nov 2016
Location: Denver, CO
Posts: 1,002
Thanks: 60
Thanked 237 times in 229 posts
Default

Hi soulfx,

I understand you are creating a window from an indicator and not an AddOn. OnWindowDestroyed() within any AddOn will get called for any NinjaTrader window aside from the dialog windows as you have pointed out. Regardless, my previous idea for a work around is not valid. So yes, let's leave OnWindowDestroyed() behind.

A feature request was submitted for a way to have a window ignore the message box that appears when you close the window (with Confirm on window or tab close enabled.) As the issue is coming from an external NinjaScript outside of the platform, we cannot yet blame the platform for an issue without being certain the implementation is valid.

I tested one of Chelsea's examples for creating a window from a button within a strategy, and I don't encounter any issue when I click Yes or No to the confirmation message box when I close the window.

Here is the script I tested: http://ninjatrader.com/support/forum...86&postcount=2

If you can recreate the issue in this context, let us know. I'd be happy to look it over further to see if we could improve it, or report an internal issue to the development team.
NinjaTrader_Jim is online now  
Reply With Quote
Old 07-18-2017, 08:27 AM   #11
soulfx
Senior Member
 
Join Date: Mar 2011
Posts: 340
Thanks: 39
Thanked 28 times in 27 posts
Default

Hello, i appreciate exploring this further to be clearer on the potential issues here and not yet 'blaming' the platform. Whilst this is a simplistic example in a strategy that does nothing i am contrasting to my code. When the button on menu is pressed it opens a window with two buttons below the information which updates a database with Apply and Close. I disable the NTWindow close X at the top right (so i dont use this .. i did try it and it - not sure what this X close does as i have no control/idea where it goes in termis of cleanup ) and handle the close button with a command delegate. Now this works fine - until the No option is selected in the popup.

A question on this for the Tool preferences global setting of enable 'confirm on window or tab close' is there a global variable i can access in my indicator as to the setting of this ? ie true or false - that way perhaps i can use that to prepare is No is selected.

The close command associated with my button sets the NTwindow reference to null for this viewmodel and when the control returns after the No and i subsequently try to press the close button - i now capture the fact that window reference in this context is null and so how to close - am looking at storing the window reference elsewhere as a workaround but not liking how i might have to do that.

Continuing to look at this and explore this. the binding command in my xaml is correctly binding to the commands i have in place.

If you have information on accessing a value for the global setting this would be useful to know in the interim

thanks
soulfx is offline  
Reply With Quote
Old 07-18-2017, 10:15 AM   #12
NinjaTrader_Jim
NinjaTrader Customer Service
 
NinjaTrader_Jim's Avatar
 
Join Date: Nov 2016
Location: Denver, CO
Posts: 1,002
Thanks: 60
Thanked 237 times in 229 posts
Default

Hi soulfx,

It looks like you could use Core.Globals.GeneralOptions.ConfirmWindowClose to reference if this option is enabled or disabled.

If you have any other questions for me or what we can offer through support, please don't hesitate to ask.
NinjaTrader_Jim is online now  
Reply With Quote
Old 07-18-2017, 03:28 PM   #13
soulfx
Senior Member
 
Join Date: Mar 2011
Posts: 340
Thanks: 39
Thanked 28 times in 27 posts
Default

Hello, my idea of using the value of this global to work around this somehow has worked in that i can now 'manage' this .. however i stress this is a workaround and not an ideal coding situation and the feature/fix request below still is very necessary. So for now i can manage/contain this and testing so far looks promising.

Jim wrote ...

A feature request was submitted for a way to have a window ignore the message box that appears when you close the window (with Confirm on window or tab close enabled.)
soulfx is offline  
Reply With Quote
The following user says thank you to soulfx for this post:
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Chart Tabs Issue Segwin Version 8 Beta 12 09-26-2016 12:02 PM
Toolbar Button in multiple tabs rt-trader Version 8 Beta 4 12-10-2015 09:34 PM
Problem with multiple close signals dmitry75 Strategy Development 7 08-07-2013 09:53 AM
How to load multiple stock and option prices chris8sirhc Platform Technical Support 4 10-26-2012 08:39 AM
Possible to configure multiple charts with tabs? known Platform Technical Support 3 11-24-2011 01:10 PM


All times are GMT -6. The time now is 01:15 PM.

Futures, foreign currency and options trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. View Full Risk Disclosure.

CFTC Rules 4.41 - Hypothetical or Simulated performance results have certain limitations, unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.

This website is hosted and operated by NinjaTrader, LLC (“NT”), a software development company which owns and supports all proprietary technology relating to and including the NinjaTrader trading platform. NT is an affiliated company to NinjaTrader Brokerage (“NTB”), which is a NFA registered introducing broker (NFA #0339976) providing brokerage services to traders of futures and foreign exchange products. This website is intended for educational and informational purposes only and should not be viewed as a solicitation or recommendation of any product, service or trading strategy. No offer or solicitation to buy or sell securities, securities derivative or futures products of any kind, or any type of trading or investment advice, recommendation or strategy, is made, given, or in any manner endorsed by any NT affiliate and the information made available on this Web site is not an offer or solicitation of any kind. Specific questions related to a brokerage account should be sent to your broker directly. The content and opinions expressed on this website are those of the authors and do not necessarily reflect the official policy or position of NT or any of its affiliates. 

Vendors along with their websites, products and services, collectively referred to as (“Vendor Content”), are independent persons or companies that are in no manner affiliated with NT or any if its affiliates. NT or any of its affiliates are not responsible for, do not approve, recommend or endorse any Vendor Content referenced on this website and it’s your sole responsibility to evaluate Vendor Content. Please be aware that any performance information provided by a vendor should be considered hypothetical and must contain the disclosures required by NFA Rule 2-29(c). If you are interested in learning more about, or investigating the quality of, any such Vendor Content you must contact the vendor, provider or seller of such Vendor Content. No person employed by, or associated with, NT or any of its affiliates is authorized to provide any information about any such Vendor Content.