Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

How to code a loading spinner while waiting for the indicator to load

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

    How to code a loading spinner while waiting for the indicator to load

    Hello,

    I 've been trying to code a loading spinner while waiting for the indicator to load so that the users know what is currently happening.
    Can you help somewhat or have some advice about how to do it.
    Is it feasible ?

    Thank you!


    #2
    Hello blar58,

    Thank you for your post.

    When you mean "waiting for the indicator to load", do you mean the standard indicator loading time or something your script is doing after the indicator was applied and has processed?

    I look forward to your response.
    Gaby V.NinjaTrader Customer Service

    Comment


      #3
      For example OnBarUpdate is loading historical ticks? It is something that my script is doing and take a while.

      Comment


        #4
        Hello,

        Doing something like this would on the chart would require OnRender, however unfortunately there is not a way to draw on the screen using OnRender before the indicator has had time to process in real time.

        You could display a still image on the the chart once the indicator has already processed, but a moving spinner would require forcing refreshes on the chart.

        ForceRefresh() - https://ninjatrader.com/support/helpGuides/nt8/forcerefresh.htm

        Please let us know if you have any other questions.
        Gaby V.NinjaTrader Customer Service

        Comment


          #5
          Gaby,

          if I understand it means that it is feasible but I would have to call ForceRefresh() everything x number of ticks loaded by OnBarUpdate for example.
          If so will it uses more time to load?
          And I would have to use xaml file to create the Spinner Control where do I put the file and how do I refer it in my code ?

          Thank you !

          Comment


            #6
            Hello,

            Unfortunately, it is not feasible since if I understand correctly you are looking to have the spinner load while the indicator is still processing. There is no way to draw on the screen using OnRender before the screen has processed and is in realtime.

            You could only render something like this on the screen once indicator has already processed.
            Gaby V.NinjaTrader Customer Service

            Comment


              #7
              if I load my historical data through a background worker instead of OnBarUpdate would it be possible?

              Comment


                #8
                Hello,

                Unfortunately, you cannot change how the script loads historical data.

                You could do a BarsRequest if you are trying to get historical data after the script has already loaded, but this cannot be used with indicators (and would be separate from the OnBarUpdate override). Please note this would just be a collection of data points and a subscription for realtime data.

                Below is a forum post with an example script demonstrating a BarsRequest:




                Ultimately, it is not possible to render/display something like this on the screen since this would have to be done in OnBarUpdate and the script needs to finish processing before anything can be displayed.

                If you are concerned with users not being able to tell if the indicator is loading, the indicator's name will be displayed in text at the top of chart and will say "Calculating.." next to the name until it is fully loaded.
                Gaby V.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Jonafare, 12-06-2012, 03:48 PM
                5 responses
                3,984 views
                0 likes
                Last Post rene69851  
                Started by Fitspressorest, Today, 01:38 PM
                0 responses
                2 views
                0 likes
                Last Post Fitspressorest  
                Started by Jonker, Today, 01:19 PM
                0 responses
                2 views
                0 likes
                Last Post Jonker
                by Jonker
                 
                Started by futtrader, Today, 01:16 PM
                0 responses
                7 views
                0 likes
                Last Post futtrader  
                Started by Segwin, 05-07-2018, 02:15 PM
                14 responses
                1,791 views
                0 likes
                Last Post aligator  
                Working...
                X