Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Create Bars type of assets spread.

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

    Create Bars type of assets spread.

    How am I best to go about creating a bars type that shows the spread between two assets in a brick (renko) formation.

    I can create my own bricks sampled from 1m data so far.

    I can't add another data series in the bars type however. It seems this is not possible? Correct me if i'm wrong please?

    I'm unsure how to access a custom data feed that I have as a CSV to create this bar type.
    Are there any examples of creating my bar charts from my own OHLCV csv files.

    Kind regards.

    (This is for a pairs trading strategy that will involve copulas with some technical indicators).







    #2
    An idea for solution.

    I create a static class in an indicator to hold the bars data from the second series.

    I load up the first series and have the bar type written to pull data from this static class to form the bars.

    Will give this an attempt in next few days but if anyone sees this and has failed with this method or been successful let me know.

    Kind regards.




    Comment


      #3
      Hello OllieFeraher,

      A BarsType can only input a single instruments data at once so that would not be a good candidate for comparing two instruments. An indicator would be suggested for this type of use, you can use AddDataSeries in the indicator to add the other instrument to be compared.

      Comment


        #4
        I've done this.

        The problem is then my indicator is waiting for a value from a single series to update its value, but I want it to only update when the spread between two values hits certain thresholds,
        so i'll be left with unsightly looking gaps in the series where the chart its attached to updates but it doesn't.

        Also it seems to draw all the bars on an indicator is going to be less efficient than the chart due to a vast amount of drawn objects?

        We really need to be able to create our own data series and instruments on NinjaTrader.

        Is there a way to upload my own data as an instrument, then I could write this outside of ninjatrader in a language i'm more comfortable with and feed it in.

        Kind regards

        Comment


          #5
          Hello OllieFeraher,

          You can import custom historical data to an instrument but there would not be a way to update it in realtime. The external data feed could be used to pump in data however that connection cannot be used with other connections so you would only be able to view that single instrument.

          An indicator would be the only option to include multiple series to perform a calculation. The indicator would still be set to a specific underlying bar series so the plots or values you calculate would relate to how the indicator processes on that series. Secondary data can be used but any visuals or series would be fixed to the chart bars indexing.

          Comment


            #6
            Do you have an example of using the external data feed,
            Could I create my spread with another language (python) save it in a csv file or sql and pump it into ninjatrader with the external data feed?

            Kind regards.


            Currently:

            I'm managing to use the bars type to pull closes from another asset and compare them...
            Its a bit of a hacky solution, though as long as I have an asset on NT that is active every 1m I can try pull from my file every 1m.

            Comment


              #7
              Hello OllieFeraher,

              I have included a link to an unsupported sample below. The external data feed can be used to view data that is pushed in from an external application but that data cant be used in conjunction with any other data providers/brokers that you are using. If the point is just to look at a chart of that data you could do that but beyond that there is not much use for that connection because you wouldn't be able to use that instrument for analysis while trading a actual instrument on a different connection. If you need to read a value from an external program it would be better to just write the data you wanted to a file and then read that file from an indicator so it can re read it when it needs to update. As long as two programs aren't trying to read/write the file at the same time that would work.



              Comment


                #8
                Thank you Jesse i've taken a look but may need to wait till i've a stronger grip on C#.

                This is my "halfway passable" current solution.
                If anyone is wondering.
                I've managed to use an indicator to save to a database that I read from a chart.
                Given the indicator can hold several series I can perform calculations there and pass them.

                I don't quite have the UpdateBar method understood, it always ends up looking odd for me.
                Though after a long ... long time fiddling around i've got closes printing.

                I do get odd bugs here and there.

                If there is any internal process that doesn't want me to be doing this and is activating please let me know as i'll be dumping a lot of time into this.


                Kind regards.

                Oliver.




                Attached Files

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                556 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                324 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                101 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                545 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                547 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X