• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IsSuspendedWhileInactive for Drawing Tools?

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

    IsSuspendedWhileInactive for Drawing Tools?

    I understand that indicators have a IsSuspendedWhileInactive flag, which seems to be working as intended.

    However, I have some custom drawing tools that output some alerts, but don't if the chart is on a hidden tab (inactive). Is there a similar flag for drawing tools to achieve the same result? (I'm not seeing "IsSuspendedWhileInactive" as available for drawing tools)

    Thank you!

    #2
    Hello neoikon,

    Thank you for your note.

    To my knowledge there is no IsSuspendedWhileInactive property for drawing tools. I have submitted a feature request on your behalf to add this property to our development. It is up to our development to decide if and when a request will be implemented.

    Thank you for pointing this out and for your feedback. Once I have a tracking ID for your request I will post in this thread for future reference.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Are these alerts setup by right click > Alert or some 'Alert' code you've written into the drawing tool?

      If its 'Alert' code in the drawing tool what method is this Alert code running in?
      BrettNinjaTrader Product Management

      Comment


        #4
        Originally posted by NinjaTrader_Brett View Post
        Are these alerts setup by right click > Alert or some 'Alert' code you've written into the drawing tool?

        If its 'Alert' code in the drawing tool what method is this Alert code running in?

        Brett,

        It's a custom drawing tool where the alert is being fired from my code (not utilizing right-click > Alert).

        The logic is calling NinjaTrader.NinjaScript.Alert.AlertCallback() from within OnRender(), which I can see could be an issue if it's not being "rendered" on a hidden tab.

        Is my solution to move my logic to OnBarUpdate()?
        Last edited by neoikon; 11-03-2016, 06:41 AM.

        Comment


          #5
          Hello neoikon,

          The OnRender does not trigger when it is not visible and is not being rendered.

          Also, there is not an OnBarUpdate for drawing tools.

          If you were to create a timer, and trigger alerts from the timer, are you finding the alerts do not trigger?
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            I'm not sure how a Timer is relevant, perhaps you can expand?

            Perhaps, you're suggesting just run my logic every second, no matter what. Perhaps that could work, but sounds like a hack.

            I would want to know if the current chart has focus in order to NOT use this method and instead rely on OnRender. Ugh, again, feel so much like a messy hack.

            My alert logic is centered around actual price data. Is there a way to trigger an event on incoming price data (price change)?

            EDIT: I'm looking into this documentation on TriggerCustomEvent(), but does it not exist for Drawing Tools?
            http://ninjatrader.com/support/helpG...ustomevent.htm
            Last edited by neoikon; 11-03-2016, 08:21 AM.

            Comment


              #7
              Hello neoikon,

              What you may be trying to achieve may be better suited for an indicator.

              Drawing tools are visual, they don't update on each bar, they update if the chart is being rendered.

              If you are wanting regular alerts when new data comes in, this is not what drawing tools are designed for. However, this would make sense as an indicator (which could loop through the manually drawn objects on your chart) and trigger alerts giving you price information at regular intervals.

              In a drawing tool, if you want to demonstrate that these do not run unless the chart is active, you would likely need to use a timer to trigger actions as there are no methods native to drawing tools that trigger unless the chart is rendering or the mouse is clicked, etc.

              A timer can trigger a method at regular intervals. Since nothing in a drawing tool is triggered when the chart is not being rendered, the timer can cause the method to be triggered and you could put your print or alert in this method.
              Last edited by NinjaTrader_ChelseaB; 11-03-2016, 09:04 AM.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Okay, I will look into the Timer method. However, I think I may have to scrap the whole idea...

                Thank you, but this best suited as a drawing tool. Since NT has an Alert section (right-click, Alerts...) that can trigger based on various objects, means that it's understood that certain situations warrants alerts based on drawing objects. My goal is for it to be done automatically, within the custom drawing tool, based on my logic. But, my problem is they don't fire if the chart is hidden.

                Comment


                  #9
                  Hello neoikon,

                  My understanding here may not be complete.

                  Are you trying to trigger an alert from a drawing tool? (as in from the code within the drawing tool such as from a timer)

                  Or are you trying to trigger an alert from a chart (or market analyzer), using a drawing tool's price in the condition?

                  Also, an indicator is able to get the price of a drawing object. I'm not quite understanding why the alert would have to be triggered from within the drawing tool. The indicator could detect when a price is crossing the drawing object similar to how the LineAlert indicator works in NT7 (or from any other criteria).
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by NinjaTrader_ChelseaB View Post
                    Are you trying to trigger an alert from a drawing tool? (as in from the code within the drawing tool such as from a timer)
                    I feel like I keep repeating myself and this isn't going anywhere.

                    Bottom line, I hope that the IsSuspendedWhileInactive flag will be added to custom Drawing Tools in the future (or some similar event as OnBarUpdate()).

                    Comment


                      #11
                      Hello neoikon,

                      For there to be a change, we'll need to submit a feature request.

                      I've attempted to do this, but our development is uncertain how to add this request as there are no methods that trigger in a drawing object when the chart is not being rendered.

                      Once we have a use case for this, our development will enter this into our feature request tracking system and I will be able to provide you with a tracking ID.

                      At this point, we have not entered a feature request as I am trying to further understand what you would like NinjaTrader to do.

                      Also, we have not demonstrated that drawing objects are suspended when the chart is not in view.
                      From my understanding, drawing objects are not suspended as this only applies to indicators. If a timer is added or if a market data subscription was added, these will continue to trigger even if the chart tab is not selected.

                      Further, its sounds as if what you are trying to do should be done with an indicator.

                      Would you like to continue discussing this so that I may provide a use case for our development so that a feature request may be entered?
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        I've explained my use case. Mine is a situation that absolutely should not be done in an indicator (or a very un-user friendly (and bad performance) method of having both an Indicator and custom drawing objects). What I'm trying to do is not simply "compare if price is above a line"... it's a complex calculation looking at groups of bars on the chart, multiple data points, based on the positioning of the drawing object. But all that is beside the point.

                        If no logic is being run within a Drawing Tool when hidden, then it is the equivalent of being suspended when not in view.

                        A Timer is not the same as an incoming tick or price change event.

                        As you said, "there are no methods that trigger in a drawing object when the chart is not being rendered." which is the problem and which is the request.

                        Comment


                          #13
                          Originally posted by neoikon View Post
                          ... it's a complex calculation looking at groups of bars on the chart, multiple data points, based on the positioning of the drawing object. But all that is beside the point.
                          Without seeing the full picture, it sounds like you are using OnRender() for something unrelated to rendering. Even though you might be using objects which are ultimately rendered on the chart, I presume there is a better way to accomplish your goals than using OnRender()

                          Originally posted by neoikon View Post
                          .
                          A Timer is not the same as an incoming tick or price change event.
                          If you need granularity that a timer does not offer, you can subscribe to your own market data events through the Drawing Tools AttachedTo.Instrument object. However - even our internal alert events run on a 200ms timer. So without a timer, you risk running into potential excessive logic processing, or even too little depending on the updates of the market.

                          After reading the cases you provided, I am still unsure why a timer does not satisfy this alerting requirement for you - but if you truly need market data events, those events can be subscribed from the core as long as the Instrument object is available:

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

                          Originally posted by neoikon View Post
                          If no logic is being run within a Drawing Tool when hidden, then it is the equivalent of being suspended when not in view.
                          While I understand the confusion, there is a difference between the suspension logic optionally configured for an indicator, and the rendering optimizations which are done more broadly. If you subscribe to core market data events, they will continue to fire regardless if the drawing tool is in view or not.

                          To clarify why it works this way: If the chart is not visible, there is no use in processing rendering logic since there is nothing for users to see. In other words, if there is nothing to be rendered, the OnRender() logic will not fire to conserve system resources. We will not be changing that behavior to satisfy a use case that the OnRender() method was not designed to solve unless a significant use case which cannot be solved can be brought to our attention.
                          Last edited by NinjaTrader_Matthew; 11-03-2016, 02:38 PM.
                          MatthewNinjaTrader Product Management

                          Comment


                            #14
                            Originally posted by NinjaTrader_Matthew View Post
                            Without seeing the full picture, it sounds like you are using OnRender() for something unrelated to rendering.
                            Correct, since this seemed to be the only location for logic within a custom drawing tool (since OnBarUpdate() doesn't exist).


                            Originally posted by NinjaTrader_Matthew View Post
                            If you need granularity that a timer does not offer, you can subscribe to your own market data events through the Drawing Tools AttachedTo.Instrument object.
                            Yes! This is what I was looking for! I can have this call my OnMarketData(), while filtering out anything that isn't MarketDataType.Last and only when Price actually changes (to help with "over-processing" issues).

                            PHP Code:
                            AttachedTo.Instrument.MarketDataUpdate += new EventHandler<Data.MarketDataEventArgs>(OnMarketData); 

                            Originally posted by NinjaTrader_Matthew View Post
                            To clarify why it works this way: If the chart is not visible, there is no use in processing rendering logic since there is nothing for users to see. In other words, if there is nothing to be rendered, the OnRender() logic will not fire to conserve system resources.
                            Absolutely, that makes perfect sense. Once I realized that, it made me look for something other than OnRender() to handle logic that didn't require visual output. Since OnBarUpdate() didn't exist, my request was for something that did something similar to OnBarUpdate(). However, it seems that subscribing to the MarketDataUpdate event was perfect for that!

                            Thank you Matthew!
                            Last edited by neoikon; 11-04-2016, 07:58 AM.

                            Comment


                              #15
                              You're welcome - Glad we were able to work through that. Thanks for your patience.
                              MatthewNinjaTrader Product Management

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by ksarin, Today, 12:39 PM
                              3 responses
                              11 views
                              0 likes
                              Last Post NinjaTrader_PatrickG  
                              Started by ttodua, Today, 12:03 PM
                              1 response
                              6 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by tomtr27, Today, 11:35 AM
                              1 response
                              9 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by Uregon, Today, 07:30 AM
                              2 responses
                              13 views
                              0 likes
                              Last Post bltdavid  
                              Started by Induna, 02-20-2020, 05:38 AM
                              4 responses
                              26 views
                              0 likes
                              Last Post NinjaTrader_Kate  
                              Working...
                              X