Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using ForceRefresh in NS

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

    Using ForceRefresh in NS

    Hi,
    The ForceRefresh() method is not accessible from any function in ninjascript. How can I use it? Any way to refresh asynchronously like I saw people use in NT7 (Cbi.Globals.SynchronizeInvoke.AsyncInvoke)?

    #2
    Hello ToMer_K,

    Thank you for your post.

    You can find details on ForceRefresh() at the following link: http://ninjatrader.com/support/helpG...rcerefresh.htm

    You can use Dispatcher.InvokeAsync in NinjaTrader 8. Please visit the following link for more details: https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx

    Comment


      #3
      This is where I encountered the ForceRefresh() method. I can see it is accessible by indicators and not strategies. Anyway to make it available for my strategy?

      Will using it asynchronously can cause issues?

      Comment


        #4
        Hello ToMer_K,

        Thank you for your response.

        You could use a dispatcher in the Strategy. ForceRefresh() is used for objects that use OnRender() where a strategy would not call OnRender() in most cases.

        Comment


          #5
          Hi,
          I guess you do not follow me correctly. There is no method called "ForceRefresh" when inheriting from Strategy. How can I still use it in a strategy?

          I see it comes from IndicatorRenderBase. Anyway to access it without instantiating an Indicator?

          Comment


            #6
            Hello ToMer_K,

            You can instantiate an indicator and then call ForceRefresh from the indicator. For example:
            Code:
            private SMA mySMA;
            ...
            			else if (State == State.Configure)
            			{
            				mySMA = SMA(20);
            			}
            ...
            		protected override void OnBarUpdate()
            		{
            			mySMA.ForceRefresh();

            Comment


              #7
              Originally posted by ToMer_K View Post
              Anyway to access it without instantiating an Indicator?
              I have no indicator in my strategy and I think it is a waste to instantiate an indicator just for using the refresh function... It takes more resources and adds redundant event calls. I need my strategy to run as fast as possible.

              If there is no way to do so I recommend you to add this function to strategies as well because many of them use visualizations here and there that may need faster refresh.
              Last edited by ToMer_K; 06-28-2016, 07:52 PM.

              Comment


                #8
                I will submit your suggestion to development.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by DJ888, 04-16-2024, 06:09 PM
                6 responses
                18 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by Jon17, Today, 04:33 PM
                0 responses
                1 view
                0 likes
                Last Post Jon17
                by Jon17
                 
                Started by Javierw.ok, Today, 04:12 PM
                0 responses
                6 views
                0 likes
                Last Post Javierw.ok  
                Started by timmbbo, Today, 08:59 AM
                2 responses
                10 views
                0 likes
                Last Post bltdavid  
                Started by alifarahani, Today, 09:40 AM
                6 responses
                41 views
                0 likes
                Last Post alifarahani  
                Working...
                X