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

NT7: Multiple Data Series/timeframes and computer resources

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

    NT7: Multiple Data Series/timeframes and computer resources

    I am familiar with the performance tips in the NT Help section and now I am trying to better understand how the use of multiple DataSeries used in a self-created indicator affects performance.
    Therefore I would appreciate if you could lay this out for me - if possible with as less technical computer lingo as possible. Most of the time I am using on BarsUpdate set to False.

    For example I am using 10 DataSeries/timeframes (from 1min up to 240mins) in one indicator. Does it make a difference performance wise if I actually only use 8 of these - with 2 Data Series not being used but I have not gotten around to updating the code by changing various BarsArrays. In other words, does the mere fact that there is a DataSeries in the Initialize section but not otherwise being used in the code make a difference?

    Or for example I run two self created indicators in one chart. Both indicators use multiple timeframes, let's say 10 of them. I could easily put the two codices together into one indicator. It would make that one indicator naturally a lot larger but would mean I am "importing" the concerned timeframes/DataSeries into only one indicator instead of two. Again, does it make a difference and if so how?

    I hope I have expressed myself sufficiently clear (if not please ask), and I hope you can enlighten me. (Any reader here is also invited to chip in with their experience).

    sandman

    #2
    Hello sandman,

    If you add 10 data series the script will use all of them, you would want to only add series that you will use.

    For your second question if both indicators use extra timeframes they will both request data and subscribe to data for the series you add.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Jesse. Thanks. Your answer does not fully give me what I am after but your choice of words gave me a glimpse. Rather than ask more questions I want to lay out how I think it may work.

      Please review this and correct me if/where I am wrong. (Excuse my vocabulary but I am not a professional programmer.) Here goes:

      There is a main data flow coming into NT which consists of a continuous flow of price with a time stamp for as many instruments that I have activated through the Instrument Manager. It is processed/formatted by NT so that it can show up in the NT ControlCenter (Orders tab open). One can see the last Bid, Ask price, as well as the Open, High, Low of one instrument.

      Now I open a chart, let's say a 5min chart - with no indicators just, let's say, candle sticks. The moment I open that chart, the software creates a 5min BarsArray with an Index number of 0 (which is the Primary BarsArray).

      [At this point I have two options that affect performance: 1. ChartProperties Display update interval. The larger I put it, the less often it needs to be active. 2. Days to load. The more Days I choose, the more data needs to be worked with].

      This 5minBars array is fed by the main data flow from which it must have requested or subscribed to data (using your words, and I hope correctly). This request and subscription is limited based on how many Days To Load I have chosen. The data (price plus volume plus time stamps) is now being formatted in that BarsArray for its purpose which is to create a current and past 5min candle sticks. To do that the array calculates the 5min OHLCV values (Open, High, Low, Close, Volume).

      Now I add an indicator to that chart, let's say an EMA. Based on which data is that EMA created? I assume it does not tab into - what I call - the main data flow but uses the copied (and limited) data which exist in that 5min BarsArray. That data is processed through the EMA's formula and then creates the plotted line in the chart. [Here I have the option to run it OnBarClose​ True or False. True means it must work on every incoming tick. False means the lazy mode because it must work only every 5minutes].

      Adding another indicator, e.g. an SMA means again that this SMA is created through the 5min BarArrays' data structure, not the main data flow. And so on. As long as I stay with the 5min as the Primary DataSeries all subsequently added indicators in that one chart use the same 5min BarsArray to do their job.

      When I now open a 2nd chart, let's say a 20Tick Range chart, all the above is repeated. The moment I open this 20TickRange chart, a new separate BarsArray is created which plugs into the main flow to get the data, and then creates OHLCV within its 20Tick parameter. Indicators used in that chart then use that array's data.

      In summary, I have a main data flow into NT, and with the 2 charts there are 2 separate arrays which were created and which individually feed from that main data flow.

      So far so good. Is that correct so far?

      sandman

      Comment


        #4
        Hello sandman,

        While I don't have any resources I can provide that list how NinjaTrader internally handles data for charts we can try to cover any coding questions that you have. I otherwise wont be able to confirm how the data in NT7 was handled as that was never documented.

        For your original question if you use a script that adds data it will need to request and subscribe to each of those series because it added them in code. If you don't use a few of those series you can remove them to reduce the required data.




        JesseNinjaTrader Customer Service

        Comment


          #5
          Jesse. I have serious difficulties with your reply. If you don't know how the NT software deals with incoming price data then please relay the question to someone in Ninjatrader who does know! After all who else should I turn to?

          But also let me try it differently:
          You said "request data and subscribe to data for the series you add" in your original reply; now you say using "a script that adds data it will need to request and subscribe to each of those series because it added them in code".

          First you speak of requesting and subscribing to data, now it's requesting and subscribing to each of the series.

          Please elaborate on "requesting data" i.e. from where or from what? Subscribe where? What do you mean with series here?

          (NB: I am not trying to give you a hard time, I am simply trying to develop a better basic understanding of how the data structures/arrays are built, how many of them and how they interact.)

          sandman

          Comment


            #6
            Hello sandman,

            Our support team knows what is documented by development and is publically available in the help guide. We cant look at the source code to know more intricate details on items like how a chart loads data in specific scenarios. I can say that with NinjaScript each Add() call will add the historical data set, request new historical data if available and subscribe to live data for that series.

            Requesting data means loading historical data for the time you selected along with subscribing to realtime data. Each series you Add() does this. If you find that you don't use some series you can remove them to save resources.





            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by fx.practic, 10-15-2013, 12:53 AM
            5 responses
            5,404 views
            0 likes
            Last Post Bidder
            by Bidder
             
            Started by Shai Samuel, 07-02-2022, 02:46 PM
            4 responses
            95 views
            0 likes
            Last Post Bidder
            by Bidder
             
            Started by DJ888, Yesterday, 10:57 PM
            0 responses
            8 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by MacDad, 02-25-2024, 11:48 PM
            7 responses
            159 views
            0 likes
            Last Post loganjarosz123  
            Started by Belfortbucks, Yesterday, 09:29 PM
            0 responses
            8 views
            0 likes
            Last Post Belfortbucks  
            Working...
            X