Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Refresh historical chart data

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

    Refresh historical chart data

    Hi,

    I am using this solution to import historical data when my folder contains a new file


    It works fine however but i need to manually refresh the data of the open chart by changing the time frame from 1M to something else and then back to 1M. How can I programmatically refresh the open chart?

    #2
    Hello Tolisss,

    You could use the following, ReloadAllHistoricalData(), which is detailed in our helpguide at the following link,



    I have also attached a sample which will reload all historical data on each bar update. This is for demonstration purposes and would not be a suggested.

    Please let us know if you need further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      unfortunately I cannot make it work here is the code I use in an Addon
      Code:
              protected override void OnWindowCreated(Window window){
                  base.OnWindowCreated(window);
                  _chart = window as Chart;
                  if (_chart == null)
                      return;
                  using (DataImportType textImportType = new DataImportType(@"TEST")) {
                      textImportType.SetState(State.Configure);
                      textImportType.Import(MarketDataType.Last, TimeZoneInfo.Utc, true, true, null);
                  }
                  _chart.Dispatcher.InvokeAsync(() => { ChartCommands.ReloadHistoricalData.Execute(null); });
              }
      As you can see I use a custom instrument TEST and an external connection. Note that the Reload All Historical data chart context menu entry is disabled.

      The chart open empty if a change the interval the chart is drawn fine I want to refresh the chart and not the HistoricalData as I just imported them

      Comment


        #4
        Hello tolisss,

        Since this is an external data feed and there is no data provider with a server, NT doesn’t know what to do with that reload historical data request.

        How frequently do you need to reload data?

        If you wanted to reload this often, you may consider seeing the following example since you’re already using the external data feed,



        I look forward to your reply.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Hi Alan,

          The NT ATI interface introduces inter-process communication as it is not possible to call it from within an AdddOn. I was hoping to avoid this complexity and from what I can tell it is possible to reload the data if you just change the chart time interval to something else and back or even it should be possible to draw the chart as it goes on the fly by feeding the last bar ticks directly from the chart.

          Comment


            #6
            Hello tolisss,

            Thank you for your patience.

            Attached is an example of switching the chart interval from within an indicator. You could use the logic to switch the chart interval to one value and then back to another.

            Please let me know if you have any questions.
            Attached Files

            Comment


              #7
              Originally posted by NinjaTrader_PatrickH View Post
              Hello tolisss,

              Thank you for your patience.

              Attached is an example of switching the chart interval from within an indicator. You could use the logic to switch the chart interval to one value and then back to another.

              Please let me know if you have any questions.
              How do I import this .cs file for switching the chart interval from within an indicator into NT8?

              Comment


                #8
                Hello kal1212,

                The above "ChangeChartPeriodTypeAndValue.cs" file is only an example of how this code could be embedded in an indicator.

                As such, this file would not work on its own and is meant as a starting point for the development of a custom script or indicator.

                The script itself would have to be put in the below folder. NinjaTrader would then show it in the list of indicators once it has been restarted:

                (My) Documents > NinjaTrader 8 > bin > Custom > Indicators

                Please don't hesitate to let me know, should you have any further questions!
                Manfred F.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by trilliantrader, Today, 08:16 AM
                0 responses
                3 views
                0 likes
                Last Post trilliantrader  
                Started by AttiM, 02-14-2024, 05:20 PM
                9 responses
                174 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by funk10101, Today, 08:14 AM
                0 responses
                2 views
                0 likes
                Last Post funk10101  
                Started by adeelshahzad, Today, 03:54 AM
                1 response
                13 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by RookieTrader, Today, 07:41 AM
                1 response
                5 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Working...
                X